Skip to content

Commit

Permalink
Allow reuse of validators to make python3.8 happy
Browse files Browse the repository at this point in the history
  • Loading branch information
giffels committed Feb 28, 2022
1 parent 96d4cc1 commit 856a6e7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tardis/adapters/sites/moab.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class MoabAdapterConfigurationModel(SiteAdapterBaseModel):
StatusUpdate: PositiveInt
StartupCommand: Optional[str] = None

@root_validator()
@root_validator(allow_reuse=True)
def deprecate_startup_command(
cls, valuesDict: [str, Any] # noqa B902
) -> Dict[str, Any]:
Expand Down
2 changes: 1 addition & 1 deletion tardis/adapters/sites/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class SlurmAdapterConfigurationModel(SiteAdapterBaseModel):
StatusUpdate: PositiveInt
StartupCommand: Optional[str] = None

@root_validator()
@root_validator(allow_reuse=True)
def deprecate_startup_command(
cls, valuesDict: [str, Any] # noqa B902
) -> Dict[str, Any]:
Expand Down
4 changes: 3 additions & 1 deletion tardis/interfaces/siteadapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ class SiteAdapterBaseModel(BaseModel):
class Config:
arbitrary_types_allowed = True

@root_validator(skip_on_failure=True) # skip if previous validator failed
@root_validator(
skip_on_failure=True, allow_reuse=True
) # skip if previous validator failed
def validate(cls, values: Dict[str, Any]) -> Dict[str, Any]: # noqa B902
"""
Validate that MachineTypeConfiguration and MachineMetaData is available
Expand Down

0 comments on commit 856a6e7

Please sign in to comment.