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 4cceb49 commit ac8ea7a
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,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 ac8ea7a

Please sign in to comment.