|
11 | 11 | from plone.base.utils import get_installer |
12 | 12 | from Products.CMFPlone.controlpanel.browser.quickinstaller import InstallerView |
13 | 13 | from Products.GenericSetup import EXTENSION |
| 14 | +from typing import Any |
| 15 | +from typing import cast |
14 | 16 | from zope.component import getAllUtilitiesRegisteredFor |
15 | 17 | from zope.globalrequest import getRequest |
16 | 18 |
|
@@ -94,7 +96,7 @@ def _get_non_installable_addons() -> NonInstallableAddons: |
94 | 96 |
|
95 | 97 |
|
96 | 98 | @lru_cache(maxsize=1) |
97 | | -def _cached_addons() -> tuple[tuple[str, AddonInformation]]: |
| 99 | +def _cached_addons() -> tuple[tuple[str, AddonInformation], ...]: |
98 | 100 | """Return information about add-ons in this installation. |
99 | 101 |
|
100 | 102 | :returns: Tuple of tuples with add-on id and AddonInformation. |
@@ -130,7 +132,7 @@ def _cached_addons() -> tuple[tuple[str, AddonInformation]]: |
130 | 132 | profile_type = pid_parts[-1] |
131 | 133 | if product_id not in addons: |
132 | 134 | # get some basic information on the product |
133 | | - product = { |
| 135 | + product: dict[str, Any] = { |
134 | 136 | "id": product_id, |
135 | 137 | "version": get_version(product_id), |
136 | 138 | "title": product_id, |
@@ -274,7 +276,9 @@ def get(addon: str) -> AddonInformation: |
274 | 276 | addons = dict(_cached_addons()) |
275 | 277 | if addon not in addons: |
276 | 278 | raise InvalidParameterError(f"No add-on {addon} found.") |
277 | | - return _update_addon_info(addons.get(addon), _get_installer()) |
| 279 | + return _update_addon_info( |
| 280 | + cast(AddonInformation, addons.get(addon)), _get_installer() |
| 281 | + ) |
278 | 282 |
|
279 | 283 |
|
280 | 284 | @required_parameters("addon") |
|
0 commit comments