Skip to content

Commit

Permalink
ci: Fix mypy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ewuerger committed Jan 31, 2023
1 parent 32fb892 commit 4f86413
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
4 changes: 2 additions & 2 deletions capellambse/model/common/accessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1260,13 +1260,13 @@ class RoleTagAccessor(DirectProxyAccessor[T]):
def __init__(
self,
role_tag: str,
class_: type[T] | None = None,
class_: type[T] | type[element.GenericElement] | None = None,
*,
aslist: type[element.ElementList[T]] | None = None,
list_extra_args: dict[str, t.Any] | None = None,
) -> None:
super().__init__(
class_ or element.GenericElement,
class_ or element.GenericElement, # type:ignore[arg-type]
(),
aslist=aslist,
list_extra_args=list_extra_args,
Expand Down
6 changes: 4 additions & 2 deletions capellambse/model/crosslayer/cs.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class Component(c.GenericElement):
ports = c.DirectProxyAccessor(fa.ComponentPort, aslist=c.ElementList)
physical_ports = c.DirectProxyAccessor(PhysicalPort, aslist=c.ElementList)
parts = c.RoleTagAccessor[Part](
"ownedFeatures", Part, aslist=c.ElementList
"ownedFeatures", Part, aslist=c.ElementList[Part]
)
representing_parts = c.ReferenceSearchingAccessor(
Part, "type", aslist=c.ElementList
Expand Down Expand Up @@ -197,7 +197,9 @@ class ComponentPkg(c.GenericElement):
exchanges = c.DirectProxyAccessor(
fa.ComponentExchange, aslist=c.ElementList
)
parts = c.RoleTagAccessor[Part]("ownedParts", Part, aslist=c.ElementList)
parts = c.RoleTagAccessor[Part](
"ownedParts", Part, aslist=c.ElementList[Part]
)
state_machines = c.DirectProxyAccessor(
capellacommon.StateMachine, aslist=c.ElementList
)
Expand Down
28 changes: 16 additions & 12 deletions capellambse/model/crosslayer/interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ class EventReceiptOperation(EventOperation):
"""An event-receipt operation."""


class InteractionFragment(c.GenericElement):
"""Abstract super class of all interaction fragments in a Scenario."""

covered = c.AttrProxyAccessor[c.GenericElement](
None, "coveredInstanceRoles", aslist=c.MixedElementList
)


@c.xtype_handler(None)
class Scenario(c.GenericElement):
"""A scenario that holds instance roles."""
Expand All @@ -90,20 +98,16 @@ class Scenario(c.GenericElement):
InstanceRole, aslist=c.ElementList
)
messages = c.DirectProxyAccessor(SequenceMessage, aslist=c.ElementList)
events = c.RoleTagAccessor("ownedEvents", aslist=c.MixedElementList)
fragments = c.RoleTagAccessor(
"ownedInteractionFragments", aslist=c.MixedElementList
events = c.RoleTagAccessor[EventOperation](
"ownedEvents", aslist=c.MixedElementList # type: ignore[arg-type]
)
time_lapses = c.RoleTagAccessor(
"ownedTimeLapses", aslist=c.MixedElementList
fragments = c.RoleTagAccessor[InteractionFragment](
"ownedInteractionFragments",
aslist=c.MixedElementList, # type: ignore[arg-type]
)


class InteractionFragment(c.GenericElement):
"""Abstract super class of all interaction fragments in a Scenario."""

covered = c.AttrProxyAccessor[c.GenericElement](
None, "coveredInstanceRoles", aslist=c.MixedElementList
time_lapses = c.RoleTagAccessor[Event](
"ownedTimeLapses",
aslist=c.MixedElementList, # type: ignore[arg-type]
)


Expand Down
2 changes: 1 addition & 1 deletion capellambse/model/layers/oa.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class EntityPkg(cs.ComponentPkg):
entities = c.DirectProxyAccessor(Entity, aslist=c.ElementList)
exchanges = c.DirectProxyAccessor[CommunicationMean](
CommunicationMean, aslist=c.ElementList
) # type: ignore[assignment]
)

packages: c.Accessor

Expand Down

0 comments on commit 4f86413

Please sign in to comment.