Skip to content

Commit 6e55c93

Browse files
Fix mypy
1 parent 7b38964 commit 6e55c93

File tree

3 files changed

+19
-21
lines changed

3 files changed

+19
-21
lines changed

pyhtml/__tag_base.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,7 @@ def _render(self) -> list[str]:
9797
else:
9898
out = [opening]
9999
# Children
100-
out.extend(
101-
util.render_children(
102-
# Instantiate types as empty tags
103-
util.instantiate_tag_types(self.children)
104-
)
105-
)
100+
out.extend(util.render_children(self.children))
106101
# Closing tag
107102
out.append(f"</{self._get_tag_name()}>")
108103

pyhtml/__tags/input.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def __init__(
304304
super().__init__(**attributes)
305305

306306
# Form submission
307-
@overload
307+
@overload # type: ignore
308308
def __call__(
309309
self,
310310
*,
@@ -460,7 +460,7 @@ def __call__(
460460
) -> None:
461461
...
462462

463-
# default, allowing all arguments
463+
# default, suggesting types
464464
@overload
465465
def __call__(
466466
self,
@@ -476,6 +476,22 @@ def __call__(
476476
) -> None:
477477
...
478478

479+
# default, allowing all arguments
480+
@overload
481+
def __call__(
482+
self,
483+
*,
484+
type: Optional[str] = None,
485+
id: Optional[str] = None,
486+
name: Optional[str] = None,
487+
value: Optional[str] = None,
488+
placeholder: Optional[str] = None,
489+
readonly: Optional[bool] = None,
490+
required: Optional[bool] = None,
491+
**attributes: AttributeType,
492+
) -> None:
493+
...
494+
479495
def __call__( # type: ignore
480496
self,
481497
*,

pyhtml/__util.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,19 +139,6 @@ def flatten_list(the_list: list[ChildrenType]) -> list[ChildElementType]:
139139
return result
140140

141141

142-
def instantiate_tag_types(elements: list[Any]) -> list[Any]:
143-
"""
144-
Map a list so that any element e for which issubclass(e, Tag) returns True
145-
is instantiated
146-
"""
147-
# Can't wait for lazy imports in Python 3.12
148-
from .__tag_base import Tag
149-
return list(map(
150-
lambda e: e() if isinstance(e, type) and issubclass(e, Tag) else e,
151-
elements,
152-
))
153-
154-
155142
def dict_union(base: dict[K, V], additions: dict[K, V]) -> dict[K, V]:
156143
"""
157144
Smart union of a dictionary - if a value in `base` is `None` and the

0 commit comments

Comments
 (0)