@@ -298,13 +298,13 @@ def _get_break_loop_node(break_node):
298298
299299def _loop_exits_early (loop ):
300300 """
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.
302302
303303 Args:
304304 loop (astroid.For, astroid.While): the loop node inspected.
305305
306306 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.
308308 """
309309 loop_nodes = (nodes .For , nodes .While )
310310 definition_nodes = (nodes .FunctionDef , nodes .ClassDef )
@@ -349,7 +349,7 @@ def _get_properties(config):
349349
350350
351351def _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.
353353
354354 :param node: A function node.
355355 :param config: Configuration from which to pull additional property classes.
@@ -747,7 +747,7 @@ def visit_while(self, node: nodes.While) -> None:
747747
748748 @utils .check_messages ("nonexistent-operator" )
749749 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 """
751751 if (
752752 (node .op in "+-" )
753753 and isinstance (node .operand , nodes .UnaryOp )
@@ -1244,7 +1244,7 @@ def _has_variadic_argument(args, variadic_name):
12441244
12451245 @utils .check_messages ("unnecessary-lambda" )
12461246 def visit_lambda (self , node : nodes .Lambda ) -> None :
1247- """check whether or not the lambda is suspicious"""
1247+ """Check whether the lambda is suspicious"""
12481248 # if the body of the lambda is a call expression with the same
12491249 # argument list as the lambda itself, then the lambda is
12501250 # possibly unnecessary and at least suspicious.
@@ -1357,9 +1357,9 @@ def is_iterable(internal_node):
13571357
13581358 @utils .check_messages ("unreachable" , "lost-exception" )
13591359 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
13611361 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'
13631363 block
13641364 """
13651365 self ._check_unreachable (node )
@@ -1375,9 +1375,9 @@ def visit_continue(self, node: nodes.Continue) -> None:
13751375
13761376 @utils .check_messages ("unreachable" , "lost-exception" )
13771377 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
13791379 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'
13811381 block
13821382 """
13831383 # 1 - Is it right sibling ?
@@ -1490,14 +1490,14 @@ def _check_unreachable(self, node):
14901490 self .add_message ("unreachable" , node = unreach_stmt )
14911491
14921492 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."""
14971497 # if self._tryfinallys is empty, we're not an in try...finally block
14981498 if not self ._tryfinallys :
14991499 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'
15011501 _parent = node .parent
15021502 _node = node
15031503 while _parent and not isinstance (_parent , breaker_classes ):
@@ -1612,9 +1612,9 @@ def _check_self_assigning_variable(self, node):
16121612 continue
16131613 if not isinstance (target , nodes .AssignName ):
16141614 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.
16151617 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.
16181618 continue
16191619 if target .name == lhs_name .name :
16201620 self .add_message (
@@ -2218,7 +2218,7 @@ def _check_docstring(
22182218 report_missing = True ,
22192219 confidence = interfaces .HIGH ,
22202220 ):
2221- """check the node has a non empty docstring"""
2221+ """Check if the node has a non- empty docstring"""
22222222 docstring = node .doc
22232223 if docstring is None :
22242224 docstring = _infer_dunder_doc_attribute (node )
@@ -2229,7 +2229,7 @@ def _check_docstring(
22292229 lines = utils .get_node_last_lineno (node ) - node .lineno
22302230
22312231 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
22332233 # to require a docstring.
22342234 return
22352235 max_lines = self .config .docstring_min_length
@@ -2469,7 +2469,7 @@ def _check_literal_comparison(self, literal, node: nodes.Compare):
24692469 is_const = False
24702470 if isinstance (literal , nodes .Const ):
24712471 if isinstance (literal .value , bool ) or literal .value is None :
2472- # Not interested in this values.
2472+ # Not interested in these values.
24732473 return
24742474 is_const = isinstance (literal .value , (bytes , str , int , float ))
24752475
0 commit comments