add lshift operator to MutableLibrary

This commit is contained in:
Jan Petykiewicz 2023-01-31 22:50:10 -08:00
parent c69081331c
commit 482ca058bb

View File

@ -587,6 +587,9 @@ class MutableLibrary(Library, MutableMapping[str, 'Pattern'], metaclass=ABCMeta)
self.add(tree.library, rename_theirs=rename_theirs) self.add(tree.library, rename_theirs=rename_theirs)
return name return name
def __lshift__(self, other: 'Tree') -> str:
return self.add_tree(other)
def dedup( def dedup(
self: ML, self: ML,
norm_value: int = int(1e6), norm_value: int = int(1e6),
@ -1031,9 +1034,6 @@ class Tree(MutableLibrary):
def __delitem__(self, key: str) -> None: def __delitem__(self, key: str) -> None:
del self.library[key] del self.library[key]
def __lshift__(self, other: 'Tree') -> str:
return self.add_tree(other)
def _rename_patterns(lib: Library, name: str) -> str: def _rename_patterns(lib: Library, name: str) -> str:
# TODO document rename function # TODO document rename function