library can generate abstracts

This commit is contained in:
Jan Petykiewicz 2023-01-23 22:34:58 -08:00 committed by jan
parent e288c3f5e0
commit 0368cf7a00

View File

@ -22,6 +22,7 @@ from .label import Label
if TYPE_CHECKING:
from .pattern import Pattern
from .builder import Abstract
logger = logging.getLogger(__name__)
@ -41,6 +42,9 @@ class Library(Mapping[str, Pattern], metaclass=ABCMeta):
#__contains__, keys, items, values, get, __eq__, __ne__ supplied by Mapping
def abstract(self, name: str) -> 'Abstract':
return Abstract(name=name, ports=self[name].ports)
def __repr__(self) -> str:
return '<Library with keys ' + repr(list(self.keys())) + '>'