htmy.typing
AsyncFunctionComponent: TypeAlias = Callable[[T, Context], Coroutine[Any, Any, Component]]
module-attribute
Protocol definition for async function components.
Component: TypeAlias = ComponentType | ComponentSequence
module-attribute
Component type: a single component or a sequence of components.
ComponentSequence: TypeAlias = list[ComponentType] | tuple[ComponentType, ...]
module-attribute
Component sequence type.
ComponentType: TypeAlias = HTMYComponentType | str
module-attribute
Type definition for a single component.
Context: TypeAlias = Mapping[ContextKey, ContextValue]
module-attribute
Context mapping.
ContextKey: TypeAlias = Any
module-attribute
Context key.
ContextProvider: TypeAlias = SyncContextProvider | AsyncContextProvider
module-attribute
Context provider type.
ContextValue: TypeAlias = Any
module-attribute
Context value.
FunctionComponent: TypeAlias = SyncFunctionComponent[T] | AsyncFunctionComponent[T]
module-attribute
Function component type.
HTMYComponentType: TypeAlias = SyncComponent | AsyncComponent
module-attribute
Sync or async htmy
component type.
MutableContext: TypeAlias = MutableMapping[ContextKey, ContextValue]
module-attribute
Mutable context mapping.
It can be helpful when the created context should be marked as mutable for static type analysis
(usually the created context is a plain dict
).
Properties: TypeAlias = Mapping[str, PropertyValue]
module-attribute
Component/XML tag property mapping.
PropertyValue: TypeAlias = Any | None
module-attribute
Component/XML tag property value.
SyncFunctionComponent: TypeAlias = Callable[[T, Context], Component]
module-attribute
Protocol definition for sync function components.
AsyncComponent
Bases: Protocol
Protocol definition for async htmy
components.
Source code in htmy/typing.py
AsyncContextProvider
Bases: Protocol
Protocol definition for async context providers.
Source code in htmy/typing.py
SyncComponent
Bases: Protocol
Protocol definition for sync htmy
components.
Source code in htmy/typing.py
SyncContextProvider
Bases: Protocol
Protocol definition for sync context providers.