typing/assets: Add type hints to methods and polish docstrings (#2087)
This commit is contained in:
parent
0bf55b7ac7
commit
21482e9109
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue