Method: pylint.checkers.non_ascii_names.NonAsciiNameChecker.visit_assignname
Calls: 9183, Exceptions: 0, Paths: 4Back
Path 1: 4562 calls (0.5)
AssignName (4562)
1@utils.only_required_for_messages("non-ascii-name")
2 def visit_assignname(self, node: nodes.AssignName) -> None:
3 """Check module level assigned names."""
4 # The NameChecker from which this Checker originates knows a lot of different
5 # versions of variables, i.e. constants, inline variables etc.
6 # To simplify we use only `variable` here, as we don't need to apply different
7 # rules to different types of variables.
8 frame = node.frame()
9
10 if isinstance(frame, nodes.FunctionDef):
11 if node.parent in frame.body:
12 # Only perform the check if the assignment was done in within the body
13 # of the function (and not the function parameter definition
14 # (will be handled in visit_functiondef)
15 # or within a decorator (handled in visit_call)
16 self._check_name("variable", node.name, node)
17 elif isinstance(frame, nodes.ClassDef):
18 self._check_name("attr", node.name, node)
19 else:
20 # Possibilities here:
21 # - isinstance(node.assign_type(), nodes.Comprehension) == inlinevar
22 # - isinstance(frame, nodes.Module) == variable (constant?)
23 # - some other kind of assignment missed but still most likely a variable
24 self._check_name("variable", node.name, node)
Path 2: 2905 calls (0.32)
AssignName (2905)
1@utils.only_required_for_messages("non-ascii-name")
2 def visit_assignname(self, node: nodes.AssignName) -> None:
3 """Check module level assigned names."""
4 # The NameChecker from which this Checker originates knows a lot of different
5 # versions of variables, i.e. constants, inline variables etc.
6 # To simplify we use only `variable` here, as we don't need to apply different
7 # rules to different types of variables.
8 frame = node.frame()
9
10 if isinstance(frame, nodes.FunctionDef):
11 if node.parent in frame.body:
12 # Only perform the check if the assignment was done in within the body
13 # of the function (and not the function parameter definition
14 # (will be handled in visit_functiondef)
15 # or within a decorator (handled in visit_call)
16 self._check_name("variable", node.name, node)
17 elif isinstance(frame, nodes.ClassDef):
18 self._check_name("attr", node.name, node)
19 else:
20 # Possibilities here:
21 # - isinstance(node.assign_type(), nodes.Comprehension) == inlinevar
22 # - isinstance(frame, nodes.Module) == variable (constant?)
23 # - some other kind of assignment missed but still most likely a variable
24 self._check_name("variable", node.name, node)
Path 3: 1164 calls (0.13)
AssignName (1164)
1@utils.only_required_for_messages("non-ascii-name")
2 def visit_assignname(self, node: nodes.AssignName) -> None:
3 """Check module level assigned names."""
4 # The NameChecker from which this Checker originates knows a lot of different
5 # versions of variables, i.e. constants, inline variables etc.
6 # To simplify we use only `variable` here, as we don't need to apply different
7 # rules to different types of variables.
8 frame = node.frame()
9
10 if isinstance(frame, nodes.FunctionDef):
11 if node.parent in frame.body:
12 # Only perform the check if the assignment was done in within the body
13 # of the function (and not the function parameter definition
14 # (will be handled in visit_functiondef)
15 # or within a decorator (handled in visit_call)
16 self._check_name("variable", node.name, node)
17 elif isinstance(frame, nodes.ClassDef):
18 self._check_name("attr", node.name, node)
19 else:
20 # Possibilities here:
21 # - isinstance(node.assign_type(), nodes.Comprehension) == inlinevar
22 # - isinstance(frame, nodes.Module) == variable (constant?)
23 # - some other kind of assignment missed but still most likely a variable
24 self._check_name("variable", node.name, node)
Path 4: 552 calls (0.06)
AssignName (552)
1@utils.only_required_for_messages("non-ascii-name")
2 def visit_assignname(self, node: nodes.AssignName) -> None:
3 """Check module level assigned names."""
4 # The NameChecker from which this Checker originates knows a lot of different
5 # versions of variables, i.e. constants, inline variables etc.
6 # To simplify we use only `variable` here, as we don't need to apply different
7 # rules to different types of variables.
8 frame = node.frame()
9
10 if isinstance(frame, nodes.FunctionDef):
11 if node.parent in frame.body:
12 # Only perform the check if the assignment was done in within the body
13 # of the function (and not the function parameter definition
14 # (will be handled in visit_functiondef)
15 # or within a decorator (handled in visit_call)
16 self._check_name("variable", node.name, node)
17 elif isinstance(frame, nodes.ClassDef):
18 self._check_name("attr", node.name, node)
19 else:
20 # Possibilities here:
21 # - isinstance(node.assign_type(), nodes.Comprehension) == inlinevar
22 # - isinstance(frame, nodes.Module) == variable (constant?)
23 # - some other kind of assignment missed but still most likely a variable
24 self._check_name("variable", node.name, node)