Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/zipp/compat/py313.py: 87%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1import functools
2import sys
5# from jaraco.functools 4.1
6def identity(x):
7 return x
10# from jaraco.functools 4.1
11def apply(transform):
12 def wrap(func):
13 return functools.wraps(func)(compose(transform, func))
15 return wrap
18# from jaraco.functools 4.1
19def compose(*funcs):
20 def compose_two(f1, f2):
21 return lambda *args, **kwargs: f1(f2(*args, **kwargs))
23 return functools.reduce(compose_two, funcs)
26def replace(pattern):
27 r"""
28 >>> replace(r'foo\z')
29 'foo\\Z'
30 """
31 return pattern[:-2] + pattern[-2:].replace(r'\z', r'\Z')
34legacy_end_marker = apply(replace) if sys.version_info < (3, 14) else identity