diff --git a/upath/implementations/local.py b/upath/implementations/local.py index 0af1ad7b..61614fef 100644 --- a/upath/implementations/local.py +++ b/upath/implementations/local.py @@ -63,6 +63,22 @@ def _from_parts(cls, args, *, url=None, **kw): obj._url = SplitResult("", "", str(obj), "", "") return obj + @classmethod + def _from_parsed_parts( + cls, + drv, + root, + parts, + url=None, + **kwargs: Any, + ): + obj = super(UPath, cls)._from_parsed_parts( # type: ignore[misc] + drv, root, parts + ) + obj._kwargs = {} + obj._url = SplitResult("", "", str(obj), "", "") + return obj + class WindowsUPath(WindowsPath, UPath): __slots__ = () @@ -89,3 +105,19 @@ def _from_parts(cls, args, *, url=None, **kw): obj._kwargs = {} obj._url = SplitResult("", "", str(obj), "", "") return obj + + @classmethod + def _from_parsed_parts( + cls, + drv, + root, + parts, + url=None, + **kwargs: Any, + ): + obj = super(UPath, cls)._from_parsed_parts( # type: ignore[misc] + drv, root, parts + ) + obj._kwargs = {} + obj._url = SplitResult("", "", str(obj), "", "") + return obj diff --git a/upath/tests/test_core.py b/upath/tests/test_core.py index 3a128b4e..ad49cb3c 100644 --- a/upath/tests/test_core.py +++ b/upath/tests/test_core.py @@ -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():