tabs -> spaces

This commit is contained in:
Ian Adam Naval 2015-02-20 18:27:21 -05:00
parent c9b1b2fba9
commit 0a78e571fd
2 changed files with 26 additions and 26 deletions

View File

@ -3,18 +3,18 @@ from commands import BaseCommand, register_cmd
@register_cmd
class example_cmd(BaseCommand):
def __call__(self, *args, **kwargs):
def input_generator():
yield 'example'
yield 'command'
return input_generator
def __call__(self, *args, **kwargs):
def input_generator():
yield 'example'
yield 'command'
return input_generator
@register_cmd
class echo(BaseCommand):
def __call__(self, *args, **kwargs):
def input_generator():
for line in self.input_cmd():
yield line
return input_generator
def __call__(self, *args, **kwargs):
def input_generator():
for line in self.input_cmd():
yield line
return input_generator

View File

@ -1,23 +1,23 @@
class Formatter(object):
"""Formatters are callable objects who always accept a generator.
The generator represents the output stream of an executing program.
Formatters are special commands which produce no output themselves.
Instead, they always write to the standard out of the program. """
"""Formatters are callable objects who always accept a generator.
The generator represents the output stream of an executing program.
Formatters are special commands which produce no output themselves.
Instead, they always write to the standard out of the program. """
def __init__(self, *args, **kwargs):
# Always require no arguments
pass
def __init__(self, *args, **kwargs):
# Always require no arguments
pass
def __call__(self, input_generator):
raise NotImplementedError(
"You must extend a Formatter and implement the __call__ method")
def __call__(self, input_generator):
raise NotImplementedError(
"You must extend a Formatter and implement the __call__ method")
class Printer(Formatter):
"""Simple formatter which accepts any object from the input
generator and simply prints it as if it were a string."""
"""Simple formatter which accepts any object from the input
generator and simply prints it as if it were a string."""
def __call__(self, input_generator):
for line in input_generator:
print(str(line.decode('utf-8')))
return None
def __call__(self, input_generator):
for line in input_generator:
print(str(line.decode('utf-8')))
return None