Repository: biopython/biopython

Issue:
CircleCI: D402 First line should not be the function's "signature"
Recent issue on the master branch, most likely due to a flake8 (plugin) version change:

```
$ pre-commit run -a

Check that executables have shebangs.....................................Passed
Check JSON...............................................................Passed
Debug Statements (Python)................................................Passed
Fix End of Files.........................................................Passed
Mixed line ending........................................................Passed
black....................................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

Bio/SeqFeature.py:1676:1: D402 First line should not be the function's "signature"
Bio/SeqFeature.py:1812:1: D402 First line should not be the function's "signature"
Bio/SeqFeature.py:1930:1: D402 First line should not be the function's "signature"
Bio/SeqFeature.py:1995:1: D402 First line should not be the function's "signature"
Bio/SeqFeature.py:2071:1: D402 First line should not be the function's "signature"
Bio/Phylo/BaseTree.py:465:1: D402 First line should not be the function's "signature"
Bio/GenBank/__init__.py:726:1: D402 First line should not be the function's "signature"
Bio/GenBank/__init__.py:1496:1: D402 First line should not be the function's "signature"

blacken-docs.............................................................Passed
rstcheck.................................................................Passed
doc8.....................................................................Passed
Enforce https://doi.org/ style...........................................Passed
```

I think this started while CircleCI was not running promptly, and we merged without it passing.


Discussion:
e.g. https://app.circleci.com/pipelines/github/biopython/biopython/44/workflows/a33e2fbd-e4c0-4706-b7d1-40374352be9f/jobs/44
Probably due to a change in pydocstyle, the timing would suggest v6.0.0?

http://www.pydocstyle.org/en/stable/release_notes.html

I've reproduced this locally via pre-commit, but not (yet) running flake8 directly. Odd.

Resolving patch:
diff --git a/Bio/GenBank/__init__.py b/Bio/GenBank/__init__.py
--- a/Bio/GenBank/__init__.py
+++ b/Bio/GenBank/__init__.py
@@ -722,8 +722,11 @@ def residue_type(self, type):
         """
         self._seq_type = type.strip()
 
-    def topology(self, topology):  # noqa: D402
-        """Validate and record sequence topology (linear or circular as strings)."""
+    def topology(self, topology):
+        """Validate and record sequence topology.
+
+        The topology argument should be "linear" or "circular" (string).
+        """
         if topology:
             if topology not in ["linear", "circular"]:
                 raise ParserFailureError(
@@ -1490,10 +1493,11 @@ def molecule_type(self, mol_type):
 
             self.data.molecule_type = mol_type
 
-    def topology(
-        self, topology
-    ):  # noqa: D402  # flake8 thinks this line is a function signature. It ain't
-        """Validate and record sequence topology (linear or circular as strings)."""
+    def topology(self, topology):
+        """Validate and record sequence topology.
+
+        The topology argument should be "linear" or "circular" (string).
+        """
         if topology:
             if topology not in ["linear", "circular"]:
                 raise ParserFailureError(
diff --git a/Bio/Phylo/BaseTree.py b/Bio/Phylo/BaseTree.py
--- a/Bio/Phylo/BaseTree.py
+++ b/Bio/Phylo/BaseTree.py
@@ -474,7 +474,7 @@ def depths(self, unit_branch_lengths=False):  # noqa: D402
             instances in the tree, and values are the distance from the root to
             each clade (including terminals).
 
-        """
+        """  # noqa: D402
         if unit_branch_lengths:
             depth_of = lambda c: 1  # noqa: E731
         else:
diff --git a/Bio/SeqFeature.py b/Bio/SeqFeature.py
--- a/Bio/SeqFeature.py
+++ b/Bio/SeqFeature.py
@@ -1673,7 +1673,7 @@ def position(self):
 
     @property
     def extension(self):  # noqa: D402
-        """Legacy attribute to get extension (zero) as integer (OBSOLETE)."""
+        """Legacy attribute to get extension (zero) as integer (OBSOLETE)."""  # noqa: D402
         return 0
 
     def _shift(self, offset):
@@ -1809,7 +1809,7 @@ def position(self):
 
     @property
     def extension(self):  # noqa: D402
-        """Legacy attribute to get extension (from left to right) as an integer (OBSOLETE)."""
+        """Legacy attribute to get extension (from left to right) as an integer (OBSOLETE)."""  # noqa: D402
         return self._right - self._left
 
     def _shift(self, offset):
@@ -1927,7 +1927,7 @@ def position(self):
 
     @property
     def extension(self):  # noqa: D402
-        """Legacy attribute to get extension (from left to right) as an integer (OBSOLETE)."""
+        """Legacy attribute to get extension (from left to right) as an integer (OBSOLETE)."""  # noqa: D402
         return self._right - self._left
 
     def _shift(self, offset):
@@ -1992,7 +1992,7 @@ def position(self):
 
     @property
     def extension(self):  # noqa: D402
-        """Legacy attribute to get extension (zero) as integer (OBSOLETE)."""
+        """Legacy attribute to get extension (zero) as integer (OBSOLETE)."""  # noqa: D402
         return 0
 
     def __repr__(self):
@@ -2068,7 +2068,7 @@ def position(self):
 
     @property
     def extension(self):  # noqa: D402
-        """Legacy attribute to get extension (zero) as integer (OBSOLETE)."""
+        """Legacy attribute to get extension (zero) as integer (OBSOLETE)."""  # noqa: D402
         return 0
 
     def __repr__(self):


Test patch: