Skip to content

Commit b0b4378

Browse files
committed
Added a 'Config' inner class to 'MachineConfig' to control JSON serialisation behaviour; moved 'Extra.allow' into this inner class
1 parent 93cdec0 commit b0b4378

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/murfey/util/config.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from pydantic import BaseModel, BaseSettings, Extra, validator
1212

1313

14-
class MachineConfig(BaseModel, extra=Extra.allow): # type: ignore
14+
class MachineConfig(BaseModel): # type: ignore
1515
"""
1616
Keys that describe the type of workflow conducted on the client side, and how
1717
Murfey will handle its data transfer and processing
@@ -92,6 +92,16 @@ class MachineConfig(BaseModel, extra=Extra.allow): # type: ignore
9292
node_creator_queue: str = "node_creator"
9393
notifications_queue: str = "pato_notification"
9494

95+
class Config:
96+
"""
97+
Inner class that defines this model's parsing and serialising behaviour
98+
"""
99+
100+
extra = Extra.allow
101+
json_encoders = {
102+
Path: str,
103+
}
104+
95105

96106
def from_file(config_file_path: Path, instrument: str = "") -> dict[str, MachineConfig]:
97107
with open(config_file_path, "r") as config_stream:

0 commit comments

Comments
 (0)