Improved cpl g templating & added custom templating #137
This commit is contained in:
27
tests/custom/general/.cpl/custom_schematic.py
Normal file
27
tests/custom/general/.cpl/custom_schematic.py
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
|
||||
from cpl_cli.abc.generate_schematic_abc import GenerateSchematicABC
|
||||
|
||||
|
||||
class Custom(GenerateSchematicABC):
|
||||
|
||||
def __init__(self, *args: str):
|
||||
GenerateSchematicABC.__init__(self, *args)
|
||||
|
||||
def get_code(self) -> str:
|
||||
code = """\
|
||||
class $Name:
|
||||
|
||||
def __init__(self):
|
||||
print('hello')
|
||||
"""
|
||||
x = self.build_code_str(code, Name=self._class_name)
|
||||
return x
|
||||
|
||||
@classmethod
|
||||
def register(cls):
|
||||
GenerateSchematicABC.register(
|
||||
cls,
|
||||
'custom',
|
||||
['cm', 'CM']
|
||||
)
|
1
tests/custom/general/test/__init__.py
Normal file
1
tests/custom/general/test/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
# imports
|
4
tests/custom/general/test/custom.py
Normal file
4
tests/custom/general/test/custom.py
Normal file
@@ -0,0 +1,4 @@
|
||||
class Custom:
|
||||
|
||||
def __init__(self):
|
||||
print('hello')
|
Reference in New Issue
Block a user