INNER CODE UNIT · Python
to_context
volfpeter/htmy · htmy/core.py:117
def to_context(self) -> Context:
"""
Creates a context with this instance in it.
See the context registration rules in the class documentation for more information.
"""
result: dict[ContextKey, ContextValue] = {type(self): self}
if self._base_context_type is not None:
result[self._base_context_type] = self
return result
@overload
@classmethod
def from_context(cls, context: Context) -> Self: ...
@overload
@classmethod