From 5a8416eb8c10f341d57fd4d7b09ee25ff306218e Mon Sep 17 00:00:00 2001 From: gadorlhiac Date: Fri, 5 Apr 2024 08:32:02 -0700 Subject: [PATCH] MNT Add always=True to current model validators --- lute/io/models/sfx_find_peaks.py | 6 +++--- lute/io/models/sfx_index.py | 6 +++--- lute/io/models/sfx_merge.py | 14 +++++++------- lute/io/models/sfx_solve.py | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lute/io/models/sfx_find_peaks.py b/lute/io/models/sfx_find_peaks.py index 40b86814..cdad3510 100644 --- a/lute/io/models/sfx_find_peaks.py +++ b/lute/io/models/sfx_find_peaks.py @@ -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 diff --git a/lute/io/models/sfx_index.py b/lute/io/models/sfx_index.py index 901bb0c3..738f4445 100644 --- a/lute/io/models/sfx_index.py +++ b/lute/io/models/sfx_index.py @@ -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( diff --git a/lute/io/models/sfx_merge.py b/lute/io/models/sfx_merge.py index 0fdbad4a..7b4f1304 100644 --- a/lute/io/models/sfx_merge.py +++ b/lute/io/models/sfx_merge.py @@ -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( diff --git a/lute/io/models/sfx_solve.py b/lute/io/models/sfx_solve.py index 02b7c394..5f00c097 100644 --- a/lute/io/models/sfx_solve.py +++ b/lute/io/models/sfx_solve.py @@ -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...