add mktree
This commit is contained in:
parent
f0a71bfb8b
commit
31cf0047e7
1 changed files with 11 additions and 0 deletions
|
|
@ -887,6 +887,17 @@ class Library(ILibrary):
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
return f'<Library ({type(self.mapping)}) with keys\n' + pformat(list(self.keys())) + '>'
|
return f'<Library ({type(self.mapping)}) with keys\n' + pformat(list(self.keys())) + '>'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def mktree(cls, name: str) -> tuple['Tree', 'Pattern']:
|
||||||
|
"""
|
||||||
|
Create a new Library and immediately add a pattern
|
||||||
|
"""
|
||||||
|
from .pattern import Pattern
|
||||||
|
tree = cls()
|
||||||
|
pat = Pattern()
|
||||||
|
tree[name] = pat
|
||||||
|
return tree, pat
|
||||||
|
|
||||||
|
|
||||||
class LazyLibrary(ILibrary):
|
class LazyLibrary(ILibrary):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue