Skip to content

Commit 81f19cc

Browse files
committed
Simplify Optional type annotations in models
Replaces 'Optional[Optional[T]]' with 'Optional[T]' in multiple model fields to clean up type annotations and improve code clarity. No functional changes; this refactor streamlines the codebase and reduces redundancy.
1 parent 2fca2ec commit 81f19cc

1 file changed

Lines changed: 29 additions & 29 deletions

File tree

pyenzyme/versions/v2.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,15 @@ class EnzymeMLDocument(BaseModel):
116116
default="2",
117117
description="""The version of the EnzymeML Document.""",
118118
)
119-
description: Optional[Optional[str]] = Field(
119+
description: Optional[str] = Field(
120120
default=None,
121121
description="""Description of the EnzymeML Document.""",
122122
)
123-
created: Optional[Optional[str]] = Field(
123+
created: Optional[str] = Field(
124124
default=None,
125125
description="""Date the EnzymeML Document was created.""",
126126
)
127-
modified: Optional[Optional[str]] = Field(
127+
modified: Optional[str] = Field(
128128
default=None,
129129
description="""Date the EnzymeML Document was modified.""",
130130
)
@@ -870,24 +870,24 @@ class Protein(BaseModel):
870870
constant through the experiment or not.
871871
Default is True.""",
872872
)
873-
sequence: Optional[Optional[str]] = Field(
873+
sequence: Optional[str] = Field(
874874
default=None,
875875
description="""Amino acid sequence of the protein""",
876876
)
877-
vessel_id: Optional[Optional[str]] = Field(
877+
vessel_id: Optional[str] = Field(
878878
default=None,
879879
description="""Identifier of the vessel this protein has been
880880
applied to.""",
881881
)
882-
ecnumber: Optional[Optional[str]] = Field(
882+
ecnumber: Optional[str] = Field(
883883
default=None,
884884
description="""EC number of the protein.""",
885885
)
886-
organism: Optional[Optional[str]] = Field(
886+
organism: Optional[str] = Field(
887887
default=None,
888888
description="""Expression host organism of the protein.""",
889889
)
890-
organism_tax_id: Optional[Optional[str]] = Field(
890+
organism_tax_id: Optional[str] = Field(
891891
default=None,
892892
description="""Taxonomy identifier of the expression host.""",
893893
)
@@ -1019,7 +1019,7 @@ class Complex(BaseModel):
10191019
constant through the experiment or not.
10201020
Default is False.""",
10211021
)
1022-
vessel_id: Optional[Optional[str]] = Field(
1022+
vessel_id: Optional[str] = Field(
10231023
default=None,
10241024
description="""Unique identifier of the vessel this complex has
10251025
been used in.""",
@@ -1148,23 +1148,23 @@ class SmallMolecule(BaseModel):
11481148
is constant through the experiment or not.
11491149
Default is False.""",
11501150
)
1151-
vessel_id: Optional[Optional[str]] = Field(
1151+
vessel_id: Optional[str] = Field(
11521152
default=None,
11531153
description="""Identifier of the vessel this small molecule has
11541154
been used in.""",
11551155
)
1156-
canonical_smiles: Optional[Optional[str]] = Field(
1156+
canonical_smiles: Optional[str] = Field(
11571157
default=None,
11581158
description="""Canonical Simplified Molecular-Input Line-Entry
11591159
System (SMILES) encoding of the small
11601160
molecule.""",
11611161
)
1162-
inchi: Optional[Optional[str]] = Field(
1162+
inchi: Optional[str] = Field(
11631163
default=None,
11641164
description="""International Chemical Identifier (InChI) encoding
11651165
of the small molecule.""",
11661166
)
1167-
inchikey: Optional[Optional[str]] = Field(
1167+
inchikey: Optional[str] = Field(
11681168
default=None,
11691169
description="""Hashed International Chemical Identifier
11701170
(InChIKey) encoding of the small molecule.""",
@@ -1297,7 +1297,7 @@ class Reaction(BaseModel):
12971297
description="""Whether the reaction is reversible or
12981298
irreversible. Default is False.""",
12991299
)
1300-
kinetic_law: Optional[Optional[Equation]] = Field(
1300+
kinetic_law: Optional[Equation] = Field(
13011301
default=None,
13021302
description="""Mathematical expression of the reaction.""",
13031303
)
@@ -1966,30 +1966,30 @@ class Parameter(BaseModel):
19661966
default=...,
19671967
description="""Equation symbol of the parameter.""",
19681968
)
1969-
value: Optional[Optional[float]] = Field(
1969+
value: Optional[float] = Field(
19701970
default=None,
19711971
description="""Numerical value of the estimated parameter.""",
19721972
)
1973-
unit: Optional[Optional[UnitDefinitionAnnot]] = Field(
1973+
unit: Optional[UnitDefinitionAnnot] = Field(
19741974
default=None,
19751975
description="""Unit of the estimated parameter.""",
19761976
)
1977-
initial_value: Optional[Optional[float]] = Field(
1977+
initial_value: Optional[float] = Field(
19781978
default=None,
19791979
description="""Initial value that was used for the parameter
19801980
estimation.""",
19811981
)
1982-
upper_bound: Optional[Optional[float]] = Field(
1982+
upper_bound: Optional[float] = Field(
19831983
default=None,
19841984
description="""Upper bound for the parameter value that was used
19851985
for the parameter estimation""",
19861986
)
1987-
lower_bound: Optional[Optional[float]] = Field(
1987+
lower_bound: Optional[float] = Field(
19881988
default=None,
19891989
description="""Lower bound for the parameter value that was used
19901990
for the parameter estimation""",
19911991
)
1992-
stderr: Optional[Optional[float]] = Field(
1992+
stderr: Optional[float] = Field(
19931993
default=None,
19941994
description="""Standard error of the estimated parameter.""",
19951995
)
@@ -2108,20 +2108,20 @@ class Measurement(BaseModel):
21082108
of the measurement. A species refers to a
21092109
Protein, Complex, or SmallMolecule.""",
21102110
)
2111-
group_id: Optional[Optional[str]] = Field(
2111+
group_id: Optional[str] = Field(
21122112
default=None,
21132113
description="""User-defined group ID to signal relationships
21142114
between measurements.""",
21152115
)
2116-
ph: Optional[Optional[float]] = Field(
2116+
ph: Optional[float] = Field(
21172117
default=None,
21182118
description="""pH value of the measurement.""",
21192119
)
2120-
temperature: Optional[Optional[float]] = Field(
2120+
temperature: Optional[float] = Field(
21212121
default=None,
21222122
description="""Temperature of the measurement.""",
21232123
)
2124-
temperature_unit: Optional[Optional[UnitDefinitionAnnot]] = Field(
2124+
temperature_unit: Optional[UnitDefinitionAnnot] = Field(
21252125
default=None,
21262126
description="""Unit of the temperature of the measurement.""",
21272127
)
@@ -2272,7 +2272,7 @@ class MeasurementData(BaseModel):
22722272
default=...,
22732273
description="""The identifier for the described reactant.""",
22742274
)
2275-
prepared: Optional[Optional[float]] = Field(
2275+
prepared: Optional[float] = Field(
22762276
default=None,
22772277
description="""Amount of the the species before starting the
22782278
measurement. This field can be used
@@ -2282,13 +2282,13 @@ class MeasurementData(BaseModel):
22822282
concentration of a species at the first
22832283
data point from the array.""",
22842284
)
2285-
initial: Optional[Optional[float]] = Field(
2285+
initial: Optional[float] = Field(
22862286
default=None,
22872287
description="""Initial amount of the measurement data. This must
22882288
be the same as the first data point in
22892289
the array.""",
22902290
)
2291-
data_unit: Optional[Optional[UnitDefinitionAnnot]] = Field(
2291+
data_unit: Optional[UnitDefinitionAnnot] = Field(
22922292
default=None,
22932293
description="""SI unit of the data that was measured.""",
22942294
)
@@ -2300,11 +2300,11 @@ class MeasurementData(BaseModel):
23002300
default_factory=list,
23012301
description="""Corresponding time points of the .""",
23022302
)
2303-
time_unit: Optional[Optional[UnitDefinitionAnnot]] = Field(
2303+
time_unit: Optional[UnitDefinitionAnnot] = Field(
23042304
default=None,
23052305
description="""Unit of the time points of the .""",
23062306
)
2307-
data_type: Optional[Optional[DataTypes]] = Field(
2307+
data_type: Optional[DataTypes] = Field(
23082308
default=None,
23092309
description="""Type of data that was measured (e.g.
23102310
concentration, absorbance, etc.)""",

0 commit comments

Comments
 (0)