Skip to content

Commit 67d18fc

Browse files
Better capitalization in docstring, fixed number of char per line
1 parent 0f18209 commit 67d18fc

File tree

492 files changed

+2217
-2393
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

492 files changed

+2217
-2393
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repos:
2121
- --remove-duplicate-keys
2222
- --remove-unused-variables
2323
- repo: https://github.com/asottile/pyupgrade
24-
rev: v2.29.1
24+
rev: v2.30.1
2525
hooks:
2626
- id: pyupgrade
2727
args: [--py36-plus]

doc/exts/pylint_extensions.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
33
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
44

5-
"""Script used to generate the extensions file before building the actual documentation."""
5+
"""Script used to generate the extensions file before building the actual
6+
documentation.
7+
"""
68

79
import os
810
import re
@@ -23,7 +25,7 @@
2325

2426

2527
def builder_inited(app):
26-
"""Output full documentation in ReST format for all extension modules"""
28+
"""Output full documentation in ReST format for all extension modules."""
2729
# PACKAGE/docs/exts/pylint_extensions.py --> PACKAGE/
2830
base_path = os.path.dirname(
2931
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

doc/exts/pylint_features.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
33
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
44

5-
"""Script used to generate the features file before building the actual documentation."""
5+
"""Script used to generate the features file before building the actual
6+
documentation.
7+
"""
68

79
import os
810

doc/user_guide/message-control.rst

+8-8
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Here's an example with all these rules in a single place:
112112
pass
113113

114114
def meth1(self, arg):
115-
"""this issues a message"""
115+
"""This issues a message"""
116116
print(self)
117117

118118
def meth2(self, arg):
@@ -122,14 +122,14 @@ Here's an example with all these rules in a single place:
122122
+ "foo")
123123

124124
def meth3(self):
125-
"""test one line disabling"""
125+
"""Test one line disabling"""
126126
# no error
127127
print(self.bla) # pylint: disable=no-member
128128
# error
129129
print(self.blop)
130130

131131
def meth4(self):
132-
"""test re-enabling"""
132+
"""Test re-enabling"""
133133
# pylint: disable=no-member
134134
# no error
135135
print(self.bla)
@@ -139,7 +139,7 @@ Here's an example with all these rules in a single place:
139139
print(self.blip)
140140

141141
def meth5(self):
142-
"""test IF sub-block re-enabling"""
142+
"""Test IF sub-block re-enabling"""
143143
# pylint: disable=no-member
144144
# no error
145145
print(self.bla)
@@ -154,7 +154,7 @@ Here's an example with all these rules in a single place:
154154
print(self.blip)
155155

156156
def meth6(self):
157-
"""test TRY/EXCEPT sub-block re-enabling"""
157+
"""Test TRY/EXCEPT sub-block re-enabling"""
158158
# pylint: disable=no-member
159159
# no error
160160
print(self.bla)
@@ -169,7 +169,7 @@ Here's an example with all these rules in a single place:
169169
print(self.blip)
170170

171171
def meth7(self):
172-
"""test one line block opening disabling"""
172+
"""Test one line block opening disabling"""
173173
if self.blop: # pylint: disable=no-member
174174
# error
175175
print(self.blip)
@@ -180,7 +180,7 @@ Here's an example with all these rules in a single place:
180180
print(self.blip)
181181

182182
def meth8(self):
183-
"""test late disabling"""
183+
"""Test late disabling"""
184184
# error
185185
print(self.blip)
186186
# pylint: disable=no-member
@@ -189,7 +189,7 @@ Here's an example with all these rules in a single place:
189189
print(self.blop)
190190

191191
def meth9(self):
192-
"""test next line disabling"""
192+
"""Test next line disabling"""
193193
# no error
194194
# pylint: disable-next=no-member
195195
print(self.bla)

