66from pathlib import WindowsPath
77from typing import Any
88from typing import Iterable
9+ from urllib .parse import SplitResult
910
1011from fsspec .implementations .local import LocalFileSystem
1112
@@ -49,19 +50,18 @@ class PosixUPath(PosixPath, UPath):
4950
5051 @property
5152 def fs (self ):
52- try :
53- return self ._cached_fs
54- except AttributeError :
55- self ._cached_fs = fs = LocalFileSystem ()
56- return fs
53+ return LocalFileSystem ()
5754
5855 @property
5956 def path (self ) -> str :
6057 return str (self )
6158
6259 @classmethod
6360 def _from_parts (cls , args , * , url = None , ** kw ):
64- return super (UPath , cls )._from_parts (args )
61+ obj = super (UPath , cls )._from_parts (args )
62+ obj ._kwargs = {}
63+ obj ._url = SplitResult ("" , "" , str (obj ), "" , "" )
64+ return obj
6565
6666
6767class WindowsUPath (WindowsPath , UPath ):
@@ -77,16 +77,15 @@ class WindowsUPath(WindowsPath, UPath):
7777
7878 @property
7979 def fs (self ):
80- try :
81- return self ._cached_fs
82- except AttributeError :
83- self ._cached_fs = fs = LocalFileSystem ()
84- return fs
80+ return LocalFileSystem ()
8581
8682 @property
8783 def path (self ) -> str :
8884 return str (self )
8985
9086 @classmethod
9187 def _from_parts (cls , args , * , url = None , ** kw ):
92- return super (UPath , cls )._from_parts (args )
88+ obj = super (UPath , cls )._from_parts (args )
89+ obj ._kwargs = {}
90+ obj ._url = SplitResult ("" , "" , str (obj ), "" , "" )
91+ return obj
0 commit comments