Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
909507dd
Commit
909507dd
authored
Oct 06, 1995
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added NullFormatter
parent
84175bac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
+21
-2
Lib/formatter.py
Lib/formatter.py
+21
-2
No files found.
Lib/formatter.py
View file @
909507dd
...
...
@@ -9,6 +9,25 @@ AS_IS = None
whitespace
=
'['
+
string
.
whitespace
+
']+'
class
NullFormatter
:
def
__init__
(
self
):
pass
def
end_paragraph
(
self
,
blankline
):
pass
def
add_line_break
(
self
):
pass
def
add_hor_rule
(
self
):
pass
def
add_label_data
(
self
,
format
,
counter
):
pass
def
add_flowing_data
(
self
,
data
):
pass
def
add_literal_data
(
self
,
data
):
pass
def
flush_softspace
(
self
):
pass
def
push_font
(
self
,
x
):
pass
def
pop_font
(
self
):
pass
def
push_margin
(
self
,
margin
):
pass
def
pop_margin
(
self
):
pass
def
set_spacing
(
self
,
spacing
):
pass
def
push_style
(
self
,
style
):
pass
def
pop_style
(
self
):
pass
class
AbstractFormatter
:
def
__init__
(
self
,
writer
):
...
...
@@ -17,8 +36,8 @@ class AbstractFormatter:
self
.
margin_stack
=
[]
# Margin state
self
.
spacing
=
None
# Vertical spacing state
self
.
style_stack
=
[]
# Other state, e.g. color
self
.
nospace
=
1
# Should leading space be suppressed
self
.
softspace
=
0
# Should a space be inserted
self
.
nospace
=
1
# Should leading space be suppressed
self
.
softspace
=
0
# Should a space be inserted
def
end_paragraph
(
self
,
blankline
):
if
not
self
.
nospace
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment