-(object)
This commit is contained in:
parent
d96cb91e24
commit
bd8d2d2ba2
@ -1,7 +1,7 @@
|
|||||||
import re
|
import re
|
||||||
import exceptions
|
import exceptions
|
||||||
|
|
||||||
class FECSource(object):
|
class FECSource:
|
||||||
|
|
||||||
SPLIT_CHAR = '\x1c'
|
SPLIT_CHAR = '\x1c'
|
||||||
FORM_FIELDS = {
|
FORM_FIELDS = {
|
||||||
|
@ -17,7 +17,7 @@ class OvercookedError(Exception):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Recipe(object):
|
class Recipe:
|
||||||
def __init__(self, *filter_args, **kwargs):
|
def __init__(self, *filter_args, **kwargs):
|
||||||
self.finished = False
|
self.finished = False
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ import time
|
|||||||
######################
|
######################
|
||||||
|
|
||||||
|
|
||||||
class Filter(object):
|
class Filter:
|
||||||
"""ABC for filters that operate on records.
|
"""ABC for filters that operate on records.
|
||||||
|
|
||||||
All derived filters must provide a process_record(self, record) that
|
All derived filters must provide a process_record(self, record) that
|
||||||
|
@ -9,7 +9,7 @@ import string
|
|||||||
from saucebrush import utils
|
from saucebrush import utils
|
||||||
|
|
||||||
|
|
||||||
class CSVSource(object):
|
class CSVSource:
|
||||||
"""Saucebrush source for reading from CSV files.
|
"""Saucebrush source for reading from CSV files.
|
||||||
|
|
||||||
Takes an open csvfile, an optional set of fieldnames and optional number
|
Takes an open csvfile, an optional set of fieldnames and optional number
|
||||||
@ -34,7 +34,7 @@ class CSVSource(object):
|
|||||||
return self._dictreader
|
return self._dictreader
|
||||||
|
|
||||||
|
|
||||||
class FixedWidthFileSource(object):
|
class FixedWidthFileSource:
|
||||||
"""Saucebrush source for reading from fixed width field files.
|
"""Saucebrush source for reading from fixed width field files.
|
||||||
|
|
||||||
FixedWidthFileSource expects an open fixed width file and a tuple
|
FixedWidthFileSource expects an open fixed width file and a tuple
|
||||||
@ -73,7 +73,7 @@ class FixedWidthFileSource(object):
|
|||||||
return self.__next__()
|
return self.__next__()
|
||||||
|
|
||||||
|
|
||||||
class HtmlTableSource(object):
|
class HtmlTableSource:
|
||||||
"""Saucebrush source for reading data from an HTML table.
|
"""Saucebrush source for reading data from an HTML table.
|
||||||
|
|
||||||
HtmlTableSource expects an open html file, the id of the table or a
|
HtmlTableSource expects an open html file, the id of the table or a
|
||||||
@ -126,7 +126,7 @@ class HtmlTableSource(object):
|
|||||||
return self.process_tr()
|
return self.process_tr()
|
||||||
|
|
||||||
|
|
||||||
class DjangoModelSource(object):
|
class DjangoModelSource:
|
||||||
"""Saucebrush source for reading data from django models.
|
"""Saucebrush source for reading data from django models.
|
||||||
|
|
||||||
DjangoModelSource expects a django settings file, app label, and model
|
DjangoModelSource expects a django settings file, app label, and model
|
||||||
@ -148,7 +148,7 @@ class DjangoModelSource(object):
|
|||||||
return iter(self._data)
|
return iter(self._data)
|
||||||
|
|
||||||
|
|
||||||
class MongoDBSource(object):
|
class MongoDBSource:
|
||||||
"""Source for reading from a MongoDB database.
|
"""Source for reading from a MongoDB database.
|
||||||
|
|
||||||
The record dict is populated with records matching the spec
|
The record dict is populated with records matching the spec
|
||||||
@ -181,7 +181,7 @@ def dict_factory(cursor, row):
|
|||||||
return d
|
return d
|
||||||
|
|
||||||
|
|
||||||
class SqliteSource(object):
|
class SqliteSource:
|
||||||
"""Source that reads from a sqlite database.
|
"""Source that reads from a sqlite database.
|
||||||
|
|
||||||
The record dict is populated with the results from the
|
The record dict is populated with the results from the
|
||||||
@ -221,7 +221,7 @@ class SqliteSource(object):
|
|||||||
self._conn.close()
|
self._conn.close()
|
||||||
|
|
||||||
|
|
||||||
class FileSource(object):
|
class FileSource:
|
||||||
"""Base class for sources which read from one or more files.
|
"""Base class for sources which read from one or more files.
|
||||||
|
|
||||||
Takes as input a file-like, a file path, a list of file-likes,
|
Takes as input a file-like, a file path, a list of file-likes,
|
||||||
|
@ -67,7 +67,7 @@ def str_or_list(obj):
|
|||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
class Files(object):
|
class Files:
|
||||||
"""Iterate over multiple files as a single file. Pass the paths of the
|
"""Iterate over multiple files as a single file. Pass the paths of the
|
||||||
files as arguments to the class constructor:
|
files as arguments to the class constructor:
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ class Files(object):
|
|||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
class RemoteFile(object):
|
class RemoteFile:
|
||||||
"""Stream data from a remote file.
|
"""Stream data from a remote file.
|
||||||
|
|
||||||
:param url: URL to remote file
|
:param url: URL to remote file
|
||||||
@ -114,7 +114,7 @@ class RemoteFile(object):
|
|||||||
resp.close()
|
resp.close()
|
||||||
|
|
||||||
|
|
||||||
class ZippedFiles(object):
|
class ZippedFiles:
|
||||||
"""unpack a zipped collection of files on init.
|
"""unpack a zipped collection of files on init.
|
||||||
|
|
||||||
Takes a string with file location or zipfile.ZipFile object
|
Takes a string with file location or zipfile.ZipFile object
|
||||||
|
@ -18,7 +18,7 @@ from saucebrush.filters import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class DummyRecipe(object):
|
class DummyRecipe:
|
||||||
rejected_record = None
|
rejected_record = None
|
||||||
rejected_msg = None
|
rejected_msg = None
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user