Path 1: 12 calls (0.52)

unified_diff def (7) context_diff def (5)

list (12)

list (12)

bytes (12)

bytes (12)

bytes (12)

bytes (12)

3 (12)

bytes (12)

bytes (79)

1def diff_bytes(dfunc, a, b, fromfile=b'', tofile=b'',
2               fromfiledate=b'', tofiledate=b'', n=3, lineterm=b'\n'):
3    r"""
4    Compare `a` and `b`, two sequences of lines represented as bytes rather
5    than str. This is a wrapper for `dfunc`, which is typically either
6    unified_diff() or context_diff(). Inputs are losslessly converted to
7    strings so that `dfunc` only has to worry about strings, and encoded
8    back to bytes on return. This is necessary to compare files with
9    unknown or inconsistent encoding. All other inputs (except `n`) must be
10    bytes rather than str.
11    """
12    def decode(s):
13        try:
14            return s.decode('ascii', 'surrogateescape')
15        except AttributeError as err:
16            msg = ('all arguments must be bytes, not %s (%r)' %
17                   (type(s).__name__, s))
18            raise TypeError(msg) from err
19    a = list(map(decode, a))
20    b = list(map(decode, b))
21    fromfile = decode(fromfile)
22    tofile = decode(tofile)
23    fromfiledate = decode(fromfiledate)
24    tofiledate = decode(tofiledate)
25    lineterm = decode(lineterm)
26
27    lines = dfunc(a, b, fromfile, tofile, fromfiledate, tofiledate, n, lineterm)
28    for line in lines:
29        yield line.encode('ascii', 'surrogateescape')
            

Path 2: 6 calls (0.26)

unified_diff def (3) context_diff def (3)

list (6)

list (6)

bytes (6)

bytes (6)

bytes (6)

bytes (6)

3 (6)

bytes (6)

1def diff_bytes(dfunc, a, b, fromfile=b'', tofile=b'',
2               fromfiledate=b'', tofiledate=b'', n=3, lineterm=b'\n'):
3    r"""
4    Compare `a` and `b`, two sequences of lines represented as bytes rather
5    than str. This is a wrapper for `dfunc`, which is typically either
6    unified_diff() or context_diff(). Inputs are losslessly converted to
7    strings so that `dfunc` only has to worry about strings, and encoded
8    back to bytes on return. This is necessary to compare files with
9    unknown or inconsistent encoding. All other inputs (except `n`) must be
10    bytes rather than str.
11    """
12    def decode(s):
13        try:
14            return s.decode('ascii', 'surrogateescape')
15        except AttributeError as err:
16            msg = ('all arguments must be bytes, not %s (%r)' %
17                   (type(s).__name__, s))
18            raise TypeError(msg) from err
19    a = list(map(decode, a))
20    b = list(map(decode, b))
21    fromfile = decode(fromfile)
22    tofile = decode(tofile)
23    fromfiledate = decode(fromfiledate)
24    tofiledate = decode(tofiledate)
25    lineterm = decode(lineterm)
26
27    lines = dfunc(a, b, fromfile, tofile, fromfiledate, tofiledate, n, lineterm)
28    for line in lines:
29        yield line.encode('ascii', 'surrogateescape')
            

Path 3: 2 calls (0.09)

unified_diff def (1) context_diff def (1)

list (2)

['hello'] (2)

bytes (2)

bytes (2)

bytes (2)

bytes (2)

3 (2)

bytes (2)

TypeError (2)

