File tree Expand file tree Collapse file tree 4 files changed +41
-2
lines changed
Expand file tree Collapse file tree 4 files changed +41
-2
lines changed Original file line number Diff line number Diff line change 22omit =
33 # leading `*/` for pytest-dev/pytest-cov#456
44 */.tox/*
5+ zipp/compat/py313.py
56disable_warnings =
67 couldnt-parse
78
Original file line number Diff line number Diff line change 1+ Add a compatibility shim for Python 3.13 and earlier.
Original file line number Diff line number Diff line change 1+ import functools
2+ import sys
3+
4+
5+ # from jaraco.functools 4.1
6+ def identity (x ):
7+ return x
8+
9+
10+ # from jaraco.functools 4.1
11+ def 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
19+ def 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+
26+ def 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+
34+ legacy_end_marker = apply (replace ) if sys .version_info < (3 , 14 ) else identity
Original file line number Diff line number Diff line change 11import os
22import re
33
4+ from .compat .py313 import legacy_end_marker
5+
46_default_seps = os .sep + str (os .altsep ) * bool (os .altsep )
57
68
@@ -29,16 +31,17 @@ def translate(self, pattern):
2931 """
3032 return self .extend (self .match_dirs (self .translate_core (pattern )))
3133
34+ @legacy_end_marker
3235 def extend (self , pattern ):
3336 r"""
3437 Extend regex for pattern-wide concerns.
3538
3639 Apply '(?s:)' to create a non-matching group that
3740 matches newlines (valid on Unix).
3841
39- Append '\Z ' to imply fullmatch even when match is used.
42+ Append '\z ' to imply fullmatch even when match is used.
4043 """
41- return rf'(?s:{ pattern } )\Z '
44+ return rf'(?s:{ pattern } )\z '
4245
4346 def match_dirs (self , pattern ):
4447 """
You can’t perform that action at this time.
0 commit comments