@@ -107,10 +107,6 @@ def wrapper(*args: Any, **kwargs: Any) -> Any:
107
107
return cast (F , wrapper )
108
108
109
109
110
- def _filesystem_is_local (fs : fsspec .AbstractFileSystem ) -> bool :
111
- return isinstance (fs , fsspec .get_filesystem_class ("file" ))
112
-
113
-
114
110
def _kwargs_to_str (** kwargs : Any ) -> str :
115
111
return " " .join ([f"{ k } ={ v } " for k , v in kwargs .items ()])
116
112
@@ -235,7 +231,7 @@ def decode_xr_object(
235
231
if file_json ["type" ] == "application/vnd+zarr" :
236
232
filename_or_obj = fs .get_mapper (urlpath )
237
233
else :
238
- if _filesystem_is_local ( fs ) :
234
+ if "file" in fs . protocol :
239
235
filename_or_obj = urlpath
240
236
else :
241
237
# Download local copy
@@ -302,7 +298,7 @@ def _store_xr_object(
302
298
raise ValueError (f"type { filetype !r} is NOT supported." )
303
299
304
300
_store_file_object (
305
- fs if _filesystem_is_local ( fs ) else fsspec .filesystem ("file" ),
301
+ fs if "file" in fs . protocol else fsspec .filesystem ("file" ),
306
302
tmpfilename ,
307
303
fs ,
308
304
urlpath ,
@@ -362,10 +358,10 @@ def _store_file_object(
362
358
urlpath = fs_out .unstrip_protocol (urlpath_out ),
363
359
size = fs_in .size (urlpath_in ),
364
360
):
365
- if fs_in == fs_out :
361
+ if fs_in == fs_out or ( "file" in fs_in . protocol and "file" in fs_out . protocol ) :
366
362
func = fs_in .mv if io_delete_original else fs_in .cp
367
363
func (urlpath_in , urlpath_out , ** kwargs )
368
- elif _filesystem_is_local ( fs_in ) :
364
+ elif "file" in fs_in . protocol :
369
365
fs_out .put (urlpath_in , urlpath_out , ** kwargs )
370
366
else :
371
367
with fs_in .open (urlpath_in , "rb" ) as f_in :
0 commit comments