Method: pylint.checkers.refactoring.refactoring_checker.RefactoringChecker.process_tokens
Calls: 1121, Exceptions: 0, Paths: 3Back
Path 1: 1086 calls (0.97)
list (1086)
1def process_tokens(self, tokens: list[tokenize.TokenInfo]) -> None:
2 # Process tokens and look for 'if' or 'elif'
3 for index, token in enumerate(tokens):
4 token_string = token[1]
5 if token_string == "elif":
6 # AST exists by the time process_tokens is called, so
7 # it's safe to assume tokens[index+1] exists.
8 # tokens[index+1][2] is the elif's position as
9 # reported by CPython and PyPy,
10 # token[2] is the actual position and also is
11 # reported by IronPython.
12 self._elifs.extend([token[2], tokens[index + 1][2]])
13 elif _is_trailing_comma(tokens, index):
14 if self.linter.is_message_enabled("trailing-comma-tuple"):
15 self.add_message("trailing-comma-tuple", line=token.start[0])
Path 2: 34 calls (0.03)
list (34)
1def process_tokens(self, tokens: list[tokenize.TokenInfo]) -> None:
2 # Process tokens and look for 'if' or 'elif'
3 for index, token in enumerate(tokens):
4 token_string = token[1]
5 if token_string == "elif":
6 # AST exists by the time process_tokens is called, so
7 # it's safe to assume tokens[index+1] exists.
8 # tokens[index+1][2] is the elif's position as
9 # reported by CPython and PyPy,
10 # token[2] is the actual position and also is
11 # reported by IronPython.
12 self._elifs.extend([token[2], tokens[index + 1][2]])
13 elif _is_trailing_comma(tokens, index):
14 if self.linter.is_message_enabled("trailing-comma-tuple"):
15 self.add_message("trailing-comma-tuple", line=token.start[0])
Path 3: 1 calls (0.0)
list (1)
1def process_tokens(self, tokens: list[tokenize.TokenInfo]) -> None:
2 # Process tokens and look for 'if' or 'elif'
3 for index, token in enumerate(tokens):
4 token_string = token[1]
5 if token_string == "elif":
6 # AST exists by the time process_tokens is called, so
7 # it's safe to assume tokens[index+1] exists.
8 # tokens[index+1][2] is the elif's position as
9 # reported by CPython and PyPy,
10 # token[2] is the actual position and also is
11 # reported by IronPython.
12 self._elifs.extend([token[2], tokens[index + 1][2]])
13 elif _is_trailing_comma(tokens, index):
14 if self.linter.is_message_enabled("trailing-comma-tuple"):
15 self.add_message("trailing-comma-tuple", line=token.start[0])