2323_WritablePathT = TypeVar ("_WritablePathT" , bound = "_WritablePath" )
2424
2525
26- def _explode_path (path : str , parser : "_PathParser" ) -> tuple [str , list [str ]]:
27- """
28- Split the path into a 2-tuple (anchor, parts), where *anchor* is the
29- uppermost parent of the path (equivalent to path.parents[-1]), and
30- *parts* is a reversed list of parts following the anchor.
31- """
32- split = parser .split
33- parent , name = split (path )
34- names = []
35- while path != parent :
36- names .append (name )
37- path = parent
38- parent , name = split (path )
39- return path , names
40-
41-
4226@runtime_checkable
4327class _PathParser (Protocol ):
4428 """Protocol for path parsers, which do low-level path manipulation.
@@ -55,6 +39,22 @@ def splitext(self, path: str) -> tuple[str, str]: ...
5539 def normcase (self , path : str ) -> str : ...
5640
5741
42+ def _explode_path (path : str , parser : _PathParser ) -> tuple [str , list [str ]]:
43+ """
44+ Split the path into a 2-tuple (anchor, parts), where *anchor* is the
45+ uppermost parent of the path (equivalent to path.parents[-1]), and
46+ *parts* is a reversed list of parts following the anchor.
47+ """
48+ split = parser .split
49+ parent , name = split (path )
50+ names = []
51+ while path != parent :
52+ names .append (name )
53+ path = parent
54+ parent , name = split (path )
55+ return path , names
56+
57+
5858@runtime_checkable
5959class PathInfo (Protocol ):
6060 """Protocol for path info objects, which support querying the file type.
0 commit comments