htmy 0.3.2__tar.gz → 0.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of htmy might be problematic. Click here for more details.
- {htmy-0.3.2 → htmy-0.3.4}/PKG-INFO +1 -1
- {htmy-0.3.2 → htmy-0.3.4}/htmy/__init__.py +1 -0
- {htmy-0.3.2 → htmy-0.3.4}/htmy/core.py +9 -5
- {htmy-0.3.2 → htmy-0.3.4}/htmy/md/typing.py +6 -3
- {htmy-0.3.2 → htmy-0.3.4}/htmy/typing.py +9 -1
- {htmy-0.3.2 → htmy-0.3.4}/pyproject.toml +1 -1
- {htmy-0.3.2 → htmy-0.3.4}/LICENSE +0 -0
- {htmy-0.3.2 → htmy-0.3.4}/README.md +0 -0
- {htmy-0.3.2 → htmy-0.3.4}/htmy/etree.py +0 -0
- {htmy-0.3.2 → htmy-0.3.4}/htmy/html.py +0 -0
- {htmy-0.3.2 → htmy-0.3.4}/htmy/i18n.py +0 -0
- {htmy-0.3.2 → htmy-0.3.4}/htmy/io.py +0 -0
- {htmy-0.3.2 → htmy-0.3.4}/htmy/md/__init__.py +0 -0
- {htmy-0.3.2 → htmy-0.3.4}/htmy/md/core.py +0 -0
- {htmy-0.3.2 → htmy-0.3.4}/htmy/py.typed +0 -0
- {htmy-0.3.2 → htmy-0.3.4}/htmy/renderer.py +0 -0
- {htmy-0.3.2 → htmy-0.3.4}/htmy/utils.py +0 -0
|
@@ -28,6 +28,7 @@ from .typing import ContextProvider as ContextProvider
|
|
|
28
28
|
from .typing import ContextValue as ContextValue
|
|
29
29
|
from .typing import FunctionComponent as FunctionComponent
|
|
30
30
|
from .typing import HTMYComponentType as HTMYComponentType
|
|
31
|
+
from .typing import MutableContext as MutableContext
|
|
31
32
|
from .typing import Properties as Properties
|
|
32
33
|
from .typing import PropertyValue as PropertyValue
|
|
33
34
|
from .typing import SyncComponent as SyncComponent
|
|
@@ -5,10 +5,9 @@ import asyncio
|
|
|
5
5
|
import enum
|
|
6
6
|
from collections.abc import Callable, Container
|
|
7
7
|
from pathlib import Path
|
|
8
|
-
from typing import Any, ClassVar, Generic, TypedDict, cast, overload
|
|
8
|
+
from typing import TYPE_CHECKING, Any, ClassVar, Generic, TypedDict, cast, overload
|
|
9
9
|
from xml.sax.saxutils import escape as xml_escape
|
|
10
|
-
|
|
11
|
-
from typing_extensions import Self
|
|
10
|
+
from xml.sax.saxutils import quoteattr as xml_quoteattr
|
|
12
11
|
|
|
13
12
|
from .io import open_file
|
|
14
13
|
from .typing import (
|
|
@@ -26,6 +25,11 @@ from .typing import (
|
|
|
26
25
|
)
|
|
27
26
|
from .utils import join_components
|
|
28
27
|
|
|
28
|
+
if TYPE_CHECKING:
|
|
29
|
+
from typing_extensions import Self
|
|
30
|
+
else:
|
|
31
|
+
Self = Any
|
|
32
|
+
|
|
29
33
|
# -- Utility components
|
|
30
34
|
|
|
31
35
|
|
|
@@ -240,7 +244,7 @@ class ContextAware:
|
|
|
240
244
|
if isinstance(result, cls):
|
|
241
245
|
return result
|
|
242
246
|
|
|
243
|
-
raise TypeError("
|
|
247
|
+
raise TypeError(f"Invalid context data type for {cls.__name__}.")
|
|
244
248
|
|
|
245
249
|
|
|
246
250
|
# -- Function components
|
|
@@ -426,7 +430,7 @@ class Formatter(ContextAware):
|
|
|
426
430
|
See `SkipProperty` for more information.
|
|
427
431
|
"""
|
|
428
432
|
try:
|
|
429
|
-
return f
|
|
433
|
+
return f"{self.format_name(name)}={xml_quoteattr(self.format_value(value))}"
|
|
430
434
|
except SkipProperty:
|
|
431
435
|
return ""
|
|
432
436
|
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
from collections.abc import Callable
|
|
2
|
-
from typing import Any, TypeAlias, TypedDict
|
|
3
|
-
|
|
4
|
-
from typing_extensions import NotRequired
|
|
2
|
+
from typing import TYPE_CHECKING, Any, TypeAlias, TypedDict
|
|
5
3
|
|
|
6
4
|
from htmy.typing import Component
|
|
7
5
|
|
|
6
|
+
if TYPE_CHECKING:
|
|
7
|
+
from typing_extensions import NotRequired
|
|
8
|
+
else:
|
|
9
|
+
from typing import Optional as NotRequired
|
|
10
|
+
|
|
8
11
|
MarkdownMetadataDict: TypeAlias = dict[str, Any]
|
|
9
12
|
|
|
10
13
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from collections.abc import Callable, Coroutine, Mapping
|
|
1
|
+
from collections.abc import Callable, Coroutine, Mapping, MutableMapping
|
|
2
2
|
from typing import Any, Protocol, TypeAlias, TypeGuard, TypeVar, runtime_checkable
|
|
3
3
|
|
|
4
4
|
T = TypeVar("T")
|
|
@@ -23,6 +23,14 @@ ContextValue: TypeAlias = Any
|
|
|
23
23
|
Context: TypeAlias = Mapping[ContextKey, ContextValue]
|
|
24
24
|
"""Context mapping."""
|
|
25
25
|
|
|
26
|
+
MutableContext: TypeAlias = MutableMapping[ContextKey, ContextValue]
|
|
27
|
+
"""
|
|
28
|
+
Mutable context mapping.
|
|
29
|
+
|
|
30
|
+
It can be helpful when the created context should be marked as mutable for static type analysis
|
|
31
|
+
(usually the created context is a plain `dict`).
|
|
32
|
+
"""
|
|
33
|
+
|
|
26
34
|
# -- Components
|
|
27
35
|
|
|
28
36
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|