-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
65d0b95
commit 3a06893
Showing
11 changed files
with
106 additions
and
39 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from autoflex.types.property import PhysicalProperty, Property, AutoflexPropertyTypes | ||
from autoflex.types.property import PhysicalProperty, Property, PropertyTypes | ||
from autoflex.types.descriptors import Symbolic, SymbolicTypes, Unit, UnitTypes | ||
from autoflex.types.field import AutoflexFieldInfo, FieldTypes | ||
from autoflex.types.field import PhysicalFieldInfo, FieldTypes |
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 |
---|---|---|
@@ -1,14 +1,20 @@ | ||
import pydantic as pd | ||
from autoflex.types.property import AutoflexPropertyTypes | ||
from autoflex.types.descriptors import UnitTypes, SymbolicTypes | ||
|
||
class AutoflexFieldInfo(pd.fields.FieldInfo): | ||
class PhysicalFieldInfo(pd.fields.FieldInfo): | ||
""" | ||
Each field should correspond to an individual parameter field that can represent it completely within the documentation. | ||
Each field should correspond to an individual physical property field that can represent it completely within the documentation. | ||
Note that this compiles into a PhysicalProperty accordingly. | ||
""" | ||
|
||
unit: UnitTypes = None | ||
""" | ||
json_schema_extra: dict = None | ||
""" | ||
TODO overwrite this with the supported attributes from the given properties. | ||
|
||
math: SymbolicTypes = None | ||
""" | ||
""" | ||
|
||
|
||
FieldTypes = AutoflexFieldInfo | pd.fields.FieldInfo | ||
FieldTypes = PhysicalFieldInfo | pd.fields.FieldInfo |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
from autoflex.types import AutoflexPropertyTypes | ||
from autoflex.types import PropertyTypes | ||
|
||
PropertyCollectionTable = list[AutoflexPropertyTypes] | ||
PropertyCollectionTable = list[PropertyTypes] | ||
""" | ||
A property table can be compiled from a list of compiled AutoflexProperties in a standard data type format. | ||
""" |
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,10 @@ | ||
import pydantic as pd | ||
|
||
def determine_pydantic_version_from_base_model(model: pd.BaseModel): | ||
"""Determine if a BaseModel is from Pydantic v1 or v2.""" | ||
if hasattr(model, 'model_fields'): | ||
return 2 | ||
elif hasattr(model, '__fields__'): | ||
return 1 | ||
else: | ||
raise ValueError("Unknown Pydantic version or incompatible BaseModel class.") |
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,5 @@ | ||
|
||
|
||
.. code:: | ||
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