gcsfs icon indicating copy to clipboard operation
gcsfs copied to clipboard

find()/glob() with detail=True return a dict instead of a list (of dicts)

Open yan-hic opened this issue 4 years ago • 3 comments

Weird I didn't find this before - tested on 2021.04.0: ls, find and glob are supposedly returning a list of either strings or dicts (in case detail=True).

However with detail=True, find() and glob() return a dict of dicts.

Found that out when switching from ls to glob, sorted(files, key=lambda f: f['updated'])[-1] did not work anymore since the returned files is not a list anymore.

yan-hic avatar Nov 03 '21 17:11 yan-hic

Hm, it seems to have been this way for quite some time! I don't know why the decision was this way.

martindurant avatar Nov 03 '21 21:11 martindurant

Not sure it was intentional as the documentation says list either way.

yan-hic avatar Nov 04 '21 00:11 yan-hic

xref https://github.com/intake/filesystem_spec/pull/814 (about what the dict keys are called)

martindurant avatar Nov 04 '21 16:11 martindurant