From 394e03289bda73a942f8ff73889e45067800eac4 Mon Sep 17 00:00:00 2001 From: Nathan Zimmerman Date: Tue, 5 Nov 2024 13:23:29 -0600 Subject: [PATCH] Avoid trying to async-wrap properties --- fsspec/implementations/asyn_wrapper.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fsspec/implementations/asyn_wrapper.py b/fsspec/implementations/asyn_wrapper.py index a7e40606d..af38ba1a7 100644 --- a/fsspec/implementations/asyn_wrapper.py +++ b/fsspec/implementations/asyn_wrapper.py @@ -1,4 +1,5 @@ import asyncio +import inspect import functools from fsspec.asyn import AsyncFileSystem @@ -43,6 +44,10 @@ def __init__(self, sync_fs, *args, **kwargs): self.fs = sync_fs self._wrap_all_sync_methods() + @property + def fsid(self): + return f"async_{self.fs.fsid}" + def _wrap_all_sync_methods(self): """ Wrap all synchronous methods of the underlying filesystem with asynchronous versions. @@ -50,6 +55,11 @@ def _wrap_all_sync_methods(self): for method_name in dir(self.fs): if method_name.startswith("_"): continue + + attr = inspect.getattr_static(self.fs, method_name) + if isinstance(attr, property): + continue + method = getattr(self.fs, method_name) if callable(method) and not asyncio.iscoroutinefunction(method): async_method = async_wrapper(method, obj=self)