Skip to content

Commit 82f195d

Browse files
[Internal] Fix quality (#3572)
* fix quality * respect signature
1 parent 7d54779 commit 82f195d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/huggingface_hub/hf_file_system.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,12 +334,12 @@ def invalidate_cache(self, path: Optional[str] = None) -> None:
334334
(resolved_path.repo_type, resolved_path.repo_id, resolved_path.revision), None
335335
)
336336

337-
def _open(
337+
def _open( # type: ignore[override]
338338
self,
339339
path: str,
340340
mode: str = "rb",
341-
revision: Optional[str] = None,
342341
block_size: Optional[int] = None,
342+
revision: Optional[str] = None,
343343
**kwargs,
344344
) -> Union["HfFileSystemFile", "HfFileSystemStreamFile"]:
345345
block_size = block_size if block_size is not None else self.block_size
@@ -585,7 +585,7 @@ def walk(self, path: str, *args, **kwargs) -> Iterator[tuple[str, list[str], lis
585585
path = self.resolve_path(path, revision=kwargs.get("revision")).unresolve()
586586
yield from super().walk(path, *args, **kwargs)
587587

588-
def glob(self, path: str, **kwargs) -> list[str]:
588+
def glob(self, path: str, maxdepth: Optional[int] = None, **kwargs) -> list[str]:
589589
"""
590590
Find files by glob-matching.
591591
@@ -599,7 +599,7 @@ def glob(self, path: str, **kwargs) -> list[str]:
599599
`list[str]`: List of paths matching the pattern.
600600
"""
601601
path = self.resolve_path(path, revision=kwargs.get("revision")).unresolve()
602-
return super().glob(path, **kwargs)
602+
return super().glob(path, maxdepth=maxdepth, **kwargs)
603603

604604
def find(
605605
self,

src/huggingface_hub/inference/_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def _open_as_mime_bytes(content: Optional[ContentT]) -> Optional[MimeBytes]:
144144
if hasattr(content, "read"): # duck-typing instead of isinstance(content, BinaryIO)
145145
logger.debug("Reading content from BinaryIO")
146146
data = content.read()
147-
mime_type = mimetypes.guess_type(content.name)[0] if hasattr(content, "name") else None
147+
mime_type = mimetypes.guess_type(str(content.name))[0] if hasattr(content, "name") else None
148148
if isinstance(data, str):
149149
raise TypeError("Expected binary stream (bytes), but got text stream")
150150
return MimeBytes(data, mime_type=mime_type)

0 commit comments

Comments
 (0)