2023.4 #168

Merged
edraft merged 56 commits from 2023.4 into master 2023-04-12 13:57:51 +02:00
4 changed files with 45 additions and 49 deletions
Showing only changes of commit 9b4afdbe18 - Show all commits

View File

@ -80,39 +80,43 @@ class NewService(CommandABC):
python_path={sys.platform: "../../venv/" if self._use_venv else ""} python_path={sys.platform: "../../venv/" if self._use_venv else ""}
).python_executable ).python_executable
self._rel_path = os.path.dirname(self._name) self._rel_path = os.path.dirname(self._name)
self._project_dict = SettingsHelper.get_project_settings_dict(ProjectSettings( self._project_dict = SettingsHelper.get_project_settings_dict(
os.path.basename(self._name), ProjectSettings(
VersionSettings("0", "0", "0"), os.path.basename(self._name),
"", VersionSettings("0", "0", "0"),
"", "",
"", "",
"", "",
"", "",
"", "",
"", "",
"", "",
"", "",
[f"cpl-core>={version.parse(cpl_core.__version__)}"], "",
[f"cpl-cli>={version.parse(cpl_cli.__version__)}"], [f"cpl-core>={version.parse(cpl_core.__version__)}"],
f'>={sys.version.split(" ")[0]}', [f"cpl-cli>={version.parse(cpl_cli.__version__)}"],
{sys.platform: "../../venv/" if self._use_venv else ""}, f'>={sys.version.split(" ")[0]}',
None, {sys.platform: "../../venv/" if self._use_venv else ""},
[], None,
)) [],
)
)
def _create_build_settings(self, project_type: str): def _create_build_settings(self, project_type: str):
self._build_dict = SettingsHelper.get_build_settings_dict(BuildSettings( self._build_dict = SettingsHelper.get_build_settings_dict(
ProjectTypeEnum[project_type], BuildSettings(
"", ProjectTypeEnum[project_type],
"../../dist", "",
f"{String.convert_to_snake_case(self._project_name)}.main", "../../dist",
self._project_name, f"{String.convert_to_snake_case(self._project_name)}.main",
False, self._project_name,
[], False,
["*/__pycache__", "*/logs", "*/tests"], [],
{}, ["*/__pycache__", "*/logs", "*/tests"],
[], {},
)) [],
)
)
def _create_project_json(self): def _create_project_json(self):
""" """

View File

@ -3,9 +3,9 @@ from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
class DiscordBotSettings(ConfigurationModelABC): class DiscordBotSettings(ConfigurationModelABC):
def __init__( def __init__(
self, self,
token: str = None, token: str = None,
prefix: str = None, prefix: str = None,
): ):
ConfigurationModelABC.__init__(self) ConfigurationModelABC.__init__(self)

View File

@ -1,15 +1,16 @@
import traceback
from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
from cpl_core.console import Console
class TranslationSettings(ConfigurationModelABC): class TranslationSettings(ConfigurationModelABC):
def __init__(self): def __init__(
self,
languages: str = None,
default_lang: str = None,
):
ConfigurationModelABC.__init__(self) ConfigurationModelABC.__init__(self)
self._languages = [] self._languages = [] if languages is None else languages
self._default_lang = "" self._default_lang = default_lang
@property @property
def languages(self) -> list[str]: def languages(self) -> list[str]:
@ -18,11 +19,3 @@ class TranslationSettings(ConfigurationModelABC):
@property @property
def default_language(self) -> str: def default_language(self) -> str:
return self._default_lang return self._default_lang
def from_dict(self, settings: dict):
try:
self._languages = settings["Languages"]
self._default_lang = settings["DefaultLanguage"]
except Exception as e:
Console.error(f"[ ERROR ] [ {__name__} ]: Reading error in {type(self).__name__} settings")
Console.error(f"[ EXCEPTION ] [ {__name__} ]: {e} -> {traceback.format_exc()}")

View File

@ -8,7 +8,6 @@ from unittests_shared.cli_commands import CLICommands
class AddTestCase(CommandTestCase): class AddTestCase(CommandTestCase):
def __init__(self, method_name: str): def __init__(self, method_name: str):
CommandTestCase.__init__(self, method_name) CommandTestCase.__init__(self, method_name)
self._source = "add-test-project" self._source = "add-test-project"