|
3 | 3 | from typing import Type, Dict, Any, List |
4 | 4 |
|
5 | 5 | from dataclasses_serialization.json import JSONSerializer |
6 | | -from dataclasses_serialization.serializer_base import (DeserializationError, |
7 | | - dict_serialization) |
| 6 | +from dataclasses_serialization.serializer_base import DeserializationError |
8 | 7 |
|
9 | 8 | from .network_config import NodeConfig, NetworkConfig, NetworkConfigBuilder |
10 | | -from ..settings.simulaqron_config import (DEFAULT_SIMULAQRON_SETTINGS_FILENAME, |
11 | | - SimulaqronConfig, SimBackend) |
| 9 | +from ..settings import HOME_SIMULAQRON_SETTINGS |
| 10 | +from ..settings.simulaqron_config import SimulaqronConfig, SimBackend |
12 | 11 |
|
13 | 12 |
|
14 | 13 | def init_serialization(): |
@@ -45,10 +44,11 @@ def path_serializer(obj: Path) -> str: |
45 | 44 | # Registration of Deserializer for python enums |
46 | 45 | @JSONSerializer.register_deserializer(Path) |
47 | 46 | def path_deserializer(cls: Type[Path], path: str) -> Path: |
48 | | - if path == "$DEFAULT_NETWORK": |
49 | | - return (cls.home() / ".simulaqron" / DEFAULT_SIMULAQRON_SETTINGS_FILENAME).resolve() |
50 | | - # If the path is given, we will resolve it later |
51 | | - return cls(path) |
| 47 | + match path: |
| 48 | + case "$DEFAULT_NETWORK": |
| 49 | + return HOME_SIMULAQRON_SETTINGS |
| 50 | + case _: |
| 51 | + return cls(path) |
52 | 52 |
|
53 | 53 |
|
54 | 54 | @JSONSerializer.register_deserializer(SimulaqronConfig) |
|
0 commit comments