Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8ae6609c7 | ||
|
|
cbd39ff161 |
@@ -1,7 +1,7 @@
|
|||||||
# MARK: Project info
|
# MARK: Project info
|
||||||
[project]
|
[project]
|
||||||
name = "corelibs"
|
name = "corelibs"
|
||||||
version = "0.22.4"
|
version = "0.22.5"
|
||||||
description = "Collection of utils for Python scripts"
|
description = "Collection of utils for Python scripts"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.13"
|
requires-python = ">=3.13"
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class SettingsLoader:
|
|||||||
def load_settings(
|
def load_settings(
|
||||||
self,
|
self,
|
||||||
config_id: str,
|
config_id: str,
|
||||||
config_validate: dict[str, list[str]],
|
config_validate: dict[str, list[str]] | None = None,
|
||||||
allow_not_exist: bool = False
|
allow_not_exist: bool = False
|
||||||
) -> dict[str, str]:
|
) -> dict[str, str]:
|
||||||
"""
|
"""
|
||||||
@@ -97,6 +97,8 @@ class SettingsLoader:
|
|||||||
settings: dict[str, dict[str, Any]] = {
|
settings: dict[str, dict[str, Any]] = {
|
||||||
config_id: {},
|
config_id: {},
|
||||||
}
|
}
|
||||||
|
if config_validate is None:
|
||||||
|
config_validate = {}
|
||||||
if self.config_parser is not None:
|
if self.config_parser is not None:
|
||||||
try:
|
try:
|
||||||
# load all data as is, validation is done afterwards
|
# load all data as is, validation is done afterwards
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ def main():
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
config_load = 'LoadTest'
|
config_load = 'LoadTest'
|
||||||
config_data = sl.load_settings(config_load, {})
|
config_data = sl.load_settings(config_load)
|
||||||
print(f"[{config_load}] Load: {config_load} -> {dump_data(config_data)}")
|
print(f"[{config_load}] Load: {config_load} -> {dump_data(config_data)}")
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
print(f"Could not load settings: {e}")
|
print(f"Could not load settings: {e}")
|
||||||
|
|||||||
Reference in New Issue
Block a user