This repository was archived by the owner on Nov 3, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +33
-9
lines changed
Expand file tree Collapse file tree 3 files changed +33
-9
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,14 @@ Release Notes
44**pydocstyle ** version numbers follow the
55`Semantic Versioning <http://semver.org/ >`_ specification.
66
7+ 5.0.1 - December 9th, 2019
8+ --------------------------
9+
10+ Bug Fixes
11+
12+ * Fixed an issue where AttributeError was raised when parsing the parameter
13+ section of a class docstring (#434, #436).
14+
7155.0.0 - December 9th, 2019
816--------------------------
917
Original file line number Diff line number Diff line change @@ -758,15 +758,16 @@ def _check_missing_args(docstring_args, definition):
758758 D417 with a list of missing arguments.
759759
760760 """
761- function_args = get_function_args (definition .source )
762- # If the method isn't static, then we skip the first
763- # positional argument as it is `cls` or `self`
764- if definition .kind == 'method' and not definition .is_static :
765- function_args = function_args [1 :]
766- missing_args = set (function_args ) - docstring_args
767- if missing_args :
768- yield violations .D417 (", " .join (sorted (missing_args )),
769- definition .name )
761+ if isinstance (definition , Function ):
762+ function_args = get_function_args (definition .source )
763+ # If the method isn't static, then we skip the first
764+ # positional argument as it is `cls` or `self`
765+ if definition .kind == 'method' and not definition .is_static :
766+ function_args = function_args [1 :]
767+ missing_args = set (function_args ) - docstring_args
768+ if missing_args :
769+ yield violations .D417 (", " .join (sorted (missing_args )),
770+ definition .name )
770771
771772
772773 @classmethod
Original file line number Diff line number Diff line change @@ -435,5 +435,20 @@ def bad_google_string(): # noqa: D400
435435 """Test a valid something"""
436436
437437
438+ # This is reproducing a bug where AttributeError is raised when parsing class
439+ # parameters as functions for Google / Numpy conventions.
440+ class Blah : # noqa: D203,D213
441+ """A Blah.
442+
443+ Parameters
444+ ----------
445+ x : int
446+
447+ """
448+
449+ def __init__ (self , x ):
450+ pass
451+
452+
438453expect (os .path .normcase (__file__ if __file__ [- 1 ] != 'c' else __file__ [:- 1 ]),
439454 'D100: Missing docstring in public module' )
You can’t perform that action at this time.
0 commit comments