Skip to content

Commit

Permalink
Correct most flake8 warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
James McKinney committed Jan 25, 2016
1 parent 011347c commit 73f718b
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 14 deletions.
14 changes: 7 additions & 7 deletions csvkit/grep.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ class FilteringCSVReader(six.Iterator):
If 'header' is False, then all rows must pass the filter; by default, the first row will be passed
through untested.
The value of patterns may be either a sequence or a dictionary. Items in the sequence and values in the
dictionary may be strings, regular expressions, or functions. For each row in the wrapped iterator,
these values will be used as tests, and the row will only be yielded by the filter if all values pass
The value of patterns may be either a sequence or a dictionary. Items in the sequence and values in the
dictionary may be strings, regular expressions, or functions. For each row in the wrapped iterator,
these values will be used as tests, and the row will only be yielded by the filter if all values pass
their corresponding tests. This behavior can be toggled so that all rows which pass any of the tests
will be yielded by specifying "any_match=True" in the constructor.
Empty values (the blank string or None) not be tested; the value in that position will not affect whether
or not the filtering reader yields a prospective row. To test for explicitly blank, use a regular
expression such as "^$" or "^\s*$"
If patterns is a dictionary, the keys can be integers identifying indices in the input rows, or, if 'header'
If patterns is a dictionary, the keys can be integers identifying indices in the input rows, or, if 'header'
is True (as it is by default), they can be strings matching column names in the first row of the reader.
If patterns is a sequence, then it is assumed that they will be applied to the
If patterns is a sequence, then it is assumed that they will be applied to the
equivalently positioned values in the test rows.
By specifying 'inverse=True', only rows which do not match the patterns will be passed by the filter. The header,
Expand Down Expand Up @@ -80,9 +80,9 @@ def test_row(self, row):

def standardize_patterns(column_names, patterns):
"""
Given patterns in any of the permitted input forms, return a dict whose keys
Given patterns in any of the permitted input forms, return a dict whose keys
are column indices and whose values are functions which return a boolean value whether the value passes.
If patterns is a dictionary and any of its keys are values in column_names, the returned dictionary will
If patterns is a dictionary and any of its keys are values in column_names, the returned dictionary will
have those keys replaced with the integer position of that value in column_names
"""
try:
Expand Down
2 changes: 1 addition & 1 deletion csvkit/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def to_rows(self, serialize_dates=False):
for c in self:
# Stringify datetimes, dates, and times
if c.type in [datetime.datetime, datetime.date, datetime.time]:
out_columns.append([six.text_type(v.isoformat()) if v != None else None for v in c])
out_columns.append([six.text_type(v.isoformat()) if v is not None else None for v in c])
else:
out_columns.append(c)

Expand Down
2 changes: 1 addition & 1 deletion csvkit/typeinference.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
def normalize_column_type(l, normal_type=None, blanks_as_nulls=True):
"""
Attempts to normalize a list (column) of string values to booleans, integers,
floats, dates, times, datetimes, or strings. NAs and missing values are converted
floats, dates, times, datetimes, or strings. NAs and missing values are converted
to empty strings. Empty strings are converted to nulls in the case of non-string
types. For string types (unicode), empty strings are converted to nulls unless
blanks_as_nulls is false.
Expand Down
1 change: 0 additions & 1 deletion csvkit/utilities/csvgrep.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import itertools
import re
import sys
from argparse import FileType

import agate
Expand Down
2 changes: 1 addition & 1 deletion csvkit/utilities/csvstat.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def main(self):

self.output_file.write(('%3i. %s\n' % (c.order + 1, c.name)))

if c.type == None:
if c.type is None:
self.output_file.write('\tEmpty column\n')
continue

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
#html_static_path = ['_static']
# html_static_path = ['_static']

# Output file base name for HTML help builder.
htmlhelp_basename = 'csvkitdoc'
Expand Down
2 changes: 0 additions & 2 deletions tests/test_convert/test_dbf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
except ImportError:
import unittest

import six

from csvkit.convert import dbase


Expand Down

0 comments on commit 73f718b

Please sign in to comment.