Skip to content

Commit

Permalink
model.KeyTypes: Ignore mypy errors for abstract classes to be compliant
Browse files Browse the repository at this point in the history
Mypy appears to not like abstract classes in a context where only
concrete classes should be given:

```
Only concrete class can be given where
"tuple[type[Referable], KeyTypes]" is expected
```

However, the spec demands the four abstract classes
- `Event`
- `DataElement`
- `SubmodelElement`
- `SubmodelElementCollection`

to appear inside the `model.KeyTypes` Enum.
Therefore, we ignore these errors via `# type: ignore`.
  • Loading branch information
s-heppner committed Aug 22, 2023
1 parent 9dd5a87 commit fde3776
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions basyx/aas/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
ConceptDictionary: KeyElements.CONCEPT_DICTIONARY,
Entity: KeyElements.ENTITY,
BasicEvent: KeyElements.BASIC_EVENT,
Event: KeyElements.EVENT,
Event: KeyElements.EVENT, # type: ignore
Blob: KeyElements.BLOB,
File: KeyElements.FILE,
Operation: KeyElements.OPERATION,
Expand All @@ -62,9 +62,9 @@
MultiLanguageProperty: KeyElements.MULTI_LANGUAGE_PROPERTY,
Range: KeyElements.RANGE,
ReferenceElement: KeyElements.REFERENCE_ELEMENT,
DataElement: KeyElements.DATA_ELEMENT,
SubmodelElementCollection: KeyElements.SUBMODEL_ELEMENT_COLLECTION,
DataElement: KeyElements.DATA_ELEMENT, # type: ignore
SubmodelElementCollection: KeyElements.SUBMODEL_ELEMENT_COLLECTION, # type: ignore
AnnotatedRelationshipElement: KeyElements.ANNOTATED_RELATIONSHIP_ELEMENT,
RelationshipElement: KeyElements.RELATIONSHIP_ELEMENT,
SubmodelElement: KeyElements.SUBMODEL_ELEMENT,
SubmodelElement: KeyElements.SUBMODEL_ELEMENT, # type: ignore
}

0 comments on commit fde3776

Please sign in to comment.