Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/huggingface_hub/hf_file_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def invalidate_cache(self, path: Optional[str] = None) -> None:
(resolved_path.repo_type, resolved_path.repo_id, resolved_path.revision), None
)

def _open(
def _open( # type: ignore[override]
self,
path: str,
mode: str = "rb",
Expand Down Expand Up @@ -585,7 +585,7 @@ def walk(self, path: str, *args, **kwargs) -> Iterator[tuple[str, list[str], lis
path = self.resolve_path(path, revision=kwargs.get("revision")).unresolve()
yield from super().walk(path, *args, **kwargs)

def glob(self, path: str, **kwargs) -> list[str]:
def glob(self, path: str, maxdepth: Optional[int] = None, **kwargs) -> list[str]:
"""
Find files by glob-matching.

Expand All @@ -599,7 +599,7 @@ def glob(self, path: str, **kwargs) -> list[str]:
`list[str]`: List of paths matching the pattern.
"""
path = self.resolve_path(path, revision=kwargs.get("revision")).unresolve()
return super().glob(path, **kwargs)
return super().glob(path, maxdepth=maxdepth, **kwargs)

def find(
self,
Expand Down
2 changes: 1 addition & 1 deletion src/huggingface_hub/inference/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def _open_as_mime_bytes(content: Optional[ContentT]) -> Optional[MimeBytes]:
if hasattr(content, "read"): # duck-typing instead of isinstance(content, BinaryIO)
logger.debug("Reading content from BinaryIO")
data = content.read()
mime_type = mimetypes.guess_type(content.name)[0] if hasattr(content, "name") else None
mime_type = mimetypes.guess_type(str(content.name))[0] if hasattr(content, "name") else None
if isinstance(data, str):
raise TypeError("Expected binary stream (bytes), but got text stream")
return MimeBytes(data, mime_type=mime_type)
Expand Down
Loading