Skip to content

Commit f6e4bc3

Browse files
committed
Fix mypy issues
1 parent 603ff70 commit f6e4bc3

5 files changed

Lines changed: 24 additions & 24 deletions

File tree

sdk/basyx/aas/adapter/json/json_deserialization.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,8 @@ def _amend_abstract_attributes(cls, obj: object, dct: Dict[str, object]) -> None
340340
data_specification_content=_get_ts(
341341
dspec,
342342
"dataSpecificationContent",
343-
model.DataSpecificationContent,
344-
), # type: ignore
343+
model.DataSpecificationContent, # type: ignore
344+
),
345345
)
346346
)
347347
if isinstance(obj, model.HasExtension) and not cls.stripped:
@@ -752,8 +752,8 @@ def _construct_basic_event_element(
752752
ret = object_class(
753753
id_short=None,
754754
observed=cls._construct_model_reference(
755-
_get_ts(dct, "observed", dict), model.Referable
756-
), # type: ignore
755+
_get_ts(dct, "observed", dict), model.Referable # type: ignore
756+
),
757757
direction=DIRECTION_INVERSE[_get_ts(dct, "direction", str)],
758758
state=STATE_OF_EVENT_INVERSE[_get_ts(dct, "state", str)],
759759
)

sdk/basyx/aas/adapter/xml/xml_deserialization.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,8 +667,8 @@ def _construct_referable_reference(
667667
# TODO: remove the following type: ignore comments when mypy supports abstract types for Type[T]
668668
# see https://github.com/python/mypy/issues/5374
669669
return cls.construct_model_reference_expect_type(
670-
element, model.Referable, **kwargs
671-
) # type: ignore
670+
element, model.Referable, **kwargs # type: ignore
671+
)
672672

673673
@classmethod
674674
def _construct_operation_variable(

sdk/basyx/aas/examples/data/_helper.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ def _check_submodel_element(
130130
return self.check_property_equal(object_, expected_object) # type: ignore
131131
if isinstance(object_, model.MultiLanguageProperty):
132132
return self.check_multi_language_property_equal(
133-
object_, expected_object
134-
) # type: ignore
133+
object_, expected_object # type: ignore
134+
)
135135
if isinstance(object_, model.Range):
136136
return self.check_range_equal(object_, expected_object) # type: ignore
137137
if isinstance(object_, model.Blob):
@@ -142,14 +142,14 @@ def _check_submodel_element(
142142
return self.check_reference_element_equal(object_, expected_object) # type: ignore
143143
if isinstance(object_, model.SubmodelElementCollection):
144144
return self.check_submodel_element_collection_equal(
145-
object_, expected_object
146-
) # type: ignore
145+
object_, expected_object # type: ignore
146+
)
147147
if isinstance(object_, model.SubmodelElementList):
148148
return self.check_submodel_element_list_equal(object_, expected_object) # type: ignore
149149
if isinstance(object_, model.AnnotatedRelationshipElement):
150150
return self.check_annotated_relationship_element_equal(
151-
object_, expected_object
152-
) # type: ignore
151+
object_, expected_object # type: ignore
152+
)
153153
if isinstance(object_, model.RelationshipElement):
154154
return self.check_relationship_element_equal(object_, expected_object) # type: ignore
155155
if isinstance(object_, model.Operation):
@@ -1200,8 +1200,8 @@ def _check_data_specification_iec61360_equal(
12001200
value=expected_value.value_list,
12011201
):
12021202
self._check_value_list_equal(
1203-
object_.value_list, expected_value.value_list
1204-
) # type: ignore
1203+
object_.value_list, expected_value.value_list # type: ignore
1204+
)
12051205

12061206
if object_.value_list is not None:
12071207
if self.check(
@@ -1210,8 +1210,8 @@ def _check_data_specification_iec61360_equal(
12101210
value=len(object_.value_list),
12111211
):
12121212
self._check_value_list_equal(
1213-
object_.value_list, expected_value.value_list
1214-
) # type: ignore
1213+
object_.value_list, expected_value.value_list # type: ignore
1214+
)
12151215

12161216
def _check_value_list_equal(
12171217
self, object_: model.ValueList, expected_value: model.ValueList
@@ -1361,8 +1361,8 @@ def check_attribute_equal(
13611361
return self.check(
13621362
getattr(object_, attribute_name) is expected_value, # type:ignore
13631363
"Attribute {} of {} must be == {}".format(
1364-
attribute_name, repr(object_), expected_value.__name__
1365-
), # type:ignore
1364+
attribute_name, repr(object_), expected_value.__name__ # type:ignore
1365+
),
13661366
**kwargs,
13671367
)
13681368
else:

sdk/basyx/aas/model/submodel.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -948,15 +948,15 @@ def _check_constraints(self, new: _SE, existing: Iterable[_SE]) -> None:
948948
# Ignore the types here because the typechecker doesn't get it.
949949
if (
950950
self.type_value_list_element in (Property, Range)
951-
and new.value_type is not self.value_type_list_element
952-
): # type: ignore
951+
and new.value_type is not self.value_type_list_element # type: ignore
952+
):
953953
raise base.AASConstraintViolation(
954954
109,
955955
"All first level elements must have the value_type " # type: ignore
956956
"specified by value_type_list_element="
957957
f"{self.value_type_list_element.__name__}, got " # type: ignore
958-
f"{new!r} with value_type={new.value_type.__name__}",
959-
) # type: ignore
958+
f"{new!r} with value_type={new.value_type.__name__}", # type: ignore
959+
)
960960

961961
# If semantic_id_list_element is not None that would already enforce the semantic_id for all first level
962962
# elements. Thus, we only need to perform this check if semantic_id_list_element is None.

sdk/test/model/test_datatypes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,8 @@ def test_float(self) -> None:
605605
5300, model.datatypes.from_xsd("5.3E3", model.datatypes.Double)
606606
)
607607
self.assertTrue(
608-
math.isnan(model.datatypes.from_xsd("NaN", model.datatypes.Double))
609-
) # type: ignore
608+
math.isnan(model.datatypes.from_xsd("NaN", model.datatypes.Double)) # type: ignore
609+
)
610610
self.assertEqual(
611611
float("inf"), model.datatypes.from_xsd("INF", model.datatypes.Double)
612612
)

0 commit comments

Comments
 (0)