Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Commit 26230bf

Browse files
committed
Added docs and tidy up
1 parent 0126d4e commit 26230bf

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

docs/release_notes.rst

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@ New Features
1313
classes are considered public if their names are not prepended with an
1414
underscore and if their parent class is public, recursively (#13, #146).
1515

16+
* Added the D403 error code - "First word of the first line should be
17+
properly capitalized". This new error is turned on by default (#164, #165).
1618

1719
Bug Fixes
1820

19-
* Fixed an issue where a `NameError` was raised when parsing complex defintions
20-
of `__all__` (#142, #143).
21+
* Fixed an issue where a ``NameError`` was raised when parsing complex defintions
22+
of ``__all__`` (#142, #143).
23+
24+
* Fixed a bug where D202 was falsely reported when a function with just a
25+
docstring and no content was followed by a comment (#165).
2126

2227

2328
0.7.0 - October 9th, 2015
@@ -26,21 +31,21 @@ Bug Fixes
2631
New Features
2732

2833
* Added the D104 error code - "Missing docstring in public package". This new
29-
error is turned on by default. Missing docstring in `__init__.py` files which
34+
error is turned on by default. Missing docstring in ``__init__.py`` files which
3035
previously resulted in D100 errors ("Missing docstring in public module")
3136
will now result in D104 (#105, #127).
3237

3338
* Added the D105 error code - "Missing docstring in magic method'. This new
3439
error is turned on by default. Missing docstrings in magic method which
3540
previously resulted in D102 error ("Missing docstring in public method")
3641
will now result in D105. Note that exceptions to this rule are variadic
37-
magic methods - specifically `__init__`, `__call__` and `__new__`, which
42+
magic methods - specifically ``__init__``, ``__call__`` and ``__new__``, which
3843
will be considered non-magic and missing docstrings in them will result
3944
in D102 (#60, #139).
4045

4146
* Support the option to exclude all error codes. Running pep257 with
42-
`--select=` (or `select=` in the configuration file) will exclude all errors
43-
which could then be added one by one using `add-select`. Useful for projects
47+
``--select=`` (or ``select=`` in the configuration file) will exclude all errors
48+
which could then be added one by one using ``add-select``. Useful for projects
4449
new to pep257 (#132, #135).
4550

4651
* Added check D211: No blank lines allowed before class docstring. This change

src/pep257.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,10 @@ def source(self):
133133
"""Return the source code for the definition."""
134134
full_src = self._source[self._slice]
135135

136-
def predicate(line):
136+
def is_empty_or_comment(line):
137137
return line.strip() == '' or line.strip().startswith('#')
138138

139-
filtered_src = dropwhile(predicate, reversed(full_src))
139+
filtered_src = dropwhile(is_empty_or_comment, reversed(full_src))
140140
return ''.join(reversed(list(filtered_src)))
141141

142142
def __str__(self):
@@ -689,8 +689,6 @@ def to_rst(cls):
689689
'%r, not %r')
690690
D402 = D4xx.create_error('D402', 'First line should not be the function\'s '
691691
'"signature"')
692-
D402 = D4xx.create_error('D402', 'First line should not be the function\'s '
693-
'"signature"')
694692
D403 = D4xx.create_error('D403', 'First word of the first line should be '
695693
'properly capitalized', '%r, not %r')
696694

0 commit comments

Comments
 (0)