From 2fc795f005b02abaadd48063522022658cd1a21a Mon Sep 17 00:00:00 2001 From: Aaron Gokaslan Date: Wed, 6 Mar 2024 14:59:48 -0500 Subject: [PATCH] Use inplace reverse method. More efficient (#1537) --- fsspec/core.py | 2 +- fsspec/implementations/reference.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fsspec/core.py b/fsspec/core.py index c6263a673..a76c900d1 100644 --- a/fsspec/core.py +++ b/fsspec/core.py @@ -343,7 +343,7 @@ def _un_chain(path, kwargs): bit = previous_bit out.append((bit, protocol, kw)) previous_bit = bit - out = list(reversed(out)) + out.reverse() return out diff --git a/fsspec/implementations/reference.py b/fsspec/implementations/reference.py index a36e488d9..e202c96d6 100644 --- a/fsspec/implementations/reference.py +++ b/fsspec/implementations/reference.py @@ -1035,7 +1035,7 @@ def _dircache_from_items(self): par0 = self._parent(par0) subdirs.append(par0) - subdirs = subdirs[::-1] + subdirs.reverse() for parent, child in zip(subdirs, subdirs[1:]): # register newly discovered directories assert child not in self.dircache