From 6837ef1d36348232fe355c5e0198abad6d2534a7 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 24 Oct 2023 16:10:37 +0200 Subject: [PATCH 1/3] Refactor asset imports and improve documentation Updated the import statements in the `supervision/assets/__init__.py`, `supervision/assets/downloader.py`, and `supervision/assets/list.py` files to use absolute paths for improved readability and reduced risk of import errors. Also added a usage example to the `download_assets` function to better illustrate its usage and return value. --- supervision/assets/__init__.py | 4 ++-- supervision/assets/downloader.py | 11 +++++++++-- supervision/assets/list.py | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/supervision/assets/__init__.py b/supervision/assets/__init__.py index 18cc0810..3b76c5ab 100644 --- a/supervision/assets/__init__.py +++ b/supervision/assets/__init__.py @@ -1,2 +1,2 @@ -from .downloader import download_assets -from .list import VideoAssets +from supervision.assets.downloader import download_assets +from supervision.assets.list import VideoAssets diff --git a/supervision/assets/downloader.py b/supervision/assets/downloader.py index 04f1b4b2..9b12264a 100644 --- a/supervision/assets/downloader.py +++ b/supervision/assets/downloader.py @@ -4,8 +4,7 @@ from pathlib import Path from shutil import copyfileobj from typing import Union -from supervision.assets import VideoAssets -from supervision.assets.list import VIDEO_ASSETS +from supervision.assets.list import VIDEO_ASSETS, VideoAssets try: from requests import get @@ -51,6 +50,14 @@ def download_assets(asset_name: Union[VideoAssets, str]) -> str: Returns: str: The filename of the downloaded asset. + + Example: + ```python + >>> from supervision.assets import download_assets, VideoAssets + + >>> download_assets(VideoAssets.VEHICLES) + "vehicles.mp4" + ``` """ filename = asset_name.value if isinstance(asset_name, VideoAssets) else asset_name diff --git a/supervision/assets/list.py b/supervision/assets/list.py index a8ba566b..a2e58ec6 100644 --- a/supervision/assets/list.py +++ b/supervision/assets/list.py @@ -1,6 +1,7 @@ from enum import Enum from typing import Dict, Tuple + BASE_VIDEO_URL = "https://media.roboflow.com/supervision/video-examples/" From 9ece846f8ed74a6cb48f61a398bbd91dc1265fd6 Mon Sep 17 00:00:00 2001 From: SkalskiP Date: Tue, 24 Oct 2023 16:11:46 +0200 Subject: [PATCH 2/3] Update project version in pyproject.toml Increased the version of the project from "0.17.0rc1" to "0.17.0rc2" in the 'pyproject.toml' file. --- docs/assets.md | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/assets.md b/docs/assets.md index 4fded6e7..13e3cbfb 100644 --- a/docs/assets.md +++ b/docs/assets.md @@ -3,7 +3,7 @@ that you can use in your demos. ## install extra -To install the Supervision assets utility, you can use pip. This utility is available +To install the Supervision assets utility, you can use `pip`. This utility is available as an extra within the Supervision package. !!! example "pip install" diff --git a/pyproject.toml b/pyproject.toml index 11eac5a5..ce50bf1d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "supervision" -version = "0.17.0rc1" +version = "0.17.0rc2" description = "A set of easy-to-use utils that will come in handy in any Computer Vision project" authors = ["Piotr Skalski "] maintainers = ["Piotr Skalski "] From 337abe1e710e16e37fc5fb5b2138b9737f50b3e4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 24 Oct 2023 14:15:06 +0000 Subject: [PATCH 3/3] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20auto=20?= =?UTF-8?q?format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/assets/list.py | 1 - 1 file changed, 1 deletion(-) diff --git a/supervision/assets/list.py b/supervision/assets/list.py index a2e58ec6..a8ba566b 100644 --- a/supervision/assets/list.py +++ b/supervision/assets/list.py @@ -1,7 +1,6 @@ from enum import Enum from typing import Dict, Tuple - BASE_VIDEO_URL = "https://media.roboflow.com/supervision/video-examples/"