examples/deprecation_checker.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
"""Example checker detecting deprecated functions/methods. Following example searches for usages of
2-
deprecated function `deprecated_function` and deprecated method `MyClass.deprecated_method`
3-
from module mymodule:
1+
"""Example checker detecting deprecated functions/methods. Following example searches
2+
for usages of deprecated function `deprecated_function` and deprecated method
3+
`MyClass.deprecated_method` from module mymodule:
44
55
.. code-block:: console
66
$ cat mymodule.py
@@ -59,7 +59,8 @@ class DeprecationChecker(DeprecatedMixin, BaseChecker):
5959
name = "deprecated"
6060

6161
def deprecated_methods(self) -> Set[str]:
62-
"""Callback method called by DeprecatedMixin for every method/function found in the code.
62+
"""Callback method called by DeprecatedMixin for every method/function found in
63+
the code.
6364
6465
Returns:
6566
collections.abc.Container of deprecated function/method names.

pylint/__init__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020

2121
def run_pylint(argv: Optional[Sequence[str]] = None):
22-
"""Run pylint
22+
"""Run pylint.
2323
2424
argv can be a sequence of strings normally supplied as arguments on the command line
2525
"""
@@ -32,7 +32,7 @@ def run_pylint(argv: Optional[Sequence[str]] = None):
3232

3333

3434
def run_epylint(argv: Optional[Sequence[str]] = None):
35-
"""Run epylint
35+
"""Run epylint.
3636
3737
argv can be a list of strings normally supplied as arguments on the command line
3838
"""
@@ -42,7 +42,7 @@ def run_epylint(argv: Optional[Sequence[str]] = None):
4242

4343

4444
def run_pyreverse(argv: Optional[Sequence[str]] = None):
45-
"""Run pyreverse
45+
"""Run pyreverse.
4646
4747
argv can be a sequence of strings normally supplied as arguments on the command line
4848
"""
@@ -52,7 +52,7 @@ def run_pyreverse(argv: Optional[Sequence[str]] = None):
5252

5353

5454
def run_symilar(argv: Optional[Sequence[str]] = None):
55-
"""Run symilar
55+
"""Run symilar.
5656
5757
argv can be a sequence of strings normally supplied as arguments on the command line
5858
"""

pylint/__pkginfo__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
def get_numversion_from_version(v: str) -> Tuple:
9-
"""Kept for compatibility reason
9+
"""Kept for compatibility reason.
1010
1111
See https://github.com/PyCQA/pylint/issues/4399
1212
https://github.com/PyCQA/pylint/issues/4420,

pylint/checkers/classes/special_methods_checker.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
33

4-
"""Special methods checker and helper function's module"""
4+
"""Special methods checker and helper function's module."""
55

66
import astroid
77
from astroid import nodes
@@ -23,8 +23,8 @@
2323
def _safe_infer_call_result(node, caller, context=None):
2424
"""Safely infer the return value of a function.
2525
26-
Returns None if inference failed or if there is some ambiguity (more than
27-
one node has been inferred). Otherwise, returns inferred value.
26+
Returns None if inference failed or if there is some ambiguity (more than one node
27+
has been inferred). Otherwise, returns inferred value.
2828
"""
2929
try:
3030
inferit = node.infer_call_result(caller, context=context)
@@ -43,9 +43,7 @@ def _safe_infer_call_result(node, caller, context=None):
4343

4444

4545
class SpecialMethodsChecker(BaseChecker):
46-
"""Checker which verifies that special methods
47-
are implemented correctly.
48-
"""
46+
"""Checker which verifies that special methods are implemented correctly."""
4947

5048
__implements__ = (IAstroidChecker,)
5149
name = "classes"

