Method: pylint.checkers.unicode._line_length
Calls: 71, Exceptions: 0, Paths: 4Back
Path 1: 56 calls (0.79)
bytes (56)
'utf-8' (12) 'utf-16le' (10) 'utf-16be' (10) 'utf-32le' (10) 'utf-32be' (10) 'utf-16' (2) 'utf-32' (2)
3 (50) 10 (6)
1def _line_length(line: _StrLike, codec: str) -> int:
2 """Get the length of a string like line as displayed in an editor."""
3 if isinstance(line, bytes):
4 decoded = _remove_bom(line, codec).decode(codec, "replace")
5 else:
6 decoded = line
7
8 stripped = decoded.rstrip("\n")
9
10 if stripped != decoded:
11 stripped = stripped.rstrip("\r")
12
13 return len(stripped)
Path 2: 11 calls (0.15)
bytes (11)
'utf-8' (5) 'utf-16' (2) 'utf-32' (2) 'utf-16le' (1) 'utf-32le' (1)
10 (6) 37 (2) 80 (1) 49 (1) 43 (1)
1def _line_length(line: _StrLike, codec: str) -> int:
2 """Get the length of a string like line as displayed in an editor."""
3 if isinstance(line, bytes):
4 decoded = _remove_bom(line, codec).decode(codec, "replace")
5 else:
6 decoded = line
7
8 stripped = decoded.rstrip("\n")
9
10 if stripped != decoded:
11 stripped = stripped.rstrip("\r")
12
13 return len(stripped)
Path 3: 2 calls (0.03)
'1234567890' (1) '12345678\n\r' (1)
'utf-8' (2)
10 (2)
1def _line_length(line: _StrLike, codec: str) -> int:
2 """Get the length of a string like line as displayed in an editor."""
3 if isinstance(line, bytes):
4 decoded = _remove_bom(line, codec).decode(codec, "replace")
5 else:
6 decoded = line
7
8 stripped = decoded.rstrip("\n")
9
10 if stripped != decoded:
11 stripped = stripped.rstrip("\r")
12
13 return len(stripped)
Path 4: 2 calls (0.03)
'1234567890\n' (1) '1234567890\r\n' (1)
'utf-8' (2)
10 (2)
1def _line_length(line: _StrLike, codec: str) -> int:
2 """Get the length of a string like line as displayed in an editor."""
3 if isinstance(line, bytes):
4 decoded = _remove_bom(line, codec).decode(codec, "replace")
5 else:
6 decoded = line
7
8 stripped = decoded.rstrip("\n")
9
10 if stripped != decoded:
11 stripped = stripped.rstrip("\r")
12
13 return len(stripped)