master > master: code py - bessere Baum-Ausgabe
This commit is contained in:
parent
61e49f19e0
commit
969a880440
@ -46,7 +46,7 @@ class Alignment():
|
||||
indent: str = ' ',
|
||||
prefix: str = '',
|
||||
braces: bool = False,
|
||||
branch: str = '|____ ',
|
||||
branch: str = ' └──── ',
|
||||
) -> str:
|
||||
return '\n'.join(list(self._astree_recursion(indent=indent, prefix=prefix, braces=braces, branch=branch)));
|
||||
|
||||
@ -56,19 +56,24 @@ class Alignment():
|
||||
indent: str = ' ',
|
||||
prefix: str = '',
|
||||
braces: bool = False,
|
||||
branch: str = '|____ ',
|
||||
branch: str = ' └──── ',
|
||||
branch_atom: str = '˚└──── ',
|
||||
) -> Generator[str, None, None]:
|
||||
word1 = self.as_string1(braces=braces);
|
||||
word2 = self.as_string2(braces=braces);
|
||||
if isinstance(self, AlignmentBasic):
|
||||
u = prefix + branch if depth > 0 else prefix;
|
||||
u = prefix + branch_atom if depth > 0 else prefix;
|
||||
yield f'{u}{word2}';
|
||||
if depth == 0:
|
||||
yield f'{" "*len(u)}{"-"*len(word1)}';
|
||||
yield f'{" "*len(u)}{word1}';
|
||||
elif isinstance(self, AlignmentPair):
|
||||
u = prefix + branch if depth > 0 else prefix;
|
||||
yield f'{u}{word2}';
|
||||
if depth == 0:
|
||||
yield f'{" "*len(u)}{"-"*len(word1)}';
|
||||
yield f'{" "*len(u)}{word1}';
|
||||
yield '';
|
||||
yield f'{indent}{prefix} │';
|
||||
yield from self.left._astree_recursion(
|
||||
depth = depth + 1,
|
||||
indent = indent,
|
||||
|
Loading…
x
Reference in New Issue
Block a user