Merge pull request '2022.10.3 - Removed duplicated schematic name in generate command #92' (#111) from 2022.10.3 into 2022.10

Reviewed-on: #111
Closes #92
This commit is contained in:
Sven Heidemann 2022-09-17 12:12:52 +02:00
commit c7e2f8609c
9 changed files with 51 additions and 0 deletions

View File

@ -11,7 +11,13 @@ class ABCTemplate(TemplateFileABC):
TemplateFileABC.__init__(self) TemplateFileABC.__init__(self)
self._name = f'{String.convert_to_snake_case(name)}_{schematic}.py' self._name = f'{String.convert_to_snake_case(name)}_{schematic}.py'
if schematic in name.lower():
self._name = f'{String.convert_to_snake_case(name)}.py'
self._class_name = f'{String.first_to_upper(name)}{schematic_upper}' self._class_name = f'{String.first_to_upper(name)}{schematic_upper}'
if schematic in name.lower():
self._class_name = f'{String.first_to_upper(name)}'
self._path = path self._path = path
self._value = textwrap.dedent("""\ self._value = textwrap.dedent("""\
from abc import ABC, abstractmethod from abc import ABC, abstractmethod

View File

@ -11,7 +11,13 @@ class ConfigModelTemplate(TemplateFileABC):
TemplateFileABC.__init__(self) TemplateFileABC.__init__(self)
self._name = f'{String.convert_to_snake_case(name)}_{schematic}.py' self._name = f'{String.convert_to_snake_case(name)}_{schematic}.py'
if schematic in name.lower():
self._name = f'{String.convert_to_snake_case(name)}.py'
self._class_name = f'{String.first_to_upper(name)}{schematic_upper}' self._class_name = f'{String.first_to_upper(name)}{schematic_upper}'
if schematic in name.lower():
self._class_name = f'{String.first_to_upper(name)}'
self._path = path self._path = path
self._value = textwrap.dedent("""\ self._value = textwrap.dedent("""\
import traceback import traceback

View File

@ -11,7 +11,13 @@ class EnumTemplate(TemplateFileABC):
TemplateFileABC.__init__(self) TemplateFileABC.__init__(self)
self._name = f'{String.convert_to_snake_case(name)}_{schematic}.py' self._name = f'{String.convert_to_snake_case(name)}_{schematic}.py'
if schematic in name.lower():
self._name = f'{String.convert_to_snake_case(name)}.py'
self._class_name = f'{String.first_to_upper(name)}{schematic_upper}' self._class_name = f'{String.first_to_upper(name)}{schematic_upper}'
if schematic in name.lower():
self._class_name = f'{String.first_to_upper(name)}'
self._path = path self._path = path
self._value = textwrap.dedent("""\ self._value = textwrap.dedent("""\
from enum import Enum from enum import Enum

View File

@ -12,6 +12,9 @@ class InitTemplate(TemplateFileABC):
self._name = f'__init__.py' self._name = f'__init__.py'
self._class_name = f'{String.first_to_upper(name)}{schematic_upper}' self._class_name = f'{String.first_to_upper(name)}{schematic_upper}'
if schematic in name.lower():
self._class_name = f'{String.first_to_upper(name)}'
self._path = path self._path = path
self._value = textwrap.dedent("""\ self._value = textwrap.dedent("""\
# imports # imports

View File

@ -11,7 +11,13 @@ class PipeTemplate(TemplateFileABC):
TemplateFileABC.__init__(self) TemplateFileABC.__init__(self)
self._name = f'{String.convert_to_snake_case(name)}_{schematic}.py' self._name = f'{String.convert_to_snake_case(name)}_{schematic}.py'
if schematic in name.lower():
self._name = f'{String.convert_to_snake_case(name)}.py'
self._class_name = f'{String.first_to_upper(name)}{schematic_upper}' self._class_name = f'{String.first_to_upper(name)}{schematic_upper}'
if schematic in name.lower():
self._class_name = f'{String.first_to_upper(name)}'
self._path = path self._path = path
self._value = textwrap.dedent("""\ self._value = textwrap.dedent("""\
from cpl_core.pipes.pipe_abc import PipeABC from cpl_core.pipes.pipe_abc import PipeABC

View File

@ -11,7 +11,13 @@ class ServiceTemplate(TemplateFileABC):
TemplateFileABC.__init__(self) TemplateFileABC.__init__(self)
self._name = f'{String.convert_to_snake_case(name)}_{schematic}.py' self._name = f'{String.convert_to_snake_case(name)}_{schematic}.py'
if schematic in name.lower():
self._name = f'{String.convert_to_snake_case(name)}.py'
self._class_name = f'{String.first_to_upper(name)}{schematic_upper}' self._class_name = f'{String.first_to_upper(name)}{schematic_upper}'
if schematic in name.lower():
self._class_name = f'{String.first_to_upper(name)}'
self._path = path self._path = path
self._value = textwrap.dedent("""\ self._value = textwrap.dedent("""\
class $Name: class $Name:

View File

@ -11,7 +11,13 @@ class TestCaseTemplate(TemplateFileABC):
TemplateFileABC.__init__(self) TemplateFileABC.__init__(self)
self._name = f'{String.convert_to_snake_case(name)}_{schematic}.py' self._name = f'{String.convert_to_snake_case(name)}_{schematic}.py'
if schematic in name.lower():
self._name = f'{String.convert_to_snake_case(name)}.py'
self._class_name = f'{String.first_to_upper(name)}{schematic_upper}' self._class_name = f'{String.first_to_upper(name)}{schematic_upper}'
if schematic in name.lower():
self._class_name = f'{String.first_to_upper(name)}'
self._path = path self._path = path
self._value = textwrap.dedent("""\ self._value = textwrap.dedent("""\
import unittest import unittest

View File

@ -11,7 +11,13 @@ class ThreadTemplate(TemplateFileABC):
TemplateFileABC.__init__(self) TemplateFileABC.__init__(self)
self._name = f'{String.convert_to_snake_case(name)}_{schematic}.py' self._name = f'{String.convert_to_snake_case(name)}_{schematic}.py'
if schematic in name.lower():
self._name = f'{String.convert_to_snake_case(name)}.py'
self._class_name = f'{String.first_to_upper(name)}{schematic_upper}' self._class_name = f'{String.first_to_upper(name)}{schematic_upper}'
if schematic in name.lower():
self._class_name = f'{String.first_to_upper(name)}'
self._path = path self._path = path
self._value = textwrap.dedent("""\ self._value = textwrap.dedent("""\
import threading import threading

View File

@ -11,7 +11,13 @@ class ValidatorTemplate(TemplateFileABC):
TemplateFileABC.__init__(self) TemplateFileABC.__init__(self)
self._name = f'{String.convert_to_snake_case(name)}_{schematic}.py' self._name = f'{String.convert_to_snake_case(name)}_{schematic}.py'
if schematic in name.lower():
self._name = f'{String.convert_to_snake_case(name)}.py'
self._class_name = f'{String.first_to_upper(name)}{schematic_upper}' self._class_name = f'{String.first_to_upper(name)}{schematic_upper}'
if schematic in name.lower():
self._class_name = f'{String.first_to_upper(name)}'
self._path = path self._path = path
self._value = textwrap.dedent("""\ self._value = textwrap.dedent("""\
from cpl_core.configuration.validator_abc import ValidatorABC from cpl_core.configuration.validator_abc import ValidatorABC