Skip to content

Commit

Permalink
fix glob no magic (#2056)
Browse files Browse the repository at this point in the history
  • Loading branch information
lhoestq authored and Wauplin committed Feb 28, 2024
1 parent a2fd861 commit adabfb5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/huggingface_hub/hf_file_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ def info(self, path: str, refresh: bool = False, revision: Optional[str] = None,
def exists(self, path, **kwargs):
"""Is there a file at the given path"""
try:
self.info(path, expand_info=False, **kwargs)
self.info(path, **{**kwargs, "expand_info": False})
return True
except: # noqa: E722
# any exception allowed bar FileNotFoundError?
Expand Down
4 changes: 4 additions & 0 deletions tests/test_hf_file_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ def test_info(self):
self.assertEqual(self.hffs.info(self.hf_path + "/data/text_data.txt"), text_data_file)

def test_glob(self):
self.assertEqual(
self.hffs.glob(self.hf_path + "/.gitattributes"),
[self.hf_path + "/.gitattributes"],
)
self.assertEqual(
sorted(self.hffs.glob(self.hf_path + "/*")),
sorted([self.hf_path + "/.gitattributes", self.hf_path + "/data"]),
Expand Down

0 comments on commit adabfb5

Please sign in to comment.