Skip to content

Fixes for pydocstyle rule D301 - #1173

Closed
morrme wants to merge 13 commits into
biopython:masterfrom
morrme:fixquotes
Closed

morrme wants to merge 13 commits into
biopython:masterfrom
morrme:fixquotes

Conversation

@morrme

@morrme morrme commented Apr 19, 2017

Copy link
Copy Markdown
Contributor

Ref. #1170

Comment thread Bio/ExPASy/Enzyme.py Outdated

class Record(dict):
"""\
r"""\

@peterjc peterjc Apr 19, 2017 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
    ...

@peterjc peterjc Apr 19, 2017 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
    ...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peterjc and remove the word "information"?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, cut-and-paste error. Keep the word information.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peterjc I made the fix and removed the r and it worked fine.

Comment thread Bio/Graphics/GenomeDiagram/_Colors.py Outdated

def read_colorscheme(self, filename):
""" read_colorscheme(self, filename)
r""" read_colorscheme(self, filename)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Comment thread Bio/NMR/xpktools.py Outdated

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread Bio/NeuralNetwork/Gene/Schema.py Outdated
#

"""Deal with Motifs or Signatures allowing ambiguity in the sequences.
r"""Deal with Motifs or Signatures allowing ambiguity in the sequences.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread Bio/Nexus/Nexus.py

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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peterjc this is the only one I'm not sure about.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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?).

@peterjc

peterjc commented Apr 19, 2017

Copy link
Copy Markdown
Member

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/

@peterjc

peterjc commented Apr 20, 2017 •

Copy link
Copy Markdown
Member

