gcsfs
gcsfs copied to clipboard
Is there already a way to list metadata attributes?
I see::
async def _getxattr(self, path, attr):
"""Get user-defined metadata attribute"""
meta = (await self._info(path)).get("metadata", {})
return meta[attr]
getxattr = sync_wrapper(_getxattr)
Could we have as well something like:
async def _listxattr(self, path, attr):
"""List all user-defined metadata attribute"""
meta = (await self._info(path)).get("metadata", {})
return meta
listxattr = sync_wrapper(_listxattr)
My specific application is to check if a certain attribute exists and then x/y/z. I can do this at the moment with a try/except loop. If I had a list of available attributes then that would be a little cleaner.
Maybe this capability already exists?
Thanks, T.
I would suggest that allowing getxattr with attr=None should return the whole of the meta
variable, so you have everything you want in one.
Sure, if that is more Pythonesque.