Skip to content

Commit

Permalink
[path] update Path for Python 3.12
Browse files Browse the repository at this point in the history
`pathlib.Path._parts` has been removed in Python 3.12:
python/cpython#102476

Switch to pathlib.Path.parts which is a tuple.

Closes #1934
  • Loading branch information
anjakefala committed Jul 17, 2023
1 parent 7239e37 commit 06e7f32
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions visidata/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,10 @@ def with_name(self, name):
'Return a sibling Path with *name* as a filename in the same directory.'
if self.is_url():
urlparts = list(urlparse(self.given))
urlparts[2] = '/'.join(Path(urlparts[2])._parts[1:-1] + [name])
urlparts[2] = '/'.join(list(Path(urlparts[2]).parts[1:-1]) + [name])
return Path(urlunparse(urlparts))
else:
return Path(self._from_parsed_parts(self._drv, self._root, self._parts[:-1] + [name]))
return Path(self._from_parsed_parts(self._drv, self._root, list(self.parts[:-1]) + [name]))


class RepeatFile:
Expand Down

0 comments on commit 06e7f32

Please sign in to comment.