Repository navigation
Conversation
|
|
||
| class Record(dict): | ||
| """\ | ||
| r"""\ |
There was a problem hiding this comment.
While you are editing this bit of the code, can you remove the trailing slash and use:
class Record(dict):
r"""Holds information from an ExPASy ENZYME record as a Python dictionary.
Each record contains the following keys:
...There was a problem hiding this comment.
On reading the whole docstring, I suspect that trailing slash is the only reason pydocstyle complained. i.e. Does this work with no raw string mode:
class Record(dict):
"""Holds information from an ExPASy ENZYME record as a Python dictionary.
Each record contains the following keys:
...
There was a problem hiding this comment.
@peterjc and remove the word "information"?
There was a problem hiding this comment.
Sorry, cut-and-paste error. Keep the word information.
There was a problem hiding this comment.
If this does seem to be a false positive from pydocstyle, we should make a simple test case and report a bug to them. But maybe I'm just overlooking a slash elsewhere in this docstring while reading this in GitHub?
There was a problem hiding this comment.
@peterjc I made the fix and removed the r and it worked fine.
|
|
||
| def read_colorscheme(self, filename): | ||
| """ read_colorscheme(self, filename) | ||
| r""" read_colorscheme(self, filename) |
There was a problem hiding this comment.
Can you remove the leading space as well, i.e.
def read_colorscheme(self, filename):
"""read_colorscheme(self, filename)
(That still isn't PEP257 ready but its closer)
|
|
||
| def residue_dict(self, index): | ||
| """Return a dict of lines in \`data\` indexed by residue number or a nucleus. | ||
| r"""Return a dict of lines in \`data\` indexed by residue number or a nucleus. |
There was a problem hiding this comment.
Rather than adding the leading r for raw mode, can you just remove the escaped back ticks? For RST I think plain backticks would be fine.
| # | ||
|
|
||
| """Deal with Motifs or Signatures allowing ambiguity in the sequences. | ||
| r"""Deal with Motifs or Signatures allowing ambiguity in the sequences. |
There was a problem hiding this comment.
Again rather than adding raw mode to the string, I'd remove the escaped backticks - it looks like simple quote strings would make sense here.
|
|
||
| def _compact4nexus(orig_list): | ||
| """Transform [1 2 3 5 6 7 8 12 15 18 20] (baseindex 0, used in the Nexus class) | ||
| r"""Transform [1 2 3 5 6 7 8 12 15 18 20] (baseindex 0, used in the Nexus class) |
There was a problem hiding this comment.
Can you tell from the rest of the file if the next line should now say 2-4 6-9 13-19\3 21 rather than 2-4 6-9 13-19\\3 21 if you switch it to raw mode?
There was a problem hiding this comment.
@peterjc this is the only one I'm not sure about.
There was a problem hiding this comment.
@etal - do you know what this docstring is intending to show the user with slashes in Nexus? The current rendering via epydoc looks wrong to me http://biopython.org/DIST/docs/api/Bio.Nexus.Nexus-module.html#_compact4nexus (likely a side effect of switching to assuming reStructuredText in the past?).
|
It looks like most of these are from slashes used in Windows paths (switching to raw mode is fine), a few where we have \t for a tab (depends if it should be an actual tab or shown to the user as slash-t), and a few \ which may or may not be meant to be shown to the user as a single slash. Viewing the docstring documentation rendered as reStructuredText by epydoc might be helpful here - http://biopython.org/DIST/docs/api/ |
|
Explicit unicode markup i.e. This means you've expanded this pul request to cover D302 as well? D302 Use u”“” for Unicode docstrings |
| @@ -1,2 +1,2 @@ | |||
| [pydocstyle] | |||
| ignore = D100,D101,D102,D103,D104,D105,D200,D203,D204,D205,D207,D208,D209,D210,D212,D213,D214,D301,D302,D400,D401,D402,D403,D404,D405,D406,D407,D412,D413 | |||
| ignore = D100,D101,D102,D103,D104,D105,D200,D203,D204,D205,D207,D208,D209,D210,D212,D213,D214,D400,D401,D402,D403,D404,D405,D406,D407,D412,D413 No newline at end of file | |||
There was a problem hiding this comment.
You've lost the final new line in the fine - perhaps a quirk of your editor?
There was a problem hiding this comment.
this one was likely due to the fact that i had to edit it manually to resolve a conflict.
|
Some of these changes are indirectly breaking the docstests, specifically It will likely need Biopython installed, but you should be able to run their doctest tests directly like this: Or, from the See also #531 |
|
@peterjc it's funny, this was originally for 301 but i later went to 302 and didn't get any errors when I ran pydocstyle...so I kept it off of the ignore list. The errors that appeared during the build were the first 302 errors I'd seen! What can I do to prevent breaking more tests? |
|
When editing docstrings which contain doctests, there is always a chance of breaking the doctest as they are very fragile for string matching. In general when adding raw mode to a string you MUST review all the uses of slash in the docstring, and unescape things like It may be some of these docstrings are deliberately using |
|
@peterjc OK I've gone back over the files and it seems like the following files are using \ for something other than a file path: Removing the r""" from these files would allow them to work again, but they'd fail the style test, which I think is why you were considering the |
|
Looking at https://github.com/biopython/biopython/blob/biopython-169/Bio/Graphics/GenomeDiagram/_Colors.py#L124 it uses However, right now this is not being rendered properly as reStructuredText, see http://biopython.org/DIST/docs/api/Bio.Graphics.GenomeDiagram._Colors.ColorTranslator-class.html#read_colorscheme This needs fixing too, using an RST editor like http://rst.ninjs.org/ I came up with this version as the docstring (which should be in raw mode): Here is the GitHub rendering: Load colour scheme from file.
Reads information from a file containing color information and stores it
internally.
Argument filename is the location of a file defining colors in tab-separated
format plaintext as::
INT \t RED \t GREEN \t BLUE \t Comment
Where RED, GREEN and BLUE are intensities in the range 0 -> 255, e.g.::
2 \t 255 \t 0 \t 0 \t Red: Information transferUPDATE: I applied this as 50149e1 |
|
Looking at https://github.com/biopython/biopython/blob/biopython-169/Bio/SearchIO/FastaIO.py#L69 the strings like Here putting the docstring into raw mode should be fine. |
|
Looking at https://github.com/biopython/biopython/blob/biopython-169/Bio/motifs/applications/_xxmotif.py it does not look like a D301 raw mode issue, but D302 unicode mode. |
|
Looking at https://github.com/biopython/biopython/blob/biopython-169/Bio/Sequencing/Applications/_bwa.py#L65 it uses >>> read_group="@RG\tID:foo\tSM:bar"It looks like it renders poorly right now, http://biopython.org/DIST/docs/api/Bio.Sequencing.Applications._bwa.BwaAlignCommandline-class.html - but I think using raw mode would fix that (just add the |
|
However https://github.com/biopython/biopython/blob/biopython-169/Bio/Sequencing/Applications/_bwa.py#L221 is more tricky - the failing doctest on your branch. Note the comment after it, Here we want the user to see But later on in the print output there should two actual tabs: Strangely they seem to be spaces right now, as checked with: |
|
Have you enabled the git pre-commit hook as suggested in https://github.com/biopython/biopython/blob/master/CONTRIBUTING.rst - that would help with catching some errors much earlier? |
|
Try experimenting with the BWA example and see if you can get both |
|
@peterjc I have not...from the discussion I wasn't sure if it worked correctly on Windows, but I can try it. Is this the recommended version ? |
|
Currently we recommend https://github.com/cbrueffer/pep8-git-hook but you're welcome to try out https://github.com/peterjc/biopython/blob/pre_commit_linting/Scripts/git_pre_commit_hook.py which will hopefully replace it (and does more checks). |
|
@peterjc will do. It's a great idea! I sent a tiny PR to your version of the script. 😄 |
|
How about we focus just on the easy cases for now, and save the troublesome ones for another day (the doctests and NEXUS one)? |
|
Current D301 status, Do you mind if I close this pull request and we come back to D301 later? |
|
@peterjc That's fine. |
|
I think I've fixed the remaining unescaped backslashes in docstrings (pydocstyle D301) issues as part of pull request #1462 - some of them were quite confusing! |
Ref. #1170