puppygirl-py/puppygirl/protocols.py
2025-10-06 06:31:11 -04:00

16 lines
437 B
Python

from copy import copy
from typing import TYPE_CHECKING, Protocol, Self, runtime_checkable
if TYPE_CHECKING:
from elements import Element
from puppytype import RenderableElement, TemplateDict
class Clonable[T = Self](Protocol):
def clone(self) -> T:
return copy(self)
@runtime_checkable
class Renderable(Protocol):
def render(self, element: "Element", templates: "TemplateDict") -> "RenderableElement":
return element