Initial commit
This commit is contained in:
32
env/lib/python3.10/site-packages/laces/typing.py
vendored
Normal file
32
env/lib/python3.10/site-packages/laces/typing.py
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
from typing import TYPE_CHECKING, Protocol, Union
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any, Optional, TypeAlias
|
||||
|
||||
from django.forms.widgets import Media
|
||||
from django.template import Context
|
||||
from django.utils.safestring import SafeString
|
||||
|
||||
RenderContext: TypeAlias = Union[Context, dict[str, Any]]
|
||||
|
||||
|
||||
class HasRenderHtmlMethod(Protocol):
|
||||
def render_html( # noqa: E704
|
||||
self,
|
||||
parent_context: "Optional[RenderContext]",
|
||||
) -> "SafeString": ...
|
||||
|
||||
|
||||
class HasRenderMethod(Protocol):
|
||||
def render( # noqa: E704
|
||||
self,
|
||||
) -> "SafeString": ...
|
||||
|
||||
|
||||
Renderable: "TypeAlias" = Union[HasRenderHtmlMethod, HasRenderMethod]
|
||||
|
||||
|
||||
class HasMediaProperty(Protocol):
|
||||
@property
|
||||
def media(self) -> "Media": ... # noqa: E704
|
||||
Reference in New Issue
Block a user