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

15 statements  

1import functools 

2import sys 

3 

4 

5# from jaraco.functools 4.1 

6def identity(x): 

7 return x 

8 

9 

10# from jaraco.functools 4.1 

11def apply(transform): 

12 def wrap(func): 

13 return functools.wraps(func)(compose(transform, func)) 

14 

15 return wrap 

16 

17 

18# from jaraco.functools 4.1 

19def compose(*funcs): 

20 def compose_two(f1, f2): 

21 return lambda *args, **kwargs: f1(f2(*args, **kwargs)) 

22 

23 return functools.reduce(compose_two, funcs) 

24 

25 

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') 

32 

33 

34legacy_end_marker = apply(replace) if sys.version_info < (3, 14) else identity