1def diff_bytes(dfunc, a, b, fromfile=b'', tofile=b'',
2               fromfiledate=b'', tofiledate=b'', n=3, lineterm=b'\n'):
3    r"""
4    Compare `a` and `b`, two sequences of lines represented as bytes rather
5    than str. This is a wrapper for `dfunc`, which is typically either
6    unified_diff() or context_diff(). Inputs are losslessly converted to
7    strings so that `dfunc` only has to worry about strings, and encoded
8    back to bytes on return. This is necessary to compare files with
9    unknown or inconsistent encoding. All other inputs (except `n`) must be
10    bytes rather than str.
11    """
12    def decode(s):
13        try:
14            return s.decode('ascii', 'surrogateescape')
15        except AttributeError as err:
16            msg = ('all arguments must be bytes, not %s (%r)' %
17                   (type(s).__name__, s))
18            raise TypeError(msg) from err
19    a = list(map(decode, a))
20    b = list(map(decode, b))
21    fromfile = decode(fromfile)
22    tofile = decode(tofile)
23    fromfiledate = decode(fromfiledate)
24    tofiledate = decode(tofiledate)
25    lineterm = decode(lineterm)
26
27    lines = dfunc(a, b, fromfile, tofile, fromfiledate, tofiledate, n, lineterm)
28    for line in lines:
29        yield line.encode('ascii', 'surrogateescape')
            

Path 4: 2 calls (0.09)

unified_diff def (1) context_diff def (1)

['hello'] (2)

list (2)

bytes (2)

bytes (2)

bytes (2)

bytes (2)

3 (2)

bytes (2)

TypeError (2)

1def diff_bytes(dfunc, a, b, fromfile=b'', tofile=b'',
2               fromfiledate=b'', tofiledate=b'', n=3, lineterm=b'\n'):
3    r"""
4    Compare `a` and `b`, two sequences of lines represented as bytes rather
5    than str. This is a wrapper for `dfunc`, which is typically either
6    unified_diff() or context_diff(). Inputs are losslessly converted to
7    strings so that `dfunc` only has to worry about strings, and encoded
8    back to bytes on return. This is necessary to compare files with
9    unknown or inconsistent encoding. All other inputs (except `n`) must be
10    bytes rather than str.
11    """
12    def decode(s):
13        try:
14            return s.decode('ascii', 'surrogateescape')
15        except AttributeError as err:
16            msg = ('all arguments must be bytes, not %s (%r)' %
17                   (type(s).__name__, s))
18            raise TypeError(msg) from err
19    a = list(map(decode, a))
20    b = list(map(decode, b))
21    fromfile = decode(fromfile)
22    tofile = decode(tofile)
23    fromfiledate = decode(fromfiledate)
24    tofiledate = decode(tofiledate)
25    lineterm = decode(lineterm)
26
27    lines = dfunc(a, b, fromfile, tofile, fromfiledate, tofiledate, n, lineterm)
28    for line in lines:
29        yield line.encode('ascii', 'surrogateescape')
            

Path 5: 1 calls (0.04)

unified_diff def (1)

list (1)

list (1)

bytes (1)

bytes (1)

'1 fév' (1)

'3 fév' (1)

3 (1)

bytes (1)

TypeError (1)

1def diff_bytes(dfunc, a, b, fromfile=b'', tofile=b'',
2               fromfiledate=b'', tofiledate=b'', n=3, lineterm=b'\n'):
3    r"""
4    Compare `a` and `b`, two sequences of lines represented as bytes rather
5    than str. This is a wrapper for `dfunc`, which is typically either
6    unified_diff() or context_diff(). Inputs are losslessly converted to
7    strings so that `dfunc` only has to worry about strings, and encoded
8    back to bytes on return. This is necessary to compare files with
9    unknown or inconsistent encoding. All other inputs (except `n`) must be
10    bytes rather than str.
11    """
12    def decode(s):
13        try:
14            return s.decode('ascii', 'surrogateescape')
15        except AttributeError as err:
16            msg = ('all arguments must be bytes, not %s (%r)' %
17                   (type(s).__name__, s))
18            raise TypeError(msg) from err
19    a = list(map(decode, a))
20    b = list(map(decode, b))
21    fromfile = decode(fromfile)
22    tofile = decode(tofile)
23    fromfiledate = decode(fromfiledate)
24    tofiledate = decode(tofiledate)
25    lineterm = decode(lineterm)
26
27    lines = dfunc(a, b, fromfile, tofile, fromfiledate, tofiledate, n, lineterm)
28    for line in lines:
29        yield line.encode('ascii', 'surrogateescape')