MCPcopy Index your code
hub / github.com/python/cpython / _parse_path

Method _parse_path

Lib/pathlib/__init__.py:284–300  ·  view source on GitHub ↗
(cls, path)

Source from the content-addressed store, hash-verified

282
283 @classmethod
284 def _parse_path(cls, path):
285 if not path:
286 return '', '', []
287 sep = cls.parser.sep
288 altsep = cls.parser.altsep
289 if altsep:
290 path = path.replace(altsep, sep)
291 drv, root, rel = cls.parser.splitroot(path)
292 if not root and drv.startswith(sep) and not drv.endswith(sep):
293 drv_parts = drv.split(sep)
294 if len(drv_parts) == 4 and drv_parts[2] not in '?.':
295 # e.g. //server/share
296 root = sep
297 elif len(drv_parts) == 6:
298 # e.g. //?/unc/server/share
299 root = sep
300 return drv, root, [x for x in rel.split(sep) if x and x != '.']
301
302 @classmethod
303 def _parse_pattern(cls, pattern):

Callers 5

driveMethod · 0.95
rootMethod · 0.95
_tailMethod · 0.95
expanduserMethod · 0.80
_check_parse_pathMethod · 0.80

Calls 4

replaceMethod · 0.45
startswithMethod · 0.45
endswithMethod · 0.45
splitMethod · 0.45

Tested by 1

_check_parse_pathMethod · 0.64