diff --git a/ci/lint.sh b/ci/lint.sh index a866b04445f96..115a2cdaf7899 100755 --- a/ci/lint.sh +++ b/ci/lint.sh @@ -7,16 +7,10 @@ source activate pandas RET=0 if [ "$LINT" ]; then - echo "Linting" - for path in 'api' 'core' 'indexes' 'types' 'formats' 'io' 'stats' 'compat' 'sparse' 'tools' 'tseries' 'tests' 'computation' 'util' - do - echo "linting -> pandas/$path" - flake8 pandas/$path --filename '*.py' - if [ $? -ne "0" ]; then - RET=1 - fi - - done + # pandas/rpy is deprecated and will be removed. + # pandas/src is C code, so no need to search there. + echo "Linting *.py" + flake8 pandas --filename '*.py' --exclude pandas/rpy,pandas/src echo "Linting *.py DONE" echo "Linting *.pyx" diff --git a/pandas/core/groupby.py b/pandas/core/groupby.py index 2a7f896e1b871..afddb86988970 100644 --- a/pandas/core/groupby.py +++ b/pandas/core/groupby.py @@ -6,7 +6,7 @@ import warnings import copy -from pandas.compat import( +from pandas.compat import ( zip, range, long, lzip, callable, map ) diff --git a/pandas/core/internals.py b/pandas/core/internals.py index 11721a5bdac29..d9d4bb0d14228 100644 --- a/pandas/core/internals.py +++ b/pandas/core/internals.py @@ -1147,8 +1147,9 @@ def get_result(other): def handle_error(): if raise_on_error: + # The 'detail' variable is defined in outer scope. raise TypeError('Could not operate %s with block values %s' % - (repr(other), str(detail))) + (repr(other), str(detail))) # noqa else: # return the values result = np.empty(values.shape, dtype='O') diff --git a/pandas/io/parsers.py b/pandas/io/parsers.py index e0127c3544971..9e5fcd406a750 100755 --- a/pandas/io/parsers.py +++ b/pandas/io/parsers.py @@ -2194,16 +2194,16 @@ def _handle_usecols(self, columns, usecols_key): usecols_key is used if there are string usecols. """ if self.usecols is not None: - if any([isinstance(u, string_types) for u in self.usecols]): + if any([isinstance(col, string_types) for col in self.usecols]): if len(columns) > 1: raise ValueError("If using multiple headers, usecols must " "be integers.") col_indices = [] - for u in self.usecols: - if isinstance(u, string_types): - col_indices.append(usecols_key.index(u)) + for col in self.usecols: + if isinstance(col, string_types): + col_indices.append(usecols_key.index(col)) else: - col_indices.append(u) + col_indices.append(col) else: col_indices = self.usecols diff --git a/pandas/io/tests/parser/common.py b/pandas/io/tests/parser/common.py index 0219e16391be8..0364b3bf42fff 100644 --- a/pandas/io/tests/parser/common.py +++ b/pandas/io/tests/parser/common.py @@ -17,8 +17,8 @@ import pandas.util.testing as tm from pandas import DataFrame, Series, Index, MultiIndex from pandas import compat -from pandas.compat import(StringIO, BytesIO, PY3, - range, lrange, u) +from pandas.compat import (StringIO, BytesIO, PY3, + range, lrange, u) from pandas.io.common import DtypeWarning, EmptyDataError, URLError from pandas.io.parsers import TextFileReader, TextParser diff --git a/pandas/msgpack/__init__.py b/pandas/msgpack/__init__.py index 0c2370df936a4..33d60a12ef0a3 100644 --- a/pandas/msgpack/__init__.py +++ b/pandas/msgpack/__init__.py @@ -1,11 +1,10 @@ # coding: utf-8 -# flake8: noqa - -from pandas.msgpack._version import version -from pandas.msgpack.exceptions import * from collections import namedtuple +from pandas.msgpack.exceptions import * # noqa +from pandas.msgpack._version import version # noqa + class ExtType(namedtuple('ExtType', 'code data')): """ExtType represents ext type in msgpack.""" @@ -18,11 +17,10 @@ def __new__(cls, code, data): raise ValueError("code must be 0~127") return super(ExtType, cls).__new__(cls, code, data) +import os # noqa -import os -from pandas.msgpack._packer import Packer -from pandas.msgpack._unpacker import unpack, unpackb, Unpacker - +from pandas.msgpack._packer import Packer # noqa +from pandas.msgpack._unpacker import unpack, unpackb, Unpacker # noqa def pack(o, stream, **kwargs): diff --git a/pandas/tests/indexes/test_base.py b/pandas/tests/indexes/test_base.py index 21471b1883209..b839ed6331457 100644 --- a/pandas/tests/indexes/test_base.py +++ b/pandas/tests/indexes/test_base.py @@ -1576,11 +1576,10 @@ def test_string_index_repr(self): # py3/py2 repr can differ because of "u" prefix # which also affects to displayed element size - # suppress flake8 warnings if PY3: coerce = lambda x: x else: - coerce = unicode + coerce = unicode # noqa # short idx = pd.Index(['a', 'bb', 'ccc']) diff --git a/pandas/util/testing.py b/pandas/util/testing.py index 57bb01e5e0406..05517bf6cf53a 100644 --- a/pandas/util/testing.py +++ b/pandas/util/testing.py @@ -35,7 +35,7 @@ from pandas.core.algorithms import take_1d import pandas.compat as compat -from pandas.compat import( +from pandas.compat import ( filter, map, zip, range, unichr, lrange, lmap, lzip, u, callable, Counter, raise_with_traceback, httplib, is_platform_windows, is_platform_32bit, PY3