Island: Add ConnectionTarget TypeAlias
This commit is contained in:
parent
3b2954ec02
commit
b33fd7f436
|
@ -11,5 +11,5 @@ from .simulation import Simulation, SimulationSchema, IslandMode
|
|||
from .user_credentials import UserCredentials
|
||||
from .machine import Machine, MachineID
|
||||
from .communication_type import CommunicationType
|
||||
from .node import Node
|
||||
from .node import Node, ConnectionTarget
|
||||
from .agent import Agent, AgentID
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from typing import Sequence, Tuple
|
||||
from typing import Collection, Sequence, Tuple, TypeAlias
|
||||
|
||||
from pydantic import Field, validator
|
||||
|
||||
|
@ -7,12 +7,12 @@ from common.transforms import make_immutable_nested_sequence
|
|||
|
||||
from . import CommunicationType, MachineID
|
||||
|
||||
ConnectionsSequence = Sequence[Tuple[MachineID, Sequence[CommunicationType]]]
|
||||
ConnectionTarget: TypeAlias = Tuple[MachineID, Sequence[CommunicationType]]
|
||||
|
||||
|
||||
class Node(MutableInfectionMonkeyBaseModel):
|
||||
machine_id: MachineID = Field(..., allow_mutation=False)
|
||||
connections: ConnectionsSequence
|
||||
connections: Collection[ConnectionTarget]
|
||||
|
||||
_make_immutable_nested_sequence = validator("connections", pre=True, allow_reuse=True)(
|
||||
make_immutable_nested_sequence
|
||||
|
|
Loading…
Reference in New Issue