File tree Expand file tree Collapse file tree 2 files changed +21
-18
lines changed Expand file tree Collapse file tree 2 files changed +21
-18
lines changed Original file line number Diff line number Diff line change @@ -108,19 +108,3 @@ def wrap_spec(package):
108
108
else :
109
109
# PathLike is only subscriptable at runtime in 3.9+
110
110
StrPath = Union [str , "os.PathLike[str]" ]
111
-
112
-
113
- def ensure_traversable (path ):
114
- """
115
- Convert deprecated string arguments to traversables (pathlib.Path).
116
- """
117
- if not isinstance (path , str ):
118
- return path
119
-
120
- warnings .warn (
121
- "String arguments are deprecated. Pass a Traversable instead." ,
122
- DeprecationWarning ,
123
- stacklevel = 3 ,
124
- )
125
-
126
- return pathlib .Path (path )
Original file line number Diff line number Diff line change 4
4
import pathlib
5
5
import operator
6
6
import re
7
+ import warnings
7
8
8
9
from . import abc
9
10
10
11
from ._itertools import only
11
- from ._compat import ZipPath , ensure_traversable
12
+ from ._compat import ZipPath
12
13
13
14
14
15
def remove_duplicates (items ):
@@ -64,7 +65,7 @@ class MultiplexedPath(abc.Traversable):
64
65
"""
65
66
66
67
def __init__ (self , * paths ):
67
- self ._paths = list (map (ensure_traversable , remove_duplicates (paths )))
68
+ self ._paths = list (map (_ensure_traversable , remove_duplicates (paths )))
68
69
if not self ._paths :
69
70
message = 'MultiplexedPath must contain at least one path'
70
71
raise FileNotFoundError (message )
@@ -170,3 +171,21 @@ def resource_path(self, resource):
170
171
171
172
def files (self ):
172
173
return self .path
174
+
175
+
176
+ def _ensure_traversable (path ):
177
+ """
178
+ Convert deprecated string arguments to traversables (pathlib.Path).
179
+
180
+ Remove with Python 3.15.
181
+ """
182
+ if not isinstance (path , str ):
183
+ return path
184
+
185
+ warnings .warn (
186
+ "String arguments are deprecated. Pass a Traversable instead." ,
187
+ DeprecationWarning ,
188
+ stacklevel = 3 ,
189
+ )
190
+
191
+ return pathlib .Path (path )
You can’t perform that action at this time.
0 commit comments