* fix : load_config function modified

* doc : CHANGELOG updated
pull/174/head
Sepand Haghighi 2023-01-08 21:09:39 +03:30 zatwierdzone przez GitHub
rodzic a9e23235b2
commit 54abe440af
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 11 dodań i 9 usunięć

Wyświetl plik

@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
### Added
- `python_version` attribute
### Changed
- `load_config` function modified
## [1.0] - 2022-12-14
### Added
- `Marker` enum

Wyświetl plik

@ -794,22 +794,22 @@ def load_config(g, config):
:return: None
"""
if isinstance(config, io.IOBase):
data = json.load(config)
g.function1_str = data.get("f1")
g.function2_str = data.get("f2")
config = json.load(config)
g.function1_str = config.get("f1")
g.function2_str = config.get("f2")
if g.function1_str is None or g.function2_str is None:
raise samilaConfigError(CONFIG_FORMAT_ERROR)
if 'matplotlib_version' in data:
g.matplotlib_version = data['matplotlib_version']
if 'python_version' in data:
g.python_version = data['python_version']
generate_config = data.get("generate")
if 'matplotlib_version' in config:
g.matplotlib_version = config['matplotlib_version']
if 'python_version' in config:
g.python_version = config['python_version']
generate_config = config.get("generate")
if generate_config is not None:
g.seed = generate_config.get("seed")
g.start = generate_config.get("start", DEFAULT_START)
g.step = generate_config.get("step", DEFAULT_STEP)
g.stop = generate_config.get("stop", DEFAULT_STOP)
plot_config = data.get("plot")
plot_config = config.get("plot")
if plot_config is not None:
g.color = plot_config.get("color", DEFAULT_COLOR)
g.bgcolor = plot_config.get("bgcolor", DEFAULT_BACKGROUND_COLOR)