Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas authored Dec 31, 2021
1 parent a675d16 commit 4060436
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
10 changes: 6 additions & 4 deletions pylint/checkers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE

"""some functions that may be useful for various checkers."""
"""Some functions that may be useful for various checkers."""
import builtins
import itertools
import numbers
Expand Down Expand Up @@ -314,7 +314,7 @@ def get_all_elements(


def is_super(node: nodes.NodeNG) -> bool:
"""return True if the node is referencing the "super" builtin function."""
"""Return True if the node is referencing the "super" builtin function."""
if getattr(node, "name", None) == "super" and node.root().name == "builtins":
return True
return False
Expand Down Expand Up @@ -507,10 +507,12 @@ def __init__(self, index):
def parse_format_string(
format_string: str,
) -> Tuple[Set[str], int, Dict[str, str], List[str]]:
"""Parses a format string, returning a tuple of (keys, num_args), where 'keys' is
"""Parses a format string, returning a tuple of (keys, num_args).
Where 'keys' is
the set of mapping keys in the format string, and 'num_args' is the number of
arguments required by the format string.
Raises IncompleteFormatString or UnsupportedFormatCharacter if a parse error occurs.
"""
keys = set()
Expand Down
11 changes: 5 additions & 6 deletions pylint/checkers/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def in_for_else_branch(parent, stmt):

@lru_cache(maxsize=1000)
def overridden_method(klass, name):
"""get overridden method if any."""
"""Get overridden method if any."""
try:
parent = next(klass.local_attr_ancestors(name))
except (StopIteration, KeyError):
Expand Down Expand Up @@ -578,8 +578,9 @@ def consumed(self):

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

0 comments on commit 4060436

Please sign in to comment.