2022.10.3 - Removed duplicated schematic name in generate command #92 #111

Merged
edraft merged 2 commits from 2022.10.3 into 2022.10 2022-09-17 12:12:53 +02:00
9 changed files with 51 additions and 0 deletions
Showing only changes of commit 61d9912950 - Show all commits

View File

@ -11,7 +11,13 @@ class ABCTemplate(TemplateFileABC):
TemplateFileABC.__init__(self)
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}'
if schematic in name.lower():
self._class_name = f'{String.first_to_upper(name)}'
self._path = path
self._value = textwrap.dedent("""\
from abc import ABC, abstractmethod

View File

@ -11,7 +11,13 @@ class ConfigModelTemplate(TemplateFileABC):
TemplateFileABC.__init__(self)
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}'
if schematic in name.lower():
self._class_name = f'{String.first_to_upper(name)}'
self._path = path
self._value = textwrap.dedent("""\
import traceback

View File

@ -11,7 +11,13 @@ class EnumTemplate(TemplateFileABC):
TemplateFileABC.__init__(self)
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}'
if schematic in name.lower():
self._class_name = f'{String.first_to_upper(name)}'
self._path = path
self._value = textwrap.dedent("""\
from enum import Enum

View File

@ -12,6 +12,9 @@ class InitTemplate(TemplateFileABC):
self._name = f'__init__.py'
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._value = textwrap.dedent("""\
# imports

View File

@ -11,7 +11,13 @@ class PipeTemplate(TemplateFileABC):
TemplateFileABC.__init__(self)
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}'
if schematic in name.lower():
self._class_name = f'{String.first_to_upper(name)}'
self._path = path
self._value = textwrap.dedent("""\
from cpl_core.pipes.pipe_abc import PipeABC

View File

@ -11,7 +11,13 @@ class ServiceTemplate(TemplateFileABC):
TemplateFileABC.__init__(self)
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}'
if schematic in name.lower():
self._class_name = f'{String.first_to_upper(name)}'
self._path = path
self._value = textwrap.dedent("""\
class $Name:

View File

@ -11,7 +11,13 @@ class TestCaseTemplate(TemplateFileABC):
TemplateFileABC.__init__(self)
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}'
if schematic in name.lower():
self._class_name = f'{String.first_to_upper(name)}'
self._path = path
self._value = textwrap.dedent("""\
import unittest

View File

@ -11,7 +11,13 @@ class ThreadTemplate(TemplateFileABC):
TemplateFileABC.__init__(self)
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}'
if schematic in name.lower():
self._class_name = f'{String.first_to_upper(name)}'
self._path = path
self._value = textwrap.dedent("""\
import threading

View File

@ -11,7 +11,13 @@ class ValidatorTemplate(TemplateFileABC):
TemplateFileABC.__init__(self)
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}'
if schematic in name.lower():
self._class_name = f'{String.first_to_upper(name)}'
self._path = path
self._value = textwrap.dedent("""\
from cpl_core.configuration.validator_abc import ValidatorABC