Skip to content

Commit 613244a

Browse files
committed
Apply 1 to 2 conversion with possible path to str problems
1 parent ed8aa3c commit 613244a

File tree

5 files changed

+8
-19
lines changed

5 files changed

+8
-19
lines changed

src/murfey/server/api/prometheus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def increment_rsync_file_count(
3939
logger.error(
4040
f"Failed to find rsync instance for visit {sanitise(visit_name)} "
4141
"with the following properties: \n"
42-
f"{rsyncer_info.dict()}",
42+
f"{rsyncer_info.model_dump()}",
4343
exc_info=True,
4444
)
4545
return None

src/murfey/server/api/session_control.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def get_current_visits(instrument_name: str, db=ispyb_db):
9696

9797

9898
class SessionInfo(BaseModel):
99-
session_id: Optional[int]
99+
session_id: Optional[int] = None
100100
session_name: str = ""
101101
rescale: bool = True
102102

src/murfey/server/api/workflow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -608,9 +608,9 @@ class TomoProcessFile(BaseModel):
608608
tag: str
609609
image_number: int
610610
pixel_size: float
611-
dose_per_frame: Optional[float]
611+
dose_per_frame: Optional[float] = None
612612
frame_count: int
613-
tilt_axis: Optional[float]
613+
tilt_axis: Optional[float] = None
614614
mc_uuid: Optional[int] = None
615615
voltage: float = 300
616616
mc_binning: int = 1

src/murfey/util/config.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import yaml
1010
from backports.entry_points_selectable import entry_points
11-
from pydantic import BaseModel, Extra, field_validator
11+
from pydantic import BaseModel, ConfigDict, field_validator
1212
from pydantic_settings import BaseSettings
1313

1414

@@ -94,15 +94,7 @@ class MachineConfig(BaseModel): # type: ignore
9494
node_creator_queue: str = "node_creator"
9595
notifications_queue: str = "pato_notification"
9696

97-
class Config:
98-
"""
99-
Inner class that defines this model's parsing and serialising behaviour
100-
"""
101-
102-
extra = Extra.allow
103-
json_encoders = {
104-
Path: str,
105-
}
97+
model_config = ConfigDict(extra="allow")
10698

10799

108100
def from_file(config_file_path: Path, instrument: str = "") -> dict[str, MachineConfig]:
@@ -145,10 +137,7 @@ class Security(BaseModel):
145137
graylog_host: str = ""
146138
graylog_port: Optional[int] = None
147139

148-
class Config:
149-
json_encoders = {
150-
Path: str,
151-
}
140+
model_config = ConfigDict()
152141

153142
@field_validator("graylog_port")
154143
def check_port_present_if_host_is(

src/murfey/util/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class Token(BaseModel):
156156

157157

158158
class ProcessingParametersTomo(BaseModel):
159-
dose_per_frame: Optional[float]
159+
dose_per_frame: Optional[float] = None
160160
frame_count: int
161161
tilt_axis: float
162162
gain_ref: Optional[str] = None

0 commit comments

Comments
 (0)