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 b01ca57
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 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
24 changes: 13 additions & 11 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,23 +98,17 @@ 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(
events = c.RoleTagAccessor[EventOperation](
"ownedEvents", aslist=c.MixedElementList
)
fragments = c.RoleTagAccessor[InteractionFragment](
"ownedInteractionFragments", aslist=c.MixedElementList
)
time_lapses = c.RoleTagAccessor(
time_lapses = c.RoleTagAccessor[Event](
"ownedTimeLapses", aslist=c.MixedElementList
)


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 ExecutionEnd(InteractionFragment):
event = c.AttrProxyAccessor[Event](None, "event")
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 b01ca57

Please sign in to comment.