net.py
1 # SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-or-later OR CERN-OHL-S-2.0+ OR Apache-2.0 2 import abc 3 from typing import Type, Tuple, Union 4 5 from .. import _util 6 7 8 __all__ = ["NetT", "Nets"] 9 10 11 class _Net(abc.ABC): 12 @abc.abstractmethod 13 def __init__(self, name: str): 14 self.name = name 15 16 def __eq__(self, other: object) -> bool: 17 return isinstance(other, _Net) and (self.name == other.name) 18 19 def __hash__(self) -> int: 20 return hash(self.name) 21 22 def __repr__(self) -> str: 23 return f"{self.__class__.__name__}({self.name})" 24 NetT = _Net 25 26 27 Nets =_util.ExtendedListStrMapping[_Net]