confighelper: avoid direct import of JinjaTemplate

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan
2024-01-13 12:37:35 -05:00
parent ddd735feba
commit 60f4a82873
4 changed files with 26 additions and 13 deletions

View File

@@ -11,6 +11,7 @@ import copy
import re
from enum import Enum, Flag, auto
from dataclasses import dataclass
from abc import ABCMeta, abstractmethod
from .utils import ServerError, Sentinel
from .utils import json_wrapper as jsonw
@@ -159,6 +160,19 @@ class KlippyState(ExtendedEnum):
def startup_complete(self) -> bool:
return self.value > 2
class RenderableTemplate(metaclass=ABCMeta):
@abstractmethod
def __str__(self) -> str:
...
@abstractmethod
def render(self, context: Dict[str, Any] = {}) -> str:
...
@abstractmethod
async def render_async(self, context: Dict[str, Any] = {}) -> str:
...
@dataclass(frozen=True)
class APIDefinition:
endpoint: str