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 three abstract classes
- `EventElement`
- `DataElement`
- `SubmodelElement`

to appear inside the `model.KeyTypes` Enum.
Therefore, we ignore these errors via `# type: ignore`.
  • Loading branch information
s-heppner committed Aug 11, 2023
1 parent af15b0f commit 493d5d3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions basyx/aas/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
Submodel: KeyTypes.SUBMODEL,
Entity: KeyTypes.ENTITY,
BasicEventElement: KeyTypes.BASIC_EVENT_ELEMENT,
EventElement: KeyTypes.EVENT_ELEMENT,
EventElement: KeyTypes.EVENT_ELEMENT, # type: ignore
Blob: KeyTypes.BLOB,
File: KeyTypes.FILE,
Operation: KeyTypes.OPERATION,
Expand All @@ -53,10 +53,10 @@
MultiLanguageProperty: KeyTypes.MULTI_LANGUAGE_PROPERTY,
Range: KeyTypes.RANGE,
ReferenceElement: KeyTypes.REFERENCE_ELEMENT,
DataElement: KeyTypes.DATA_ELEMENT,
DataElement: KeyTypes.DATA_ELEMENT, # type: ignore
SubmodelElementCollection: KeyTypes.SUBMODEL_ELEMENT_COLLECTION,
SubmodelElementList: KeyTypes.SUBMODEL_ELEMENT_LIST,
AnnotatedRelationshipElement: KeyTypes.ANNOTATED_RELATIONSHIP_ELEMENT,
RelationshipElement: KeyTypes.RELATIONSHIP_ELEMENT,
SubmodelElement: KeyTypes.SUBMODEL_ELEMENT,
SubmodelElement: KeyTypes.SUBMODEL_ELEMENT, # type: ignore
}

0 comments on commit 493d5d3

Please sign in to comment.