Skip to content

Commit

Permalink
fix(gen): clarify some ValueDataType hints
Browse files Browse the repository at this point in the history
  • Loading branch information
JGrothoff committed Jan 16, 2025
1 parent 75de266 commit cb49285
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/pdf2aas/generator/aas.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
def cast_property( # noqa: C901, PLR0911
value: Any,
definition: PropertyDefinition | None = None,
) -> model.ValueDataType:
) -> model.ValueDataType | None:
"""Cast a value to an XSD DataType from the AAS module.
Uses the definition.type if given and type() casts to find the type.
Currently only Boolean, String, Integer and Float target types are supported.
Returns None, if value is None.
"""
if value is None:
return None
Expand Down
4 changes: 2 additions & 2 deletions src/pdf2aas/generator/aas_technical_data_submodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def _create_submodel_template(self) -> model.Submodel:
model.Property(
id_short="ValidDate",
value_type=model.datatypes.Date,
value=datetime.now(tz=timezone.utc).date(),
value=datetime.now(tz=timezone.utc).date(), # type: ignore [arg-type]
category="PARAMETER",
semantic_id=self._create_semantic_id(
"https://admin-shell.io/ZVEI/TechnicalData/ValidDate/1/1",
Expand Down Expand Up @@ -415,7 +415,7 @@ def _create_aas_property_smc(
def _create_aas_property_recursive(
self,
property_: Property,
value: model.ValueDataType,
value: model.ValueDataType | None,
id_short: str,
display_name: model.MultiLanguageNameType | None,
description: model.MultiLanguageTextType | None,
Expand Down

0 comments on commit cb49285

Please sign in to comment.