typing/assets: Add type hints to methods and polish docstrings (#2087)

This commit is contained in:
Jirka Borovec 2026-01-27 13:06:36 +09:00 committed by GitHub
parent 0bf55b7ac7
commit 21482e9109
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 8 deletions

View File

@ -205,8 +205,6 @@ module = [
# TODO: fix type errors in the following modules
"supervision.annotators.core",
"supervision.annotators.utils",
"supervision.assets.downloader",
"supervision.assets.list",
"supervision.classification.core",
"supervision.dataset.core",
"supervision.dataset.formats.coco",

View File

@ -19,11 +19,11 @@ def is_md5_hash_matching(filename: str, original_md5_hash: str) -> bool:
not for cryptographic security purposes.
Parameters:
filename (str): The path to the file to be checked as a string.
original_md5_hash (str): The original MD5 hash to compare against.
filename: The path to the file to be checked as a string.
original_md5_hash: The original MD5 hash to compare against.
Returns:
bool: True if the hashes match, False otherwise.
True if the hashes match, False otherwise.
"""
if not os.path.exists(filename):
return False
@ -40,11 +40,11 @@ def download_assets(asset_name: VideoAssets | str) -> str:
Download a specified asset if it doesn't already exist or is corrupted.
Parameters:
asset_name (Union[VideoAssets, str]): The name or type of the asset to be
asset_name: The name or type of the asset to be
downloaded.
Returns:
str: The filename of the downloaded asset.
The filename of the downloaded asset.
Example:
```python

View File

@ -34,7 +34,7 @@ class VideoAssets(Enum):
SKIING = "skiing.mp4"
@classmethod
def list(cls):
def list(cls) -> list[str]:
return list(map(lambda c: c.value, cls))