Path 1: 38612 calls (0.93)

'\n' (11278) ' pass\n' (655) ' pass\n' (409) ' """\n' (373) '"""\n' (274) ' def __init__(self):\n' (169) 'try:\n' (128) ' try:\n' (...

dict (38612)

'\n' (38607) bytes (5)

1 (38608) 2 (2) 4 (2)

{} (38612)

1def _map_positions_to_result(
2    line: _StrLike,
3    search_dict: dict[_StrLike, _BadChar],
4    new_line: _StrLike,
5    byte_str_length: int = 1,
6) -> dict[int, _BadChar]:
7    """Get all occurrences of search dict keys within line.
8
9    Ignores Windows end of line and can handle bytes as well as string.
10    Also takes care of encodings for which the length of an encoded code point does not
11    default to 8 Bit.
12    """
13
14    result: dict[int, _BadChar] = {}
15
16    for search_for, char in search_dict.items():
17        if search_for not in line:
18            continue
19
20        # Special Handling for Windows '\r\n'
21        if char.unescaped == "\r" and line.endswith(new_line):
22            ignore_pos = len(line) - 2 * byte_str_length
23        else:
24            ignore_pos = None
25
26        start = 0
27        pos = line.find(search_for, start)
28        while pos > 0:
29            if pos != ignore_pos:
30                # Calculate the column
31                col = int(pos / byte_str_length)
32                result[col] = char
33            start = pos + 1
34            pos = line.find(search_for, start)
35
36    return result
            

Path 2: 2318 calls (0.06)

' pass\r\n' (142) ' break\r\n' (53) ' pass\r\n' (37) ' """\r\n' (22) ' while True: # [consider-refactoring-into-wh...

dict (2318)

'\n' (2314) bytes (4)

1 (2316) 2 (1) 4 (1)

{} (2318)

1def _map_positions_to_result(
2    line: _StrLike,
3    search_dict: dict[_StrLike, _BadChar],
4    new_line: _StrLike,
5    byte_str_length: int = 1,
6) -> dict[int, _BadChar]:
7    """Get all occurrences of search dict keys within line.
8
9    Ignores Windows end of line and can handle bytes as well as string.
10    Also takes care of encodings for which the length of an encoded code point does not
11    default to 8 Bit.
12    """
13
14    result: dict[int, _BadChar] = {}
15
16    for search_for, char in search_dict.items():
17        if search_for not in line:
18            continue
19
20        # Special Handling for Windows '\r\n'
21        if char.unescaped == "\r" and line.endswith(new_line):
22            ignore_pos = len(line) - 2 * byte_str_length
23        else:
24            ignore_pos = None
25
26        start = 0
27        pos = line.find(search_for, start)
28        while pos > 0:
29            if pos != ignore_pos:
30                # Calculate the column
31                col = int(pos / byte_str_length)
32                result[col] = char
33            start = pos + 1
34            pos = line.find(search_for, start)
35
36    return result
            

Path 3: 675 calls (0.02)

'\r\n' (675)

dict (675)

'\n' (675)

1 (675)

{} (675)

1def _map_positions_to_result(
2    line: _StrLike,
3    search_dict: dict[_StrLike, _BadChar],
4    new_line: _StrLike,
5    byte_str_length: int = 1,
6) -> dict[int, _BadChar]:
7    """Get all occurrences of search dict keys within line.
8
9    Ignores Windows end of line and can handle bytes as well as string.
10    Also takes care of encodings for which the length of an encoded code point does not
11    default to 8 Bit.
12    """
13
14    result: dict[int, _BadChar] = {}
15
16    for search_for, char in search_dict.items():
17        if search_for not in line:
18            continue
19
20        # Special Handling for Windows '\r\n'
21        if char.unescaped == "\r" and line.endswith(new_line):
22            ignore_pos = len(line) - 2 * byte_str_length
23        else:
24            ignore_pos = None
25
26        start = 0
27        pos = line.find(search_for, start)
28        while pos > 0:
29            if pos != ignore_pos:
30                # Calculate the column
31                col = int(pos / byte_str_length)
32                result[col] = char
33            start = pos + 1
34            pos = line.find(search_for, start)
35
36    return result
            

Path 4: 77 calls (0.0)

bytes (13) '# invalid char backspace: \x08\n' (5) '# Invalid char sub: \x1a\n' (5) '# Invalid char esc: \x1b\n' (5) '# file containing \x00 <-\n' (5) ...

dict (77)

'\n' (64) bytes (13)

1 (71) 2 (3) 4 (3)

dict (77)

1def _map_positions_to_result(
2    line: _StrLike,
3    search_dict: dict[_StrLike, _BadChar],
4    new_line: _StrLike,
5    byte_str_length: int = 1,
6) -> dict[int, _BadChar]:
7    """Get all occurrences of search dict keys within line.
8
9    Ignores Windows end of line and can handle bytes as well as string.
10    Also takes care of encodings for which the length of an encoded code point does not
11    default to 8 Bit.
12    """
13
14    result: dict[int, _BadChar] = {}
15
16    for search_for, char in search_dict.items():
17        if search_for not in line:
18            continue
19
20        # Special Handling for Windows '\r\n'
21        if char.unescaped == "\r" and line.endswith(new_line):
22            ignore_pos = len(line) - 2 * byte_str_length
23        else:
24            ignore_pos = None
25
26        start = 0
27        pos = line.find(search_for, start)
28        while pos > 0:
29            if pos != ignore_pos:
30                # Calculate the column
31                col = int(pos / byte_str_length)
32                result[col] = char
33            start = pos + 1
34            pos = line.find(search_for, start)
35
36    return result
            

Path 5: 33 calls (0.0)

bytes (13) '# invalid char backspace: \x08\r\n' (5) '# Invalid char sub: \x1a\r\n' (5) '# Invalid char esc: \x1b\r\n' (5) 'invalid\x08 back\r\n' (1) '...

dict (33)

'\n' (20) bytes (13)

1 (27) 2 (3) 4 (3)

dict (33)

1def _map_positions_to_result(
2    line: _StrLike,
3    search_dict: dict[_StrLike, _BadChar],
4    new_line: _StrLike,
5    byte_str_length: int = 1,
6) -> dict[int, _BadChar]:
7    """Get all occurrences of search dict keys within line.
8
9    Ignores Windows end of line and can handle bytes as well as string.
10    Also takes care of encodings for which the length of an encoded code point does not
11    default to 8 Bit.
12    """
13
14    result: dict[int, _BadChar] = {}
15
16    for search_for, char in search_dict.items():
17        if search_for not in line:
18            continue
19
20        # Special Handling for Windows '\r\n'
21        if char.unescaped == "\r" and line.endswith(new_line):
22            ignore_pos = len(line) - 2 * byte_str_length
23        else:
24            ignore_pos = None
25
26        start = 0
27        pos = line.find(search_for, start)
28        while pos > 0:
29            if pos != ignore_pos:
30                # Calculate the column
31                col = int(pos / byte_str_length)
32                result[col] = char
33            start = pos + 1
34            pos = line.find(search_for, start)
35
36    return result
            

Path 6: 21 calls (0.0)

bytes (8) '# Bad carriage-return \r # not at the end\n' (5) '# Bad carriage-return \r # not at the end\r\n' (5) '-->\r<---\n' (1) 'invalid\r windows\r...

dict (21)

'\n' (13) bytes (8)

1 (17) 2 (2) 4 (2)

dict (21)

1def _map_positions_to_result(
2    line: _StrLike,
3    search_dict: dict[_StrLike, _BadChar],
4    new_line: _StrLike,
5    byte_str_length: int = 1,
6) -> dict[int, _BadChar]:
7    """Get all occurrences of search dict keys within line.
8
9    Ignores Windows end of line and can handle bytes as well as string.
10    Also takes care of encodings for which the length of an encoded code point does not
11    default to 8 Bit.
12    """
13
14    result: dict[int, _BadChar] = {}
15
16    for search_for, char in search_dict.items():
17        if search_for not in line:
18            continue
19
20        # Special Handling for Windows '\r\n'
21        if char.unescaped == "\r" and line.endswith(new_line):
22            ignore_pos = len(line) - 2 * byte_str_length
23        else:
24            ignore_pos = None
25
26        start = 0
27        pos = line.find(search_for, start)
28        while pos > 0:
29            if pos != ignore_pos:
30                # Calculate the column
31                col = int(pos / byte_str_length)
32                result[col] = char
33            start = pos + 1
34            pos = line.find(search_for, start)
35
36    return result
            

Path 7: 6 calls (0.0)

'\x00p\x00r\x00i\x00n\x00t\x00(\x00"\x00t\x00e\x00s\x00t\x00_\x00u\x00t\x00f\x00_\x001\x006\x00_\x00l\x00e\x00_\x00u\x00t\x00f\x00_\x001\x006\x00.\x00...

dict (6)

'\n' (6)

1 (6)

{} (6)

1def _map_positions_to_result(
2    line: _StrLike,
3    search_dict: dict[_StrLike, _BadChar],
4    new_line: _StrLike,
5    byte_str_length: int = 1,
6) -> dict[int, _BadChar]:
7    """Get all occurrences of search dict keys within line.
8
9    Ignores Windows end of line and can handle bytes as well as string.
10    Also takes care of encodings for which the length of an encoded code point does not
11    default to 8 Bit.
12    """
13
14    result: dict[int, _BadChar] = {}
15
16    for search_for, char in search_dict.items():
17        if search_for not in line:
18            continue
19
20        # Special Handling for Windows '\r\n'
21        if char.unescaped == "\r" and line.endswith(new_line):
22            ignore_pos = len(line) - 2 * byte_str_length
23        else:
24            ignore_pos = None
25
26        start = 0
27        pos = line.find(search_for, start)
28        while pos > 0:
29            if pos != ignore_pos:
30                # Calculate the column
31                col = int(pos / byte_str_length)
32                result[col] = char
33            start = pos + 1
34            pos = line.find(search_for, start)
35
36    return result