lshift operator shouldn't special-case trees

Instead, just call .tops() if there are multiple cells, and fail if
there are multiple tops
master
jan 1 year ago
parent 0efd9afd16
commit d7e89ef5c8

@ -586,13 +586,18 @@ class MutableLibrary(Library, MutableMapping[str, 'Pattern'], metaclass=ABCMeta)
return rename_map.get(name, name)
def __lshift__(self, other: Mapping[str, 'Pattern']) -> str:
if isinstance(other, Tree):
return self.add_tree(other) # Add library and return topcell name
# if isinstance(other, Tree):
# return self.add_tree(other) # Add library and return topcell name
if len(other) != 1:
raise LibraryError('Received a non-Tree library containing multiple cells')
if len(other) == 1:
name = next(iter(other))
else:
tops = other.tops()
if len(other.tops()) > 1:
raise LibraryError('Received a library containing multiple topcells!')
name = tops[0]
name = next(iter(other))
rename_map = self.add(other)
return rename_map.get(name, name)

Loading…
Cancel
Save