Skip to content

Commit

Permalink
wip fixes #156
Browse files Browse the repository at this point in the history
  • Loading branch information
normanrz committed Oct 19, 2023
1 parent 7e3836d commit ddb0fc9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
28 changes: 28 additions & 0 deletions upath/implementations/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,20 @@ def _from_parts(cls, args, *, url=None, **kw):
obj._url = SplitResult("", "", str(obj), "", "")
return obj

@classmethod
def _format_parsed_parts(
cls,
drv,
root,
parts,
url=None,
**kwargs: Any,
) -> str:
obj = super(UPath, cls)._format_parsed_parts(drv, root, parts)
obj._kwargs = {}
obj._url = SplitResult("", "", str(obj), "", "")
return obj


class WindowsUPath(WindowsPath, UPath):
__slots__ = ()
Expand All @@ -89,3 +103,17 @@ def _from_parts(cls, args, *, url=None, **kw):
obj._kwargs = {}
obj._url = SplitResult("", "", str(obj), "", "")
return obj

@classmethod
def _format_parsed_parts(
cls,
drv,
root,
parts,
url=None,
**kwargs: Any,
) -> str:
obj = super(UPath, cls)._format_parsed_parts(drv, root, parts)
obj._kwargs = {}
obj._url = SplitResult("", "", str(obj), "", "")
return obj
5 changes: 5 additions & 0 deletions upath/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ def test_access_to_private_kwargs_and_url(urlpath):
assert isinstance(pth._url, SplitResult)
assert pth._url.scheme == "" or pth._url.scheme in pth.fs.protocol
assert pth._url.path == pth.path
subpth = pth / "foo"
assert subpth._kwargs == {}
assert isinstance(subpth._url, SplitResult)
assert subpth._url.scheme == "" or subpth._url.scheme in subpth.fs.protocol
assert subpth._url.path == subpth.path


def test_copy_path_append_kwargs():
Expand Down

0 comments on commit ddb0fc9

Please sign in to comment.