1818PYPI_URL = "https://pypi.org/pypi/{package}/json"
1919
2020
21- def load_manifest_requirements () -> list [Requirement ]: # noqa: D103 (disable docstrings requirement)
21+ def load_manifest_requirements () -> list [Requirement ]:
2222 with MANIFEST .open () as f :
2323 manifest = json .load (f )
2424 reqs : list [str ] = manifest .get ("requirements" , [])
2525 return [Requirement (req ) for req in reqs ]
2626
2727
28- def load_minimum_ha_version () -> Version : # noqa: D103
28+ def load_minimum_ha_version () -> Version :
2929 with HACS .open () as f :
3030 hacs = json .load (f )
3131 return Version (hacs .get ("homeassistant" , None ))
3232
3333
34- def load_relevant_constraints (url : str , reqs : list [Requirement ]) -> dict [str , Requirement ]: # noqa: D103
34+ def load_relevant_constraints (url : str , reqs : list [Requirement ]) -> dict [str , Requirement ]:
3535 names = [req .name for req in reqs ]
3636 constraints : dict [str , Requirement ] = {}
37- with urllib .request .urlopen (url ) as response :
37+ with urllib .request .urlopen (url ) as response : # noqa: S310 (ignore suspicious-url-open-usage since url is hardcoded https)
3838 for raw_line in response :
3939 line = raw_line .decode ().strip ()
4040 if not line or line .startswith ("#" ):
@@ -46,11 +46,11 @@ def load_relevant_constraints(url: str, reqs: list[Requirement]) -> dict[str, Re
4646 return constraints
4747
4848
49- def get_pypi_versions_for_package (package : str ) -> list [Version ]: # noqa: D103
49+ def get_pypi_versions_for_package (package : str ) -> list [Version ]:
5050 url = PYPI_URL .format (package = package )
5151
5252 versions : list [Version ] = []
53- with urllib .request .urlopen (url ) as resp :
53+ with urllib .request .urlopen (url ) as resp : # noqa: S310
5454 data = json .load (resp )
5555
5656 for v in data .get ("releases" , {}):
@@ -61,14 +61,14 @@ def get_pypi_versions_for_package(package: str) -> list[Version]: # noqa: D103
6161 return versions
6262
6363
64- def get_pypi_versions (packages : list [str ]) -> dict [str , list [Version ]]: # noqa: D103
64+ def get_pypi_versions (packages : list [str ]) -> dict [str , list [Version ]]:
6565 versions : dict [str , list [Version ]] = {}
6666 for package in packages :
6767 versions [package ] = get_pypi_versions_for_package (package )
6868 return versions
6969
7070
71- def check_compatibility ( # noqa: D103
71+ def check_compatibility (
7272 requirements : list [Requirement ],
7373 constraints : dict [str , Requirement ],
7474 pypi_lib : dict [str , list [Version ]],
@@ -94,13 +94,13 @@ def check_compatibility( # noqa: D103
9494 return errors
9595
9696
97- def get_ha_tags () -> list [str ]: # noqa: D103
97+ def get_ha_tags () -> list [str ]:
9898 tags = []
9999 page = 1
100100 last_page = 3
101101 while page <= last_page :
102102 url = f"{ HA_RELEASES_URL } ?per_page=100&page={ page } "
103- with urllib .request .urlopen (url ) as resp :
103+ with urllib .request .urlopen (url ) as resp : # noqa: S310
104104 data = json .load (resp )
105105 if not data :
106106 break
@@ -116,7 +116,7 @@ def get_ha_tags() -> list[str]: # noqa: D103
116116 return sorted (versions , reverse = True )
117117
118118
119- def get_constraints_url (version : str = "" ) -> str : # noqa: D103
119+ def get_constraints_url (version : str = "" ) -> str :
120120 return CONSTRAINTS_URL .format (v = version if version else "dev" )
121121
122122
0 commit comments