@@ -298,13 +298,13 @@ def _get_break_loop_node(break_node):
298
298
299
299
def _loop_exits_early (loop ):
300
300
"""
301
- Returns true if a loop may ends up in a break statement.
301
+ Returns true if a loop may end with a break statement.
302
302
303
303
Args:
304
304
loop (astroid.For, astroid.While): the loop node inspected.
305
305
306
306
Returns:
307
- bool: True if the loop may ends up in a break statement, False otherwise.
307
+ bool: True if the loop may end with a break statement, False otherwise.
308
308
"""
309
309
loop_nodes = (nodes .For , nodes .While )
310
310
definition_nodes = (nodes .FunctionDef , nodes .ClassDef )
@@ -349,7 +349,7 @@ def _get_properties(config):
349
349
350
350
351
351
def _determine_function_name_type (node : nodes .FunctionDef , config = None ):
352
- """Determine the name type whose regex the a function's name should match.
352
+ """Determine the name type whose regex the function's name should match.
353
353
354
354
:param node: A function node.
355
355
:param config: Configuration from which to pull additional property classes.
@@ -747,7 +747,7 @@ def visit_while(self, node: nodes.While) -> None:
747
747
748
748
@utils .check_messages ("nonexistent-operator" )
749
749
def visit_unaryop (self , node : nodes .UnaryOp ) -> None :
750
- """check use of the non-existent ++ and -- operator operator """
750
+ """Check use of the non-existent ++ and -- operators """
751
751
if (
752
752
(node .op in "+-" )
753
753
and isinstance (node .operand , nodes .UnaryOp )
@@ -1244,7 +1244,7 @@ def _has_variadic_argument(args, variadic_name):
1244
1244
1245
1245
@utils .check_messages ("unnecessary-lambda" )
1246
1246
def visit_lambda (self , node : nodes .Lambda ) -> None :
1247
- """check whether or not the lambda is suspicious"""
1247
+ """Check whether the lambda is suspicious"""
1248
1248
# if the body of the lambda is a call expression with the same
1249
1249
# argument list as the lambda itself, then the lambda is
1250
1250
# possibly unnecessary and at least suspicious.
@@ -1357,9 +1357,9 @@ def is_iterable(internal_node):
1357
1357
1358
1358
@utils .check_messages ("unreachable" , "lost-exception" )
1359
1359
def visit_return (self , node : nodes .Return ) -> None :
1360
- """1 - check is the node has a right sibling (if so, that's some
1360
+ """1 - check if the node has a right sibling (if so, that's some
1361
1361
unreachable code)
1362
- 2 - check is the node is inside the finally clause of a try...finally
1362
+ 2 - check if the node is inside the ' finally' clause of a ' try...finally'
1363
1363
block
1364
1364
"""
1365
1365
self ._check_unreachable (node )
@@ -1375,9 +1375,9 @@ def visit_continue(self, node: nodes.Continue) -> None:
1375
1375
1376
1376
@utils .check_messages ("unreachable" , "lost-exception" )
1377
1377
def visit_break (self , node : nodes .Break ) -> None :
1378
- """1 - check is the node has a right sibling (if so, that's some
1378
+ """1 - check if the node has a right sibling (if so, that's some
1379
1379
unreachable code)
1380
- 2 - check is the node is inside the finally clause of a try...finally
1380
+ 2 - check if the node is inside the ' finally' clause of a ' try...finally'
1381
1381
block
1382
1382
"""
1383
1383
# 1 - Is it right sibling ?
@@ -1490,14 +1490,14 @@ def _check_unreachable(self, node):
1490
1490
self .add_message ("unreachable" , node = unreach_stmt )
1491
1491
1492
1492
def _check_not_in_finally (self , node , node_name , breaker_classes = ()):
1493
- """check that a node is not inside a finally clause of a
1494
- try...finally statement.
1495
- If we found before a try...finally block a parent which its type is
1496
- in breaker_classes, we skip the whole check."""
1493
+ """check that a node is not inside a ' finally' clause of a
1494
+ ' try...finally' statement.
1495
+ If we find a parent which type is in breaker_classes before
1496
+ a 'try...finally' block we skip the whole check."""
1497
1497
# if self._tryfinallys is empty, we're not an in try...finally block
1498
1498
if not self ._tryfinallys :
1499
1499
return
1500
- # the node could be a grand-grand...-children of the try...finally
1500
+ # the node could be a grand-grand...-child of the ' try...finally'
1501
1501
_parent = node .parent
1502
1502
_node = node
1503
1503
while _parent and not isinstance (_parent , breaker_classes ):
@@ -1612,9 +1612,9 @@ def _check_self_assigning_variable(self, node):
1612
1612
continue
1613
1613
if not isinstance (target , nodes .AssignName ):
1614
1614
continue
1615
+ # Check that the scope is different from a class level, which is usually
1616
+ # a pattern to expose module level attributes as class level ones.
1615
1617
if isinstance (scope , nodes .ClassDef ) and target .name in scope_locals :
1616
- # Check that the scope is different than a class level, which is usually
1617
- # a pattern to expose module level attributes as class level ones.
1618
1618
continue
1619
1619
if target .name == lhs_name .name :
1620
1620
self .add_message (
@@ -2218,7 +2218,7 @@ def _check_docstring(
2218
2218
report_missing = True ,
2219
2219
confidence = interfaces .HIGH ,
2220
2220
):
2221
- """check the node has a non empty docstring"""
2221
+ """Check if the node has a non- empty docstring"""
2222
2222
docstring = node .doc
2223
2223
if docstring is None :
2224
2224
docstring = _infer_dunder_doc_attribute (node )
@@ -2229,7 +2229,7 @@ def _check_docstring(
2229
2229
lines = utils .get_node_last_lineno (node ) - node .lineno
2230
2230
2231
2231
if node_type == "module" and not lines :
2232
- # If the module has no body, there's no reason
2232
+ # If the module does not have a body, there's no reason
2233
2233
# to require a docstring.
2234
2234
return
2235
2235
max_lines = self .config .docstring_min_length
@@ -2469,7 +2469,7 @@ def _check_literal_comparison(self, literal, node: nodes.Compare):
2469
2469
is_const = False
2470
2470
if isinstance (literal , nodes .Const ):
2471
2471
if isinstance (literal .value , bool ) or literal .value is None :
2472
- # Not interested in this values.
2472
+ # Not interested in these values.
2473
2473
return
2474
2474
is_const = isinstance (literal .value , (bytes , str , int , float ))
2475
2475
0 commit comments