Method: pylint.checkers.strings.StringConstantChecker.process_string_token
Calls: 5871, Exceptions: 0, Paths: 2Back
Path 1: 5860 calls (1.0)
"''" (99) '"hi"' (65) '""' (57) '"a"' (54) "'1'" (53) "'TEST'" (51) '"http://localhost"' (50) '"""Perfect module with only documentation for configura...
1 (578) 5 (160) 8 (139) 9 (123) 10 (115) 6 (113) 13 (101) 7 (99) 12 (89) 14 (88)
4 (1604) 0 (744) 8 (529) 14 (257) 15 (215) 10 (167) 11 (141) 20 (129) 12 (128) 17 (112)
1def process_string_token(self, token: str, start_row: int, start_col: int) -> None:
2 quote_char = None
3 for _index, char in enumerate(token):
4 if char in "'\"":
5 quote_char = char
6 break
7 if quote_char is None:
8 return
9 # pylint: disable=undefined-loop-variable
10 prefix = token[:_index].lower() # markers like u, b, r.
11 after_prefix = token[_index:]
12 # pylint: enable=undefined-loop-variable
13 # Chop off quotes
14 quote_length = (
15 3 if after_prefix[:3] == after_prefix[-3:] == 3 * quote_char else 1
16 )
17 string_body = after_prefix[quote_length:-quote_length]
18 # No special checks on raw strings at the moment.
19 if "r" not in prefix:
20 self.process_non_raw_string_token(
21 prefix,
22 string_body,
23 start_row,
24 start_col + len(prefix) + quote_length,
25 )
Path 2: 11 calls (0.0)
"r'\\z'" (1) "r'raw'" (1) 'r"""The Sphinx docstring\n In Sphinx docstrings asterisks should be escaped.\n See https://github.com/PyCQA/pylint/is...
8 (3) 19 (1) 16 (1) 221 (1) 240 (1) 259 (1) 277 (1) 25 (1) 1 (1)
4 (4) 21 (1) 18 (1) 8 (1) 14 (1) 24 (1) 33 (1) 0 (1)
1def process_string_token(self, token: str, start_row: int, start_col: int) -> None:
2 quote_char = None
3 for _index, char in enumerate(token):
4 if char in "'\"":
5 quote_char = char
6 break
7 if quote_char is None:
8 return
9 # pylint: disable=undefined-loop-variable
10 prefix = token[:_index].lower() # markers like u, b, r.
11 after_prefix = token[_index:]
12 # pylint: enable=undefined-loop-variable
13 # Chop off quotes
14 quote_length = (
15 3 if after_prefix[:3] == after_prefix[-3:] == 3 * quote_char else 1
16 )
17 string_body = after_prefix[quote_length:-quote_length]
18 # No special checks on raw strings at the moment.
19 if "r" not in prefix:
20 self.process_non_raw_string_token(
21 prefix,
22 string_body,
23 start_row,
24 start_col + len(prefix) + quote_length,
25 )