pylint/checkers/ellipsis_checker.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Ellipsis checker for Python code"""
1+
"""Ellipsis checker for Python code."""
22
from typing import TYPE_CHECKING
33

44
from astroid import nodes
@@ -27,12 +27,13 @@ class EllipsisChecker(BaseChecker):
2727

2828
@check_messages("unnecessary-ellipsis")
2929
def visit_const(self, node: nodes.Const) -> None:
30-
"""Check if the ellipsis constant is used unnecessarily.
31-
Emit a warning when:
32-
- A line consisting of an ellipsis is preceded by a docstring.
33-
- A statement exists in the same scope as the ellipsis.
34-
For example: A function consisting of an ellipsis followed by a
35-
return statement on the next line.
30+
"""Check if the ellipsis constant is used unnecessarily. Emit a warning
31+
when:
32+
33+
- A line consisting of an ellipsis is preceded by a docstring.
34+
- A statement exists in the same scope as the ellipsis.
35+
For example: A function consisting of an ellipsis followed by a
36+
return statement on the next line.
3637
"""
3738
if (
3839
node.pytype() == "builtins.Ellipsis"

pylint/checkers/mapreduce_checker.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88

99

1010
class MapReduceMixin(metaclass=abc.ABCMeta):
11-
"""A mixin design to allow multiprocess/threaded runs of a Checker"""
11+
"""A mixin design to allow multiprocess/threaded runs of a Checker."""
1212

1313
@abc.abstractmethod
1414
def get_map_data(self):
15-
"""Returns mergeable/reducible data that will be examined"""
15+
"""Returns mergeable/reducible data that will be examined."""
1616

1717
@abc.abstractmethod
1818
def reduce_map_data(self, linter, data):
19-
"""For a given Checker, receives data for all mapped runs"""
19+
"""For a given Checker, receives data for all mapped runs."""

pylint/checkers/refactoring/implicit_booleaness_checker.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,8 @@ def instance_has_bool(class_def: nodes.ClassDef) -> bool:
127127

128128
@utils.check_messages("use-implicit-booleaness-not-len")
129129
def visit_unaryop(self, node: nodes.UnaryOp) -> None:
130-
"""`not len(S)` must become `not S` regardless if the parent block
131-
is a test condition or something else (boolean expression)
132-
e.g. `if not len(S):`
130+
"""`not len(S)` must become `not S` regardless if the parent block is a test
131+
condition or something else (boolean expression) e.g. `if not len(S):`
133132
"""
134133
if (
135134
isinstance(node, nodes.UnaryOp)
@@ -145,7 +144,7 @@ def visit_compare(self, node: nodes.Compare) -> None:
145144
def _check_use_implicit_booleaness_not_comparison(
146145
self, node: nodes.Compare
147146
) -> None:
148-
"""Check for left side and right side of the node for empty literals"""
147+
"""Check for left side and right side of the node for empty literals."""
149148
is_left_empty_literal = utils.is_base_container(
150149
node.left
151150
) or utils.is_empty_dict_literal(node.left)
@@ -210,7 +209,9 @@ def _check_use_implicit_booleaness_not_comparison(
210209

211210
@staticmethod
212211
def base_classes_of_node(instance: nodes.ClassDef) -> List[str]:
213-
"""Return all the classes names that a ClassDef inherit from including 'object'."""
212+
"""Return all the classes names that a ClassDef inherit from including
213+
'object'.
214+
"""
214215
try:
215216
return [instance.name] + [x.name for x in instance.ancestors()]
216217
except TypeError:

pylint/checkers/refactoring/recommendation_checker.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ def _check_consider_iterating_dictionary(self, node: nodes.Call) -> None:
102102
self.add_message("consider-iterating-dictionary", node=node)
103103

104104
def _check_use_maxsplit_arg(self, node: nodes.Call) -> None:
105-
"""Add message when accessing first or last elements of a str.split() or str.rsplit()."""
105+
"""Add message when accessing first or last elements of a str.split() or
106+
str.rsplit().
107+
"""
106108

107109
# Check if call is split() or rsplit()
108110
if not (
@@ -337,7 +339,7 @@ def visit_const(self, node: nodes.Const) -> None:
337339

338340
def _detect_replacable_format_call(self, node: nodes.Const) -> None:
339341
"""Check whether a string is used in a call to format() or '%' and whether it
340-
can be replaced by an f-string
342+
can be replaced by an f-string.
341343
"""
342344
if (
343345
isinstance(node.parent, nodes.Attribute)

0 commit comments

Comments
 (0)