MCPcopy
hub / github.com/cool-RR/PySnooper / splitroot

Method splitroot

tests/mini_toolbox/pathlib.py:435–449  ·  view source on GitHub ↗
(self, part, sep=sep)

Source from the content-addressed store, hash-verified

433 is_supported = (os.name != 'nt')
434
435 def splitroot(self, part, sep=sep):
436 if part and part[0] == sep:
437 stripped_part = part.lstrip(sep)
438 # According to POSIX path resolution:
439 # http://pubs.opengroup.org/onlinepubs/009695399/basedefs/
440 # xbd_chap04.html#tag_04_11
441 # "A pathname that begins with two successive slashes may be
442 # interpreted in an implementation-defined manner, although more
443 # than two leading slashes shall be treated as a single slash".
444 if len(part) - len(stripped_part) == 2:
445 return '', sep * 2, stripped_part
446 else:
447 return '', sep, stripped_part
448 else:
449 return '', '', part
450
451 def casefold(self, s):
452 return s

Callers 1

parse_partsMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected