Skip to content

Commit

Permalink
MNT Add always=True to current model validators
Browse files Browse the repository at this point in the history
gadorlhiac committed Apr 5, 2024
1 parent 2ccba6b commit 5a8416e
Showing 4 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions lute/io/models/sfx_find_peaks.py
Original file line number Diff line number Diff line change
@@ -113,7 +113,7 @@ class SZCompressorParameters(BaseModel):
rename_param="o",
)

@validator("out_file")
@validator("out_file", always=True)
def validate_out_file(cls, out_file: str, values: Dict[str, Any]) -> str:
if out_file == "":
fname: Path = (
@@ -268,13 +268,13 @@ class SZParameters(BaseModel):
description="Configuration parameters for SZ Compression", flag_type=""
)

@validator("e")
@validator("e", always=True)
def validate_e(cls, e: str, values: Dict[str, Any]) -> str:
if e == "":
return values["lute_config"].experiment
return e

@validator("r")
@validator("r", always=True)
def validate_r(cls, r: int, values: Dict[str, Any]) -> int:
if r == -1:
return values["lute_config"].run
6 changes: 3 additions & 3 deletions lute/io/models/sfx_index.py
Original file line number Diff line number Diff line change
@@ -423,7 +423,7 @@ class ConcatenateStreamFilesParameters(TaskParameters):
description="Path to merged output stream file.",
)

@validator("in_file")
@validator("in_file", always=True)
def validate_in_file(cls, in_file: str, values: Dict[str, Any]) -> str:
if in_file == "":
stream_file: Optional[str] = read_latest_db_entry(
@@ -434,7 +434,7 @@ def validate_in_file(cls, in_file: str, values: Dict[str, Any]) -> str:
return stream_dir
return in_file

@validator("tag")
@validator("tag", always=True)
def validate_tag(cls, tag: str, values: Dict[str, Any]) -> str:
if tag == "":
stream_file: Optional[str] = read_latest_db_entry(
@@ -445,7 +445,7 @@ def validate_tag(cls, tag: str, values: Dict[str, Any]) -> str:
return stream_tag
return tag

@validator("out_file")
@validator("out_file", always=True)
def validate_out_file(cls, tag: str, values: Dict[str, Any]) -> str:
if tag == "":
stream_out_file: str = str(
14 changes: 7 additions & 7 deletions lute/io/models/sfx_merge.py
Original file line number Diff line number Diff line change
@@ -290,7 +290,7 @@ class Config(BaseBinaryParameters.Config):
flag_type="--",
)

@validator("in_files")
@validator("in_files", always=True)
def validate_in_files(cls, in_files: str, values: Dict[str, Any]) -> str:
if in_files == "":
partialator_file: Optional[str] = read_latest_db_entry(
@@ -301,7 +301,7 @@ def validate_in_files(cls, in_files: str, values: Dict[str, Any]) -> str:
return hkls
return in_files

@validator("cell_file")
@validator("cell_file", always=True)
def validate_cell_file(cls, cell_file: str, values: Dict[str, Any]) -> str:
if cell_file == "":
idx_cell_file: Optional[str] = read_latest_db_entry(
@@ -314,7 +314,7 @@ def validate_cell_file(cls, cell_file: str, values: Dict[str, Any]) -> str:
return idx_cell_file
return cell_file

@validator("symmetry")
@validator("symmetry", always=True)
def validate_symmetry(cls, symmetry: str, values: Dict[str, Any]) -> str:
if symmetry == "":
partialator_sym: Optional[str] = read_latest_db_entry(
@@ -324,7 +324,7 @@ def validate_symmetry(cls, symmetry: str, values: Dict[str, Any]) -> str:
return partialator_sym
return symmetry

@validator("shell_file")
@validator("shell_file", always=True)
def validate_shell_file(cls, shell_file: str, values: Dict[str, Any]) -> str:
if shell_file == "":
partialator_file: Optional[str] = read_latest_db_entry(
@@ -444,7 +444,7 @@ class Config(BaseBinaryParameters.Config):
flag_type="--",
)

@validator("in_file")
@validator("in_file", always=True)
def validate_in_file(cls, in_file: str, values: Dict[str, Any]) -> str:
if in_file == "":
partialator_file: Optional[str] = read_latest_db_entry(
@@ -454,7 +454,7 @@ def validate_in_file(cls, in_file: str, values: Dict[str, Any]) -> str:
return partialator_file
return in_file

@validator("out_file")
@validator("out_file", always=True)
def validate_out_file(cls, out_file: str, values: Dict[str, Any]) -> str:
if out_file == "":
partialator_file: Optional[str] = read_latest_db_entry(
@@ -466,7 +466,7 @@ def validate_out_file(cls, out_file: str, values: Dict[str, Any]) -> str:
return mtz_out
return out_file

@validator("cell_file")
@validator("cell_file", always=True)
def validate_cell_file(cls, cell_file: str, values: Dict[str, Any]) -> str:
if cell_file == "":
idx_cell_file: Optional[str] = read_latest_db_entry(
6 changes: 3 additions & 3 deletions lute/io/models/sfx_solve.py
Original file line number Diff line number Diff line change
@@ -176,7 +176,7 @@ class DimpleSolveParameters(BaseBinaryParameters):
rename_param="ItoF-prog",
)

@validator("in_file")
@validator("in_file", always=True)
def validate_in_file(cls, in_file: str, values: Dict[str, Any]) -> str:
if in_file == "":
get_hkl_file: Optional[str] = read_latest_db_entry(
@@ -186,7 +186,7 @@ def validate_in_file(cls, in_file: str, values: Dict[str, Any]) -> str:
return get_hkl_file
return in_file

@validator("out_dir")
@validator("out_dir", always=True)
def validate_out_dir(cls, out_dir: str, values: Dict[str, Any]) -> str:
if out_dir == "":
get_hkl_file: Optional[str] = read_latest_db_entry(
@@ -220,7 +220,7 @@ class RunSHELXCParameters(BaseBinaryParameters):
flag_type="",
)

@validator("in_file")
@validator("in_file", always=True)
def validate_in_file(cls, in_file: str, values: Dict[str, Any]) -> str:
if in_file == "":
# get_hkl needed to be run to produce an XDS format file...

0 comments on commit 5a8416e

Please sign in to comment.