Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Undo some changes to _format_parsed_parts()
  • Loading branch information
barneygale committed Mar 10, 2023
commit cce5d7ba5087120f742b3b213a8165fc9b8108c2
11 changes: 4 additions & 7 deletions Lib/pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,11 @@ def _from_parsed_parts(cls, drv, root, tail):

@classmethod
def _format_parsed_parts(cls, drv, root, tail):
sep = cls._flavour.sep
tail = sep.join(tail)
if drv or root:
return f'{drv}{root}{tail}'
elif cls._flavour.splitdrive(tail)[0]:
return f'.{sep}{tail}'
else:
return tail
return drv + root + cls._flavour.sep.join(tail)
elif tail and cls._flavour.splitdrive(tail[0])[0]:
tail = ['.'] + tail
return cls._flavour.sep.join(tail)

def __str__(self):
"""Return the string representation of the path, suitable for
Expand Down