Explicit unicode markup u"""text... makes sense for special characters eg in reference names, presumably only needed for Python 2 now.

i.e. This means you've expanded this pul request to cover D302 as well?

D302 Use u”“” for Unicode docstrings

Comment thread .pydocstyle Outdated
@@ -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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've lost the final new line in the fine - perhaps a quirk of your editor?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one was likely due to the fact that i had to edit it manually to resolve a conflict.

@peterjc

peterjc commented Apr 20, 2017

Copy link
Copy Markdown
Member

Some of these changes are indirectly breaking the docstests, specifically Bio/Sequencing/Applications/_bwa.py and Bio/Sequencing/Applications/_samtools.py

It will likely need Biopython installed, but you should be able to run their doctest tests directly like this:

$ python3 Bio/Sequencing/Applications/_bwa.py
Running doctests...
Done

Or, from the Tests/ directory,

$ python3 run_tests.py doctest
...

See also #531

e.g. from https://travis-ci.org/biopython/biopython/jobs/223813617

======================================================================
FAIL: BwaSampeCommandline (Bio.Sequencing.Applications._bwa)
Doctest: Bio.Sequencing.Applications._bwa.BwaSampeCommandline
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/python/2.7.9/lib/python2.7/doctest.py", line 2226, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for Bio.Sequencing.Applications._bwa.BwaSampeCommandline
  File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Sequencing/Applications/_bwa.py", line 220, in BwaSampeCommandline
----------------------------------------------------------------------
File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Sequencing/Applications/_bwa.py", line 244, in Bio.Sequencing.Applications._bwa.BwaSampeCommandline
Failed example:
    print(sampe_cmd)
Expected:
    bwa sampe /path/to/reference_genome.fasta /path/to/read_1.sai /path/to/read_2.sai /path/to/read_1.fq /path/to/read_2.fq -r @RG       ID:foo  SM:bar
Got:
    bwa sampe /path/to/reference_genome.fasta /path/to/read_1.sai /path/to/read_2.sai /path/to/read_1.fq /path/to/read_2.fq -r @RG	ID:foo	SM:bar
======================================================================
FAIL: SamtoolsCalmdCommandline (Bio.Sequencing.Applications._samtools)
Doctest: Bio.Sequencing.Applications._samtools.SamtoolsCalmdCommandline
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/python/2.7.9/lib/python2.7/doctest.py", line 2226, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for Bio.Sequencing.Applications._samtools.SamtoolsCalmdCommandline
  File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Sequencing/Applications/_samtools.py", line 631, in SamtoolsCalmdCommandline
----------------------------------------------------------------------
File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Sequencing/Applications/_samtools.py", line 645, in Bio.Sequencing.Applications._samtools.SamtoolsCalmdCommandline
Failed example:
    samtools_calmd_cmd = SamtoolsCalmdCommandline(\
Exception raised:
    Traceback (most recent call last):
      File "/opt/python/2.7.9/lib/python2.7/doctest.py", line 1315, in __run
        compileflags, 1) in test.globs
      File "<doctest Bio.Sequencing.Applications._samtools.SamtoolsCalmdCommandline[3]>", line 1
        samtools_calmd_cmd = SamtoolsCalmdCommandline(\
                                                      ^
    SyntaxError: unexpected EOF while parsing
----------------------------------------------------------------------
File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Sequencing/Applications/_samtools.py", line 648, in Bio.Sequencing.Applications._samtools.SamtoolsCalmdCommandline
Failed example:
    print(samtools_calmd_cmd)
Exception raised:
    Traceback (most recent call last):
      File "/opt/python/2.7.9/lib/python2.7/doctest.py", line 1315, in __run
        compileflags, 1) in test.globs
      File "<doctest Bio.Sequencing.Applications._samtools.SamtoolsCalmdCommandline[4]>", line 1, in <module>
        print(samtools_calmd_cmd)
    NameError: name 'samtools_calmd_cmd' is not defined
======================================================================
FAIL: SamtoolsFixmateCommandline (Bio.Sequencing.Applications._samtools)
Doctest: Bio.Sequencing.Applications._samtools.SamtoolsFixmateCommandline
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/python/2.7.9/lib/python2.7/doctest.py", line 2226, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for Bio.Sequencing.Applications._samtools.SamtoolsFixmateCommandline
  File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Sequencing/Applications/_samtools.py", line 551, in SamtoolsFixmateCommandline
----------------------------------------------------------------------
File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Sequencing/Applications/_samtools.py", line 566, in Bio.Sequencing.Applications._samtools.SamtoolsFixmateCommandline
Failed example:
    samtools_fixmate_cmd = SamtoolsFixmateCommandline(\
Exception raised:
    Traceback (most recent call last):
      File "/opt/python/2.7.9/lib/python2.7/doctest.py", line 1315, in __run
        compileflags, 1) in test.globs
      File "<doctest Bio.Sequencing.Applications._samtools.SamtoolsFixmateCommandline[3]>", line 1
        samtools_fixmate_cmd = SamtoolsFixmateCommandline(\
                                                          ^
    SyntaxError: unexpected EOF while parsing
----------------------------------------------------------------------
File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Sequencing/Applications/_samtools.py", line 569, in Bio.Sequencing.Applications._samtools.SamtoolsFixmateCommandline
Failed example:
    print(samtools_fixmate_cmd)
Exception raised:
    Traceback (most recent call last):
      File "/opt/python/2.7.9/lib/python2.7/doctest.py", line 1315, in __run
        compileflags, 1) in test.globs
      File "<doctest Bio.Sequencing.Applications._samtools.SamtoolsFixmateCommandline[4]>", line 1, in <module>
        print(samtools_fixmate_cmd)
    NameError: name 'samtools_fixmate_cmd' is not defined
======================================================================
FAIL: SamtoolsMergeCommandline (Bio.Sequencing.Applications._samtools)
Doctest: Bio.Sequencing.Applications._samtools.SamtoolsMergeCommandline
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/python/2.7.9/lib/python2.7/doctest.py", line 2226, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for Bio.Sequencing.Applications._samtools.SamtoolsMergeCommandline
  File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Sequencing/Applications/_samtools.py", line 409, in SamtoolsMergeCommandline
----------------------------------------------------------------------
File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Sequencing/Applications/_samtools.py", line 425, in Bio.Sequencing.Applications._samtools.SamtoolsMergeCommandline
Failed example:
    samtools_merge_cmd = SamtoolsMergeCommandline(\
Exception raised:
    Traceback (most recent call last):
      File "/opt/python/2.7.9/lib/python2.7/doctest.py", line 1315, in __run
        compileflags, 1) in test.globs
      File "<doctest Bio.Sequencing.Applications._samtools.SamtoolsMergeCommandline[3]>", line 1
        samtools_merge_cmd = SamtoolsMergeCommandline(\
                                                      ^
    SyntaxError: unexpected EOF while parsing
----------------------------------------------------------------------
File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Sequencing/Applications/_samtools.py", line 428, in Bio.Sequencing.Applications._samtools.SamtoolsMergeCommandline
Failed example:
    print(samtools_merge_cmd)
Exception raised:
    Traceback (most recent call last):
      File "/opt/python/2.7.9/lib/python2.7/doctest.py", line 1315, in __run
        compileflags, 1) in test.globs
      File "<doctest Bio.Sequencing.Applications._samtools.SamtoolsMergeCommandline[4]>", line 1, in <module>
        print(samtools_merge_cmd)
    NameError: name 'samtools_merge_cmd' is not defined
======================================================================
FAIL: SamtoolsReheaderCommandline (Bio.Sequencing.Applications._samtools)
Doctest: Bio.Sequencing.Applications._samtools.SamtoolsReheaderCommandline
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/python/2.7.9/lib/python2.7/doctest.py", line 2226, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for Bio.Sequencing.Applications._samtools.SamtoolsReheaderCommandline
  File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Sequencing/Applications/_samtools.py", line 244, in SamtoolsReheaderCommandline
----------------------------------------------------------------------
File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Sequencing/Applications/_samtools.py", line 259, in Bio.Sequencing.Applications._samtools.SamtoolsReheaderCommandline
Failed example:
    samtools_reheader_cmd = SamtoolsReheaderCommandline(\
Exception raised:
    Traceback (most recent call last):
      File "/opt/python/2.7.9/lib/python2.7/doctest.py", line 1315, in __run
        compileflags, 1) in test.globs
      File "<doctest Bio.Sequencing.Applications._samtools.SamtoolsReheaderCommandline[3]>", line 1
        samtools_reheader_cmd = SamtoolsReheaderCommandline(\
                                                            ^
    SyntaxError: unexpected EOF while parsing
----------------------------------------------------------------------
File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Sequencing/Applications/_samtools.py", line 262, in Bio.Sequencing.Applications._samtools.SamtoolsReheaderCommandline
Failed example:
    print(samtools_reheader_cmd)
Exception raised:
    Traceback (most recent call last):
      File "/opt/python/2.7.9/lib/python2.7/doctest.py", line 1315, in __run
        compileflags, 1) in test.globs
      File "<doctest Bio.Sequencing.Applications._samtools.SamtoolsReheaderCommandline[4]>", line 1, in <module>
        print(samtools_reheader_cmd)
    NameError: name 'samtools_reheader_cmd' is not defined
======================================================================
FAIL: SamtoolsRmdupCommandline (Bio.Sequencing.Applications._samtools)
Doctest: Bio.Sequencing.Applications._samtools.SamtoolsRmdupCommandline
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/python/2.7.9/lib/python2.7/doctest.py", line 2226, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for Bio.Sequencing.Applications._samtools.SamtoolsRmdupCommandline
  File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Sequencing/Applications/_samtools.py", line 588, in SamtoolsRmdupCommandline
----------------------------------------------------------------------
File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Sequencing/Applications/_samtools.py", line 602, in Bio.Sequencing.Applications._samtools.SamtoolsRmdupCommandline
Failed example:
    samtools_rmdup_cmd = SamtoolsRmdupCommandline(\
Exception raised:
    Traceback (most recent call last):
      File "/opt/python/2.7.9/lib/python2.7/doctest.py", line 1315, in __run
        compileflags, 1) in test.globs
      File "<doctest Bio.Sequencing.Applications._samtools.SamtoolsRmdupCommandline[3]>", line 1
        samtools_rmdup_cmd = SamtoolsRmdupCommandline(\
                                                      ^
    SyntaxError: unexpected EOF while parsing
----------------------------------------------------------------------
File "/home/travis/build/biopython/biopython/build/lib.linux-x86_64-2.7/Bio/Sequencing/Applications/_samtools.py", line 605, in Bio.Sequencing.Applications._samtools.SamtoolsRmdupCommandline
Failed example:
    print(samtools_rmdup_cmd)
Exception raised:
    Traceback (most recent call last):
      File "/opt/python/2.7.9/lib/python2.7/doctest.py", line 1315, in __run
        compileflags, 1) in test.globs
      File "<doctest Bio.Sequencing.Applications._samtools.SamtoolsRmdupCommandline[4]>", line 1, in <module>
        print(samtools_rmdup_cmd)
    NameError: name 'samtools_rmdup_cmd' is not defined
----------------------------------------------------------------------

@morrme

morrme commented Apr 20, 2017

Copy link
Copy Markdown
Contributor Author

@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?

@peterjc

peterjc commented Apr 20, 2017

Copy link
Copy Markdown
Member

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 \\ to just \ as needed.

It may be some of these docstrings are deliberately using \t etc in order to get a tab in order to make a doctest work - in which case we may need to tag this with # noqa: D301 as a special case.

@morrme

morrme commented Apr 20, 2017

Copy link
Copy Markdown
Contributor Author

@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:
Bio/Graphics/GenomeDiagram/_Colors.py
Bio/Nexus/Nexus.py (pending explanation of the number sequences)
Bio/SearchIO/FastaIO.py (lines 70-71)
Bio/Sequencing/Applications/_bwa.py (\t on line 239)
Bio/Sequencing/Applications/_samtools.py (for example lines 259-260)
Bio/motifs/applications/_xxmotif.py (line 49)

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 noqa route.

@peterjc

peterjc commented Apr 20, 2017 •

Copy link
Copy Markdown
Member

Looking at https://github.com/biopython/biopython/blob/biopython-169/Bio/Graphics/GenomeDiagram/_Colors.py#L124 it uses \t to mean a tab, and intended that to be visible to the user as \t, so raw mode is fine in principle.

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):

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 transfer

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 transfer

UPDATE: I applied this as 50149e1

@peterjc

peterjc commented Apr 20, 2017 •

Copy link
Copy Markdown
Member

@peterjc

peterjc commented Apr 20, 2017

Copy link
Copy Markdown
Member

@peterjc

peterjc commented Apr 20, 2017

Copy link
Copy Markdown
Member

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,

# TODO - Should the read group have a raw tab in it, or \t?

Here we want the user to see \t in this line:

 >>> read_group = "@RG\tID:foo\tSM:bar"

But later on in the print output there should two actual tabs:

>>> print(sampe_cmd)
bwa sampe /path/to/reference_genome.fasta /path/to/read_1.sai /path/to/read_2.sai /path/to/read_1.fq /path/to/read_2.fq -r @RG       ID:foo  SM:bar

Strangely they seem to be spaces right now, as checked with:

$ head -n 250 Bio/Sequencing/Applications/_bwa.py | tail | hexdump -C

@morrme

morrme commented Apr 20, 2017 •

Copy link
Copy Markdown
Contributor Author

@peterjc OK so it sounds like the majority of those files can remain as is (with the current changes from this PR). 😌

I made the change to Colors.py and as for _bwa, does this apply in this case?

@peterjc

peterjc commented Apr 20, 2017

Copy link
Copy Markdown
Member

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?

@peterjc

peterjc commented Apr 20, 2017

Copy link
Copy Markdown
Member

Try experimenting with the BWA example and see if you can get both pydocstyle D301 and the doctest happy, and finally check the RST rendering looks nice.

@morrme

morrme commented Apr 20, 2017

Copy link
Copy Markdown
Contributor Author

@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 ?

https://github.com/peterjc/biopython/blob/pre_commit_linting/Scripts/git_pre_commit_hook.py

@peterjc

peterjc commented Apr 20, 2017

Copy link
Copy Markdown
Member

@morrme

morrme commented Apr 20, 2017

Copy link
Copy Markdown
Contributor Author

@peterjc will do. It's a great idea! I sent a tiny PR to your version of the script. 😄

@peterjc

peterjc commented Apr 26, 2017

Copy link
Copy Markdown
Member

How about we focus just on the easy cases for now, and save the troublesome ones for another day (the doctests and NEXUS one)?

@peterjc

peterjc commented May 5, 2017

Copy link
Copy Markdown
Member

Current D301 status,

$ pydocstyle Bio/ --select D301
Bio/Application/__init__.py:97 in public class `AbstractCommandline`:
        D301: Use r""" if any backslashes in a docstring
