ultralytics 8.0.79
expand Docs reference section (#2053)
Co-authored-by: Ayush Chaurasia <ayush.chaurarsia@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Fri3dChicken <87434761+AmoghDhaliwal@users.noreply.github.com>
This commit is contained in:
@ -111,7 +111,7 @@ class Auth:
|
||||
Get the authentication header for making API requests.
|
||||
|
||||
Returns:
|
||||
dict: The authentication header if id_token or API key is set, None otherwise.
|
||||
(dict): The authentication header if id_token or API key is set, None otherwise.
|
||||
"""
|
||||
if self.id_token:
|
||||
return {'authorization': f'Bearer {self.id_token}'}
|
||||
|
@ -30,7 +30,7 @@ def check_dataset_disk_space(url='https://ultralytics.com/assets/coco128.zip', s
|
||||
sf (float, optional): Safety factor, the multiplier for the required free space. Defaults to 2.0.
|
||||
|
||||
Returns:
|
||||
bool: True if there is sufficient disk space, False otherwise.
|
||||
(bool): True if there is sufficient disk space, False otherwise.
|
||||
"""
|
||||
gib = 1 << 30 # bytes per GiB
|
||||
data = int(requests.head(url).headers['Content-Length']) / gib # dataset size (GB)
|
||||
@ -51,7 +51,7 @@ def request_with_credentials(url: str) -> any:
|
||||
url (str): The URL to make the request to.
|
||||
|
||||
Returns:
|
||||
any: The response data from the AJAX request.
|
||||
(any): The response data from the AJAX request.
|
||||
|
||||
Raises:
|
||||
OSError: If the function is not run in a Google Colab environment.
|
||||
@ -87,11 +87,14 @@ def requests_with_progress(method, url, **kwargs):
|
||||
Args:
|
||||
method (str): The HTTP method to use (e.g. 'GET', 'POST').
|
||||
url (str): The URL to send the request to.
|
||||
progress (bool, optional): Whether to display a progress bar. Defaults to False.
|
||||
**kwargs: Additional keyword arguments to pass to the underlying `requests.request` function.
|
||||
**kwargs (dict): Additional keyword arguments to pass to the underlying `requests.request` function.
|
||||
|
||||
Returns:
|
||||
requests.Response: The response from the HTTP request.
|
||||
(requests.Response): The response object from the HTTP request.
|
||||
|
||||
Note:
|
||||
If 'progress' is set to True, the progress bar will display the download progress
|
||||
for responses with a known content length.
|
||||
"""
|
||||
progress = kwargs.pop('progress', False)
|
||||
if not progress:
|
||||
@ -118,10 +121,10 @@ def smart_request(method, url, retry=3, timeout=30, thread=True, code=-1, verbos
|
||||
code (int, optional): An identifier for the request, used for logging purposes. Default is -1.
|
||||
verbose (bool, optional): A flag to determine whether to print out to console or not. Default is True.
|
||||
progress (bool, optional): Whether to show a progress bar during the request. Default is False.
|
||||
**kwargs: Keyword arguments to be passed to the requests function specified in method.
|
||||
**kwargs (dict): Keyword arguments to be passed to the requests function specified in method.
|
||||
|
||||
Returns:
|
||||
requests.Response: The HTTP response object. If the request is executed in a separate thread, returns None.
|
||||
(requests.Response): The HTTP response object. If the request is executed in a separate thread, returns None.
|
||||
"""
|
||||
retry_codes = (408, 500) # retry only these codes
|
||||
|
||||
|
Reference in New Issue
Block a user