From bd8d2d2ba21a355a4bb1f3e0e51ea142500a6259 Mon Sep 17 00:00:00 2001 From: James Turk Date: Thu, 10 Nov 2022 22:08:26 -0600 Subject: [PATCH] -(object) --- README.md | 0 examples/fec_electronic.py | 2 +- src/saucebrush/__init__.py | 2 +- src/saucebrush/filters.py | 2 +- src/saucebrush/sources.py | 14 +++++++------- src/saucebrush/utils.py | 6 +++--- tests/test_filters.py | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/examples/fec_electronic.py b/examples/fec_electronic.py index d482eef..01c59ec 100644 --- a/examples/fec_electronic.py +++ b/examples/fec_electronic.py @@ -1,7 +1,7 @@ import re import exceptions -class FECSource(object): +class FECSource: SPLIT_CHAR = '\x1c' FORM_FIELDS = { diff --git a/src/saucebrush/__init__.py b/src/saucebrush/__init__.py index b9f5661..03201e9 100644 --- a/src/saucebrush/__init__.py +++ b/src/saucebrush/__init__.py @@ -17,7 +17,7 @@ class OvercookedError(Exception): pass -class Recipe(object): +class Recipe: def __init__(self, *filter_args, **kwargs): self.finished = False diff --git a/src/saucebrush/filters.py b/src/saucebrush/filters.py index 3d3b79d..5fa6851 100644 --- a/src/saucebrush/filters.py +++ b/src/saucebrush/filters.py @@ -16,7 +16,7 @@ import time ###################### -class Filter(object): +class Filter: """ABC for filters that operate on records. All derived filters must provide a process_record(self, record) that diff --git a/src/saucebrush/sources.py b/src/saucebrush/sources.py index f784083..7fd4d88 100644 --- a/src/saucebrush/sources.py +++ b/src/saucebrush/sources.py @@ -9,7 +9,7 @@ import string from saucebrush import utils -class CSVSource(object): +class CSVSource: """Saucebrush source for reading from CSV files. Takes an open csvfile, an optional set of fieldnames and optional number @@ -34,7 +34,7 @@ class CSVSource(object): return self._dictreader -class FixedWidthFileSource(object): +class FixedWidthFileSource: """Saucebrush source for reading from fixed width field files. FixedWidthFileSource expects an open fixed width file and a tuple @@ -73,7 +73,7 @@ class FixedWidthFileSource(object): return self.__next__() -class HtmlTableSource(object): +class HtmlTableSource: """Saucebrush source for reading data from an HTML table. HtmlTableSource expects an open html file, the id of the table or a @@ -126,7 +126,7 @@ class HtmlTableSource(object): return self.process_tr() -class DjangoModelSource(object): +class DjangoModelSource: """Saucebrush source for reading data from django models. DjangoModelSource expects a django settings file, app label, and model @@ -148,7 +148,7 @@ class DjangoModelSource(object): return iter(self._data) -class MongoDBSource(object): +class MongoDBSource: """Source for reading from a MongoDB database. The record dict is populated with records matching the spec @@ -181,7 +181,7 @@ def dict_factory(cursor, row): return d -class SqliteSource(object): +class SqliteSource: """Source that reads from a sqlite database. The record dict is populated with the results from the @@ -221,7 +221,7 @@ class SqliteSource(object): self._conn.close() -class FileSource(object): +class FileSource: """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, diff --git a/src/saucebrush/utils.py b/src/saucebrush/utils.py index b598cc8..71ab392 100644 --- a/src/saucebrush/utils.py +++ b/src/saucebrush/utils.py @@ -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 files as arguments to the class constructor: @@ -98,7 +98,7 @@ class Files(object): f.close() -class RemoteFile(object): +class RemoteFile: """Stream data from a remote file. :param url: URL to remote file @@ -114,7 +114,7 @@ class RemoteFile(object): resp.close() -class ZippedFiles(object): +class ZippedFiles: """unpack a zipped collection of files on init. Takes a string with file location or zipfile.ZipFile object diff --git a/tests/test_filters.py b/tests/test_filters.py index cfbd277..71025b4 100644 --- a/tests/test_filters.py +++ b/tests/test_filters.py @@ -18,7 +18,7 @@ from saucebrush.filters import ( ) -class DummyRecipe(object): +class DummyRecipe: rejected_record = None rejected_msg = None