Skip to content

Commit

Permalink
Bypass ZipFile.namelist in glob. Closes #106.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Mar 13, 2024
1 parent 2ec3ed8 commit 6494cd7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/test_complexity.py
Expand Up @@ -85,7 +85,7 @@ def test_glob_depth(self):
max_n=100,
min_n=1,
)
assert best <= big_o.complexities.Quadratic
assert best <= big_o.complexities.Linear

@pytest.mark.flaky
def test_glob_width(self):
Expand Down
3 changes: 2 additions & 1 deletion zipp/__init__.py
Expand Up @@ -399,7 +399,8 @@ def glob(self, pattern):
prefix = re.escape(self.at)
tr = Translator(seps='/')
matches = re.compile(prefix + tr.translate(pattern)).fullmatch
return map(self._next, filter(matches, self.root.namelist()))
names = (data.filename for data in self.root.filelist)
return map(self._next, filter(matches, names))

def rglob(self, pattern):
return self.glob(f'**/{pattern}')
Expand Down

0 comments on commit 6494cd7

Please sign in to comment.