-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature normalize and standardize objects (#287)
* Refactored models. Moved common fields to parent classes. Created standardized input and result interface. * Basic models implemented; tests not passing yet * test_model_results passing * test_molutil passing * test_molparse_from_string_passing * test_molecule passing * Set test_molutil back to original state * blacken qcel * Skip --validate tests since they are circular in nature. They test that exported models conform to pydantic's autogenerated schema, which is not necessary to tests. Also, issues arrise with jsonschema which are external to our concerns.
- Loading branch information
Showing
13 changed files
with
336 additions
and
435 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from typing import Any, Dict, Optional | ||
|
||
from pydantic import Field | ||
from typing_extensions import Literal | ||
|
||
|
||
from .qcschema_abc import AutoSetProvenance, QCSchemaModelBase | ||
from .molecule import Molecule | ||
|
||
|
||
class SpecificationBase(AutoSetProvenance): | ||
"""Specification objects contain the keywords and other configurable parameters directed at a particular QC program""" | ||
|
||
keywords: Dict[str, Any] = Field({}, description="The program specific keywords to be used.") | ||
program: str = Field(..., description="The program for which the Specification is intended.") | ||
|
||
|
||
class InputBase(AutoSetProvenance): | ||
"""An Input is composed of a .specification and a .molecule which together fully specify a computation""" | ||
|
||
specification: SpecificationBase = Field(..., description=SpecificationBase.__doc__) | ||
molecule: Molecule = Field(..., description=Molecule.__doc__) | ||
|
||
|
||
class ResultBase(QCSchemaModelBase): | ||
"""Base class for all result classes""" | ||
|
||
input_data: InputBase = Field(..., description=InputBase.__doc__) | ||
success: bool = Field( | ||
..., | ||
description="A boolean indicator that the operation succeeded or failed. Allows programmatic assessment of " | ||
"all results regardless of if they failed or succeeded by checking `result.success`.", | ||
) | ||
|
||
stdout: Optional[str] = Field( | ||
None, | ||
description="The primary logging output of the program, whether natively standard output or a file. Presence vs. absence (or null-ness?) configurable by protocol.", | ||
) | ||
stderr: Optional[str] = Field(None, description="The standard error of the program execution.") | ||
|
||
|
||
class SuccessfulResultBase(ResultBase): | ||
"""Base object for any successful result""" | ||
|
||
success: Literal[True] = Field(True, description="Always `True` for a successful result") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.