Improved cpl g templating & added custom templating #137

This commit is contained in:
2022-12-05 19:57:27 +01:00
parent d6e3b37f7f
commit d1c93abe2c
34 changed files with 527 additions and 539 deletions

View File

@@ -0,0 +1,28 @@
from abc import ABC, abstractmethod
from cpl_core.utils import String
class FileTemplateABC(ABC):
@abstractmethod
def __init__(self, name: str, path: str, code: str):
self._name = f'{String.convert_to_snake_case(name)}.py'
self._path = path
self._code = code
@property
def name(self) -> str:
return self._name
@property
def path(self) -> str:
return self._path
@property
def value(self) -> str:
return self.get_code()
@abstractmethod
def get_code(self) -> str:
return self._code