add Pather.mk()

This commit is contained in:
Jan Petykiewicz 2023-02-04 09:06:31 -08:00 committed by jan
parent 460222ce6e
commit 98728521fd

View File

@ -604,6 +604,19 @@ class Pather(Builder):
if name is not None: if name is not None:
library[name] = self.pattern library[name] = self.pattern
@classmethod
def mk(
cls,
library: MutableLibrary,
base_name: str,
*,
ports: Union[None, str, Mapping[str, Port]] = None,
tools: Union[None, Tool, MutableMapping[Optional[str], Tool]] = None,
) -> Tuple['Pather', str]:
""" Name-and-make combination """
pat = library.create(base_name)
pather = Pather(library, pattern=pat, ports=ports, tools=tools)
return pather, pat.name
@classmethod @classmethod
def from_builder( def from_builder(