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_executable
self._rel_path = os.path.dirname(self._name)
self._project_dict = SettingsHelper.get_project_settings_dict(ProjectSettings(
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'>={sys.version.split(" ")[0]}',
{sys.platform: "../../venv/" if self._use_venv else ""},
None,
[],
))
self._project_dict = SettingsHelper.get_project_settings_dict(
ProjectSettings(
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'>={sys.version.split(" ")[0]}',
{sys.platform: "../../venv/" if self._use_venv else ""},
None,
[],
)
)
def _create_build_settings(self, project_type: str):
self._build_dict = SettingsHelper.get_build_settings_dict(BuildSettings(
ProjectTypeEnum[project_type],
"",
"../../dist",
f"{String.convert_to_snake_case(self._project_name)}.main",
self._project_name,
False,
[],
["*/__pycache__", "*/logs", "*/tests"],
{},
[],
))
self._build_dict = SettingsHelper.get_build_settings_dict(
BuildSettings(
ProjectTypeEnum[project_type],
"",
"../../dist",
f"{String.convert_to_snake_case(self._project_name)}.main",
self._project_name,
False,
[],
["*/__pycache__", "*/logs", "*/tests"],
{},
[],
)
)
def _create_project_json(self):
"""

View File

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

View File

@ -1,15 +1,16 @@
import traceback
from cpl_core.configuration.configuration_model_abc import ConfigurationModelABC
from cpl_core.console import Console
class TranslationSettings(ConfigurationModelABC):
def __init__(self):
def __init__(
self,
languages: str = None,
default_lang: str = None,
):
ConfigurationModelABC.__init__(self)
self._languages = []
self._default_lang = ""
self._languages = [] if languages is None else languages
self._default_lang = default_lang
@property
def languages(self) -> list[str]:
@ -18,11 +19,3 @@ class TranslationSettings(ConfigurationModelABC):
@property
def default_language(self) -> str:
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):
def __init__(self, method_name: str):
CommandTestCase.__init__(self, method_name)
self._source = "add-test-project"