diff --git a/bin/update_requirements b/bin/update_requirements index 6e5b61f..abdf835 100755 --- a/bin/update_requirements +++ b/bin/update_requirements @@ -27,22 +27,22 @@ def get_package(requre: str) -> str: harequire = [] request = requests.get( - "https://raw.githubusercontent.com/home-assistant/home-assistant/dev/setup.py" + "https://raw.githubusercontent.com/home-assistant/core/dev/requirements.txt" ) -request = request.text.split("REQUIRES = [")[1].split("]")[0].split("\n") +request = request.text.split("\n") for req in request: if "=" in req: - harequire.append(get_package(req.split('"')[1])) + harequire.append(get_package(req)) print(harequire) -with open(f"{PKG_PATH}/manifest.json") as manifest: +with open(f"{PKG_PATH}/manifest.json", encoding="utf8") as manifest: manifest = json.load(manifest) requirements = [] for req in manifest["requirements"]: requirements.append(get_package(req)) manifest["requirements"] = requirements -with open(f"{ROOT}/requirements.txt") as requirements: +with open(f"{ROOT}/requirements.txt", encoding="utf8") as requirements: tmp = requirements.readlines() requirements = [] for req in tmp: @@ -58,5 +58,5 @@ for req in manifest["requirements"]: if pkg in harequire: print(f"{pkg} in HA requirements, no need here.") print(json.dumps(manifest["requirements"], indent=4)) -with open(f"{PKG_PATH}/manifest.json", "w") as manifestfile: +with open(f"{PKG_PATH}/manifest.json", "w", encoding="utf8") as manifestfile: manifestfile.write(json.dumps(manifest, indent=4)) diff --git a/custom_components/integration_blueprint/manifest.json b/custom_components/integration_blueprint/manifest.json index 81e94a6..4849748 100644 --- a/custom_components/integration_blueprint/manifest.json +++ b/custom_components/integration_blueprint/manifest.json @@ -1,14 +1,14 @@ { - "domain": "", - "name": "", - "version": "", - "documentation": "https://github.com/Limych/ha-blueprint", - "issue_tracker": "", - "dependencies": [], - "config_flow": true, - "codeowners": [ - "@Limych" - ], - "requirements": [], - "iot_class": "cloud_polling" -} + "domain": "", + "name": "", + "version": "", + "documentation": "https://github.com/Limych/ha-blueprint", + "issue_tracker": "", + "dependencies": [], + "config_flow": true, + "codeowners": [ + "@Limych" + ], + "requirements": [], + "iot_class": "cloud_polling" +} \ No newline at end of file diff --git a/tests/const.py b/tests/const.py index 83ee391..380577e 100644 --- a/tests/const.py +++ b/tests/const.py @@ -1,5 +1,7 @@ """Constants for tests.""" +from typing import Final + from custom_components.integration_blueprint.const import CONF_PASSWORD, CONF_USERNAME # Mock config data to be used across multiple tests -MOCK_CONFIG = {CONF_USERNAME: "test_username", CONF_PASSWORD: "test_password"} +MOCK_CONFIG: Final = {CONF_USERNAME: "test_username", CONF_PASSWORD: "test_password"}