Method: pylint.checkers.unicode._byte_to_str_length
Calls: 38, Exceptions: 0, Paths: 3Back
Path 1: 13 calls (0.34)
'utf-8' (11) 'latin1' (1) 'ascii' (1)
1 (13)
1def _byte_to_str_length(codec: str) -> int:
2 """Return how many byte are usually(!) a character point."""
3 if codec.startswith("utf-32"):
4 return 4
5 if codec.startswith("utf-16"):
6 return 2
7
8 return 1
Path 2: 13 calls (0.34)
'utf-32le' (11) 'utf-32' (1) 'utf-32-le' (1)
4 (13)
1def _byte_to_str_length(codec: str) -> int:
2 """Return how many byte are usually(!) a character point."""
3 if codec.startswith("utf-32"):
4 return 4
5 if codec.startswith("utf-16"):
6 return 2
7
8 return 1
Path 3: 12 calls (0.32)
'utf-16le' (11) 'utf-16' (1)
2 (12)
1def _byte_to_str_length(codec: str) -> int:
2 """Return how many byte are usually(!) a character point."""
3 if codec.startswith("utf-32"):
4 return 4
5 if codec.startswith("utf-16"):
6 return 2
7
8 return 1