cleanup flake8

This commit is contained in:
James Turk 2022-11-10 21:31:18 -06:00
parent 230039fa90
commit 041518e760
6 changed files with 10 additions and 16 deletions

View File

@ -203,7 +203,7 @@ class ConditionalPathFilter(Filter):
#####################
## Generic Filters ##
# Generic Filters #
#####################
@ -518,7 +518,7 @@ class UniqueIDValidator(UniqueID):
###########################
## Commonly Used Filters ##
# Commonly Used Filters #
###########################
@ -535,7 +535,7 @@ class PhoneNumberCleaner(FieldFilter):
def __init__(self, keys, number_format="%s%s%s.%s%s%s.%s%s%s%s"):
super(PhoneNumberCleaner, self).__init__(keys)
self._number_format = number_format
self._num_re = re.compile("\d")
self._num_re = re.compile(r"\d")
def process_field(self, item):
nums = self._num_re.findall(item)

View File

@ -4,7 +4,6 @@
All sources must implement the iterable interface and return python
dictionaries.
"""
from __future__ import unicode_literals
import string
from saucebrush import utils

View File

@ -1,4 +1,3 @@
from __future__ import unicode_literals
from contextlib import closing
from io import StringIO
import os
@ -72,7 +71,7 @@ class EmitterTestCase(unittest.TestCase):
import cStringIO # if Python 2.x then use old cStringIO
io = cStringIO.StringIO()
except:
except Exception:
io = StringIO() # if Python 3.x then use StringIO
with closing(io) as output:
@ -82,7 +81,8 @@ class EmitterTestCase(unittest.TestCase):
def test_sqlite_emitter(self):
import sqlite3, tempfile
import sqlite3
import tempfile
with closing(tempfile.NamedTemporaryFile(suffix=".db")) as f:
db_path = f.name

View File

@ -1,5 +1,4 @@
import unittest
import operator
import types
from saucebrush.filters import (
Filter,
@ -133,7 +132,7 @@ class FilterTestCase(unittest.TestCase):
# ensure only even numbers remain
self.assertEqual(list(result), [0, 2, 4, 6, 8])
### Tests for Subrecord
# Tests for Subrecord
def test_subrecord_filter_list(self):
data = [
@ -209,7 +208,7 @@ class FilterTestCase(unittest.TestCase):
def test_conditional_path(self):
predicate = lambda r: r["a"] == 1
predicate = lambda r: r["a"] == 1 # noqa
# double b if a == 1, otherwise double c
cpf = ConditionalPathFilter(predicate, FieldDoubler("b"), FieldDoubler("c"))
@ -221,7 +220,7 @@ class FilterTestCase(unittest.TestCase):
self.assert_filter_result(cpf, expected_data)
### Tests for Generic Filters
# Tests for Generic Filters
def test_field_modifier(self):
# another version of FieldDoubler

View File

@ -1,4 +1,3 @@
import doctest
import unittest
from saucebrush import Recipe, run_recipe, SaucebrushError, OvercookedError
from saucebrush.filters import Filter

View File

@ -1,5 +1,4 @@
from __future__ import unicode_literals
from io import BytesIO, StringIO
from io import StringIO
import unittest
from saucebrush.sources import (
@ -85,8 +84,6 @@ class SourceTestCase(unittest.TestCase):
try:
import lxml
hts = HtmlTableSource(content, "thetable")
self.assertEqual(list(hts), [{"a": "1", "b": "2", "c": "3"}])