Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 909507d

Browse files
committed
added NullFormatter
1 parent 84175ba commit 909507d

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

Lib/formatter.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,25 @@
99
whitespace = '[' + string.whitespace + ']+'
1010

1111

12+
class NullFormatter:
13+
14+
def __init__(self): pass
15+
def end_paragraph(self, blankline): pass
16+
def add_line_break(self): pass
17+
def add_hor_rule(self): pass
18+
def add_label_data(self, format, counter): pass
19+
def add_flowing_data(self, data): pass
20+
def add_literal_data(self, data): pass
21+
def flush_softspace(self): pass
22+
def push_font(self, x): pass
23+
def pop_font(self): pass
24+
def push_margin(self, margin): pass
25+
def pop_margin(self): pass
26+
def set_spacing(self, spacing): pass
27+
def push_style(self, style): pass
28+
def pop_style(self): pass
29+
30+
1231
class AbstractFormatter:
1332

1433
def __init__(self, writer):
@@ -17,8 +36,8 @@ def __init__(self, writer):
1736
self.margin_stack = [] # Margin state
1837
self.spacing = None # Vertical spacing state
1938
self.style_stack = [] # Other state, e.g. color
20-
self.nospace = 1 # Should leading space be suppressed
21-
self.softspace = 0 # Should a space be inserted
39+
self.nospace = 1 # Should leading space be suppressed
40+
self.softspace = 0 # Should a space be inserted
2241

2342
def end_paragraph(self, blankline):
2443
if not self.nospace:

0 commit comments

Comments
 (0)