MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / join_parsed_parts

Method join_parsed_parts

tools/python-3.11.9-amd64/Lib/pathlib.py:94–109  ·  view source on GitHub ↗

Join the two paths represented by the respective (drive, root, parts) tuples. Return a new (drive, root, parts) tuple.

(self, drv, root, parts, drv2, root2, parts2)

Source from the content-addressed store, hash-verified

92 return drv, root, parsed
93
94 def join_parsed_parts(self, drv, root, parts, drv2, root2, parts2):
95 """
96 Join the two paths represented by the respective
97 (drive, root, parts) tuples. Return a new (drive, root, parts) tuple.
98 """
99 if root2:
100 if not drv2 and drv:
101 return drv, root2, [drv + root2] + parts2[1:]
102 elif drv2:
103 if drv2 == drv or self.casefold(drv2) == self.casefold(drv):
104 # Same drive => second path is relative to the first
105 return drv, root, parts + parts2[1:]
106 else:
107 # Second path is non-anchored (common case)
108 return drv, root, parts + parts2
109 return drv2, root2, parts2
110
111
112class _WindowsFlavour(_Flavour):

Callers 1

_make_childMethod · 0.80

Calls 1

casefoldMethod · 0.45

Tested by

no test coverage detected