Formatter for pretty printing: Module fmt

class pyrser.fmt.indentable[source]

Bases: object

base of all fmt objects

char_indent = ' '
num_indent = 4
__init__(self)[source]
to_str(self, res: str) → str[source]
__str__(self)[source]
lsdata
set_indent(self, indent: int= 1)[source]
pyrser.fmt.catend(dst: str, src: str, indent) → str[source]

cat two strings but handle for tabulation

pyrser.fmt.list_set_indent(lst: list, indent: int= 1)[source]

recurs into list for indentation

pyrser.fmt.list_to_str(lst: list, content: str, indent: int= 1)[source]

recurs into list for string computing

class pyrser.fmt.block(beginby: str, endby: str, lsdata: list)[source]

Bases: pyrser.fmt.indentable

for {}, (), []

__init__(self, beginby: str, endby: str, lsdata: list)[source]
to_str(self, res: str, parent_indent) → str[source]
class pyrser.fmt.sep(ch: str, lsdata: list)[source]

Bases: pyrser.fmt.indentable

for all list seperated by a char

__init__(self, ch: str, lsdata: list)[source]
to_str(self, res: str, parent_indent) → str[source]
class pyrser.fmt.end(ch: str, lsdata: list)[source]

Bases: pyrser.fmt.indentable

for all list that end by a char

__init__(self, ch: str, lsdata: list)[source]
to_str(self, res: str, parent_indent) → str[source]
class pyrser.fmt.tab(lsdata: pyrser.fmt.indentable)[source]

Bases: pyrser.fmt.indentable

to handle indentation level

__init__(self, lsdata: indentable)[source]
set_indent(self, indent: int= 1)[source]
to_str(self, res: str, parent_indent) → str[source]