From 6b3829dc48175d5711b771bf777ddceb4dec8002 Mon Sep 17 00:00:00 2001 From: Chris McCarthy Date: Fri, 9 Feb 2024 11:37:47 +0000 Subject: [PATCH] #2248 - Removed redundant Union from single type params --- src/primaite/simulator/network/container.py | 6 ++---- src/primaite/simulator/network/hardware/base.py | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/primaite/simulator/network/container.py b/src/primaite/simulator/network/container.py index 2ea2a7fa..b32d2630 100644 --- a/src/primaite/simulator/network/container.py +++ b/src/primaite/simulator/network/container.py @@ -1,4 +1,4 @@ -from typing import Any, Dict, List, Optional, Union +from typing import Any, Dict, List, Optional import matplotlib.pyplot as plt import networkx as nx @@ -272,9 +272,7 @@ class Network(SimComponent): self._node_request_manager.remove_request(name=node.hostname) _LOGGER.info(f"Removed node {node.hostname} from network {self.uuid}") - def connect( - self, endpoint_a: Union[WiredNetworkInterface], endpoint_b: Union[WiredNetworkInterface], **kwargs - ) -> Optional[Link]: + def connect(self, endpoint_a: WiredNetworkInterface, endpoint_b: WiredNetworkInterface, **kwargs) -> Optional[Link]: """ Connect two endpoints on the network by creating a link between their NICs/SwitchPorts. diff --git a/src/primaite/simulator/network/hardware/base.py b/src/primaite/simulator/network/hardware/base.py index f5bd5ff5..55640121 100644 --- a/src/primaite/simulator/network/hardware/base.py +++ b/src/primaite/simulator/network/hardware/base.py @@ -509,9 +509,9 @@ class Link(SimComponent): :param bandwidth: The bandwidth of the Link in Mbps (default is 100 Mbps). """ - endpoint_a: Union[WiredNetworkInterface] + endpoint_a: WiredNetworkInterface "The first WiredNetworkInterface connected to the Link." - endpoint_b: Union[WiredNetworkInterface] + endpoint_b: WiredNetworkInterface "The second WiredNetworkInterface connected to the Link." bandwidth: float = 100.0 "The bandwidth of the Link in Mbps (default is 100 Mbps)." @@ -596,7 +596,7 @@ class Link(SimComponent): return True return False - def transmit_frame(self, sender_nic: Union[WiredNetworkInterface], frame: Frame) -> bool: + def transmit_frame(self, sender_nic: WiredNetworkInterface, frame: Frame) -> bool: """ Send a network frame from one NIC or SwitchPort to another connected NIC or SwitchPort.