Skip to content

Commit 4060436

Browse files
Apply suggestions from code review
1 parent a675d16 commit 4060436

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

pylint/checkers/utils.py

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

60-
"""some functions that may be useful for various checkers."""
60+
"""Some functions that may be useful for various checkers."""
6161
import builtins
6262
import itertools
6363
import numbers
@@ -314,7 +314,7 @@ def get_all_elements(
314314

315315

316316
def is_super(node: nodes.NodeNG) -> bool:
317-
"""return True if the node is referencing the "super" builtin function."""
317+
"""Return True if the node is referencing the "super" builtin function."""
318318
if getattr(node, "name", None) == "super" and node.root().name == "builtins":
319319
return True
320320
return False
@@ -507,10 +507,12 @@ def __init__(self, index):
507507
def parse_format_string(
508508
format_string: str,
509509
) -> Tuple[Set[str], int, Dict[str, str], List[str]]:
510-
"""Parses a format string, returning a tuple of (keys, num_args), where 'keys' is
510+
"""Parses a format string, returning a tuple of (keys, num_args).
511+
512+
Where 'keys' is
511513
the set of mapping keys in the format string, and 'num_args' is the number of
512514
arguments required by the format string.
513-
515+
514516
Raises IncompleteFormatString or UnsupportedFormatCharacter if a parse error occurs.
515517
"""
516518
keys = set()

pylint/checkers/variables.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def in_for_else_branch(parent, stmt):
186186

187187
@lru_cache(maxsize=1000)
188188
def overridden_method(klass, name):
189-
"""get overridden method if any."""
189+
"""Get overridden method if any."""
190190
try:
191191
parent = next(klass.local_attr_ancestors(name))
192192
except (StopIteration, KeyError):
@@ -578,8 +578,9 @@ def consumed(self):
578578

579579
@property
580580
def consumed_uncertain(self) -> DefaultDict[str, List[nodes.NodeNG]]:
581-
"""Retrieves nodes filtered out by get_next_to_consume() that may not have
582-
executed, such as statements in except blocks, or statements in try blocks (when
581+
"""Retrieves nodes filtered out by get_next_to_consume()
582+
583+
Those nodes may not have executed, such as statements in except blocks, or statements in try blocks (when
583584
evaluating their corresponding except and finally blocks).
584585
585586
Checkers that want to treat the statements as executed (e.g. for unused-
@@ -1825,9 +1826,7 @@ def _is_first_level_self_reference(
18251826
def _is_never_evaluated(
18261827
defnode: nodes.NamedExpr, defnode_parent: nodes.IfExp
18271828
) -> bool:
1828-
"""Check if a NamedExpr is inside a side of if ...
1829-
1830-
else that never gets evaluated
1829+
"""Check if a NamedExpr is inside of an 'if else' that never gets evaluated
18311830
"""
18321831
inferred_test = utils.safe_infer(defnode_parent.test)
18331832
if isinstance(inferred_test, nodes.Const):

0 commit comments

Comments
 (0)