Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/docstrings' into docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher committed Feb 25, 2024
2 parents f1a7dbb + a4bf7b4 commit 6cb044c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions utils/downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ def is_url(url, check=True):


def gsutil_getsize(url=""):
"""Returns the size in bytes of a file at a Google Cloud Storage URL using `gsutil du`. Returns 0 if the command fails or output is empty."""
"""
Returns the size in bytes of a file at a Google Cloud Storage URL using `gsutil du`.
Returns 0 if the command fails or output is empty.
"""
output = subprocess.check_output(["gsutil", "du", url], shell=True, encoding="utf-8")
return int(output.split()[0]) if output else 0

Expand Down Expand Up @@ -54,7 +58,11 @@ def curl_download(url, filename, *, silent: bool = False) -> bool:


def safe_download(file, url, url2=None, min_bytes=1e0, error_msg=""):
"""Downloads a file from a URL (or alternate URL) to a specified path if file is above a minimum size. Removes incomplete downloads."""
"""
Downloads a file from a URL (or alternate URL) to a specified path if file is above a minimum size.
Removes incomplete downloads.
"""
from utils.general import LOGGER

file = Path(file)
Expand All @@ -78,7 +86,9 @@ def safe_download(file, url, url2=None, min_bytes=1e0, error_msg=""):


def attempt_download(file, repo="ultralytics/yolov5", release="v7.0"):
"""Downloads a file from GitHub release assets or via direct URL if not found locally, supporting backup versions."""
"""Downloads a file from GitHub release assets or via direct URL if not found locally, supporting backup
versions.
"""
from utils.general import LOGGER

def github_assets(repository, version="latest"):
Expand Down

0 comments on commit 6cb044c

Please sign in to comment.