Kaydet (Commit) 3672aa2d authored tarafından Guido van Rossum's avatar Guido van Rossum

change DumbWriter to derive from NullWriter

üst 3fd32ecd
...@@ -262,6 +262,7 @@ class AbstractFormatter: ...@@ -262,6 +262,7 @@ class AbstractFormatter:
class NullWriter: class NullWriter:
"""Minimal writer interface to use in testing. """Minimal writer interface to use in testing.
""" """
def __init__(self): pass
def new_alignment(self, align): pass def new_alignment(self, align): pass
def new_font(self, font): pass def new_font(self, font): pass
def new_margin(self, margin, level): pass def new_margin(self, margin, level): pass
...@@ -275,7 +276,7 @@ class NullWriter: ...@@ -275,7 +276,7 @@ class NullWriter:
def send_literal_data(self, data): pass def send_literal_data(self, data): pass
class AbstractWriter: class AbstractWriter(NullWriter):
def __init__(self): def __init__(self):
pass pass
...@@ -314,12 +315,12 @@ class AbstractWriter: ...@@ -314,12 +315,12 @@ class AbstractWriter:
print "send_literal_data(%s)" % `data` print "send_literal_data(%s)" % `data`
class DumbWriter(AbstractWriter): class DumbWriter(NullWriter):
def __init__(self, file=None, maxcol=72): def __init__(self, file=None, maxcol=72):
self.file = file or sys.stdout self.file = file or sys.stdout
self.maxcol = maxcol self.maxcol = maxcol
AbstractWriter.__init__(self) NullWriter.__init__(self)
self.reset() self.reset()
def reset(self): def reset(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment