From 938abb65b6cec1a6a26b58f3e7b5b2e2b11c7b8a Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Thu, 5 Sep 2024 16:13:12 -0700 Subject: [PATCH] Get installed packages should return a list --- unhacs/packages.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/unhacs/packages.py b/unhacs/packages.py index bff30a2..ccae4dc 100644 --- a/unhacs/packages.py +++ b/unhacs/packages.py @@ -401,15 +401,17 @@ def get_installed_packages( PackageType.INTEGRATION, PackageType.PLUGIN, ), -) -> Generator[Package, None, None]: +) -> list[Package]: # Integration packages + packages: list[Package] = [] + if PackageType.INTEGRATION in package_types: for custom_component in (hass_config_path / "custom_components").glob("*"): unhacs = custom_component / "unhacs.yaml" if unhacs.exists(): package = Package.from_yaml(yaml.safe_load(unhacs.open())) package.path = custom_component - yield package + packages.append(package) # Plugin packages if PackageType.PLUGIN in package_types: @@ -418,7 +420,9 @@ def get_installed_packages( package.path = js_unhacs.with_name( js_unhacs.name.removesuffix("-unhacs.yaml") ) - yield package + packages.append(package) + + return packages # Read a list of Packages from a text file in the plain text format "URL version name"