Skip to content

Commit

Permalink
Rename attribute for save generic params
Browse files Browse the repository at this point in the history
`__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__`.
  • Loading branch information
M1troll committed Dec 20, 2024
1 parent 767be78 commit 8da8b14
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ Version history

We follow `Semantic Versions <https://semver.org/>`_.

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
Expand Down
4 changes: 2 additions & 2 deletions pomcorn/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__(
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
Expand Down

0 comments on commit 8da8b14

Please sign in to comment.