[Snyk] Security upgrade wheel from 0.30.0 to 0.38.0 (#887)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Snyk bot <github+bot@snyk.io>
This commit is contained in:
Glenn Jocher
2023-02-09 12:30:59 +04:00
committed by GitHub
parent c9893810c7
commit 365c2ef481
4 changed files with 42 additions and 9 deletions

View File

@ -18,6 +18,7 @@ from typing import Union
import cv2
import numpy as np
import pandas as pd
import requests
import torch
import yaml
@ -345,8 +346,31 @@ def get_git_branch():
return None # if not git dir or on error
def get_latest_pypi_version(package_name='ultralytics'):
"""
Returns the latest version of a PyPI package without downloading or installing it.
Parameters:
package_name (str): The name of the package to find the latest version for.
Returns:
str: The latest version of the package.
"""
response = requests.get(f"https://pypi.org/pypi/{package_name}/json")
if response.status_code == 200:
return response.json()["info"]["version"]
return None
def get_default_args(func):
# Get func() default arguments
"""Returns a dictionary of default arguments for a function.
Args:
func (callable): The function to inspect.
Returns:
dict: A dictionary where each key is a parameter name, and each value is the default value of that parameter.
"""
signature = inspect.signature(func)
return {k: v.default for k, v in signature.parameters.items() if v.default is not inspect.Parameter.empty}