Skip to content

Commit

Permalink
Use operator.itemgetter for perf/readability in archive (#1764)
Browse files Browse the repository at this point in the history

Co-authored-by: Martin Durant <[email protected]>
  • Loading branch information
Skylion007 and martindurant authored Jan 6, 2025
1 parent 90c7cd9 commit 1d34249
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fsspec/archive.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import operator

from fsspec import AbstractFileSystem
from fsspec.utils import tokenize

Expand Down Expand Up @@ -67,7 +69,7 @@ def ls(self, path, detail=True, **kwargs):
out = {"name": ppath, "size": 0, "type": "directory"}
paths[ppath] = out
if detail:
out = sorted(paths.values(), key=lambda _: _["name"])
out = sorted(paths.values(), key=operator.itemgetter("name"))
return out
else:
return sorted(paths)

0 comments on commit 1d34249

Please sign in to comment.