Allow lshift to operate on any library. If only one name, return it, else None
This commit is contained in:
parent
7cc732248e
commit
4a94259249
@ -587,8 +587,13 @@ class MutableLibrary(Library, MutableMapping[str, 'Pattern'], metaclass=ABCMeta)
|
||||
self.add(tree.library, rename_theirs=rename_theirs)
|
||||
return name
|
||||
|
||||
def __lshift__(self, other: 'Tree') -> str:
|
||||
return self.add_tree(other)
|
||||
def __lshift__(self, other: Mapping[str, 'Pattern']) -> Optional[str]:
|
||||
if isinstance(other, Tree):
|
||||
return self.add_tree(other) # Add library and return topcell name
|
||||
|
||||
name = next(other.keys()) if len(other) == 1 else None # If only one name, return it
|
||||
lib.add(other)
|
||||
return name
|
||||
|
||||
def dedup(
|
||||
self: ML,
|
||||
|
Loading…
Reference in New Issue
Block a user