Implements JsonReader (#2)

This commit is contained in:
Romain Dorgueil
2016-12-28 11:29:12 +01:00
parent f3757f38b7
commit 67e25b92e1
7 changed files with 52 additions and 16 deletions

View File

@ -1,14 +1,14 @@
from bonobo.util.lifecycle import with_context
__all__ = [
'Handler',
'FileHandler',
'FileReader',
'FileWriter',
]
@with_context
class Handler:
class FileHandler:
"""
Abstract component factory for file-related components.
@ -44,7 +44,7 @@ class Handler:
del ctx.file
class Reader(Handler):
class Reader(FileHandler):
def __call__(self, ctx):
yield from self.handle(ctx)
@ -52,7 +52,7 @@ class Reader(Handler):
raise NotImplementedError('Abstract.')
class Writer(Handler):
class Writer(FileHandler):
def __call__(self, ctx, row):
return self.handle(ctx, row)