Bio/NeuralNetwork/Gene/Schema.py:1 at module level:
        D301: Use r""" if any backslashes in a docstring
Bio/Nexus/Nexus.py:301 in private function `_compact4nexus`:
        D301: Use r""" if any backslashes in a docstring
Bio/Nexus/Nexus.py:415 in private function `_kill_comments_and_break_lines`:
        D301: Use r""" if any backslashes in a docstring
Bio/Nexus/Nexus.py:1175 in private method `_get_indices`:
        D301: Use r""" if any backslashes in a docstring
Bio/Nexus/Nexus.py:1212 in private method `_parse_list`:
        D301: Use r""" if any backslashes in a docstring
Bio/NMR/xpktools.py:114 in public method `residue_dict`:
        D301: Use r""" if any backslashes in a docstring
Bio/Phylo/Applications/_Fasttree.py:26 in public class `FastTreeCommandline`:
        D301: Use r""" if any backslashes in a docstring
Bio/SearchIO/FastaIO.py:1 at module level:
        D301: Use r""" if any backslashes in a docstring
Bio/Sequencing/Applications/_bwa.py:64 in public class `BwaAlignCommandline`:
        D301: Use r""" if any backslashes in a docstring
Bio/Sequencing/Applications/_bwa.py:220 in public class `BwaSampeCommandline`:
        D301: Use r""" if any backslashes in a docstring
Bio/Sequencing/Applications/_samtools.py:244 in public class `SamtoolsReheaderCommandline`:
        D301: Use r""" if any backslashes in a docstring
Bio/Sequencing/Applications/_samtools.py:409 in public class `SamtoolsMergeCommandline`:
        D301: Use r""" if any backslashes in a docstring
Bio/Sequencing/Applications/_samtools.py:551 in public class `SamtoolsFixmateCommandline`:
        D301: Use r""" if any backslashes in a docstring
Bio/Sequencing/Applications/_samtools.py:588 in public class `SamtoolsRmdupCommandline`:
        D301: Use r""" if any backslashes in a docstring
Bio/Sequencing/Applications/_samtools.py:631 in public class `SamtoolsCalmdCommandline`:
        D301: Use r""" if any backslashes in a docstring

Do you mind if I close this pull request and we come back to D301 later?

@morrme

morrme commented May 7, 2017

Copy link
Copy Markdown
Contributor Author

@peterjc That's fine.

@peterjc

peterjc commented Nov 24, 2017

Copy link
Copy Markdown
Member

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants