From 8da8b148a1cadbe9a469263b58044e0fd809521f Mon Sep 17 00:00:00 2001 From: Anton Oboleninov Date: Fri, 20 Dec 2024 10:30:44 +0700 Subject: [PATCH] Rename attribute for save generic params `__parameters__` that have been used before cannot be used because they may break some of python's built-in logic. So we rename it to custom attribute `__generic_parameters__`. --- docs/CHANGELOG.rst | 7 ++++++- pomcorn/component.py | 4 ++-- pyproject.toml | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/CHANGELOG.rst b/docs/CHANGELOG.rst index 036f29f..1bd2832 100644 --- a/docs/CHANGELOG.rst +++ b/docs/CHANGELOG.rst @@ -3,7 +3,12 @@ Version history We follow `Semantic Versions `_. -0.8.2 (29.11.24) +0.8.3 (20.12.24) +******************************************************************************* +- Rename ``__parameters__`` in ``ListComponent`` to ``__generic__parameters`` + to avoid problems with Python build-in functions + +0.8.2 (19.12.24) ******************************************************************************* - Add ability to specify ``TypeAlias`` as ``_item class`` and use ``ListComponent`` as a parameterized type diff --git a/pomcorn/component.py b/pomcorn/component.py index 834dcda..986b17c 100644 --- a/pomcorn/component.py +++ b/pomcorn/component.py @@ -225,7 +225,7 @@ def __class_getitem__(cls, item: tuple[type, ...]) -> Any: """ list_cls = super().__class_getitem__(item) # type: ignore - cls.__parameters__ = item # type: ignore + cls.__generic_parameters__ = item # type: ignore return list_cls def __init__( @@ -240,7 +240,7 @@ def __init__( if isinstance(self._item_class, _EmptyValue): # In this way we check the stored generic parameters and, if first # from them is valid, set it as `_item_class` - first_generic_param = self.__parameters__[0] + first_generic_param = self.__generic_parameters__[0] if self.is_valid_item_class(first_generic_param): self._item_class = first_generic_param super().__init__(page, base_locator, wait_until_visible) diff --git a/pyproject.toml b/pyproject.toml index ba70148..45c8f37 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pomcorn" -version = "0.8.2" +version = "0.8.3" description = "Base implementation of Page Object Model" authors = [ "Saritasa ",