diff --git a/example_cmd.py b/example_cmd.py index 970fd1f..35d3df2 100644 --- a/example_cmd.py +++ b/example_cmd.py @@ -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 diff --git a/formatters.py b/formatters.py index 86fa951..66c62bf 100644 --- a/formatters.py +++ b/formatters.py @@ -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