Method: pylint.extensions.empty_comment.comment_part_of_string
Calls: 7, Exceptions: 0, Paths: 2Back
Path 1: 4 calls (0.57)
bytes (4)
5 (1) 12 (1) 16 (1) 10 (1)
True (4)
1def comment_part_of_string(line: bytes, comment_idx: int) -> bool:
2 """Checks if the symbol at comment_idx is part of a string."""
3
4 if (
5 line[:comment_idx].count(b"'") % 2 == 1
6 and line[comment_idx:].count(b"'") % 2 == 1
7 ) or (
8 line[:comment_idx].count(b'"') % 2 == 1
9 and line[comment_idx:].count(b'"') % 2 == 1
10 ):
11 return True
12 return False
Path 2: 3 calls (0.43)
bytes (3)
16 (1) 17 (1) 0 (1)
False (3)
1def comment_part_of_string(line: bytes, comment_idx: int) -> bool:
2 """Checks if the symbol at comment_idx is part of a string."""
3
4 if (
5 line[:comment_idx].count(b"'") % 2 == 1
6 and line[comment_idx:].count(b"'") % 2 == 1
7 ) or (
8 line[:comment_idx].count(b'"') % 2 == 1
9 and line[comment_idx:].count(b'"') % 2 == 1
10 ):
11 return True
12 return False