Skip to content

Commit 52c547a

Browse files
committed
STYLE: final flake8 fixes, add back check for travis-ci
closes #11928 closes #12208
1 parent 63abbe4 commit 52c547a

32 files changed

+127
-153
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,10 @@ script:
164164
- echo "script"
165165
- ci/run_build_docs.sh
166166
- ci/script.sh
167+
- ci/lint.sh
167168
# nothing here, or failed tests won't fail travis
168169

169170
after_script:
170171
- ci/install_test.sh
171172
- source activate pandas && ci/print_versions.py
172173
- ci/print_skipped.py /tmp/nosetests.xml
173-
- ci/lint.sh
174-
- ci/lint_ok_for_now.sh

ci/lint.sh

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,14 @@ echo "inside $0"
44

55
source activate pandas
66

7-
for path in 'core'
7+
RET=0
8+
for path in 'core' 'io' 'stats' 'compat' 'sparse' 'tools' 'tseries' 'tests' 'computation' 'util'
89
do
910
echo "linting -> pandas/$path"
10-
flake8 pandas/$path --filename '*.py' --statistics -q
11+
flake8 pandas/$path --filename '*.py'
12+
if [ $? -ne "0" ]; then
13+
RET=1
14+
fi
1115
done
1216

13-
RET="$?"
14-
15-
# we are disabling the return code for now
16-
# to have Travis-CI pass. When the code
17-
# passes linting, re-enable
18-
#exit "$RET"
19-
20-
exit 0
17+
exit $RET

ci/lint_ok_for_now.sh

Lines changed: 0 additions & 20 deletions
This file was deleted.

pandas/compat/numpy_compat.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
_np_version_under1p11 = LooseVersion(_np_version) < '1.11'
2020

2121
if LooseVersion(_np_version) < '1.7.0':
22-
raise ImportError('this version of pandas is incompatible with numpy < 1.7.0\n'
22+
raise ImportError('this version of pandas is incompatible with '
23+
'numpy < 1.7.0\n'
2324
'your numpy version is {0}.\n'
2425
'Please upgrade numpy to >= 1.7.0 to use '
2526
'this pandas version'.format(_np_version))
@@ -61,7 +62,7 @@ def np_array_datetime64_compat(arr, *args, **kwargs):
6162
isinstance(arr, string_and_binary_types):
6263
arr = [tz_replacer(s) for s in arr]
6364
else:
64-
arr = tz_replacer(s)
65+
arr = tz_replacer(arr)
6566

6667
return np.array(arr, *args, **kwargs)
6768

pandas/core/frame.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
from pandas.tseries.index import DatetimeIndex
5252
from pandas.tseries.tdi import TimedeltaIndex
5353

54-
import pandas.core.algorithms as algos
5554
import pandas.core.base as base
5655
import pandas.core.common as com
5756
import pandas.core.format as fmt

pandas/core/groupby.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2310,10 +2310,9 @@ def _get_grouper(obj, key=None, axis=0, level=None, sort=True):
23102310
except Exception:
23112311
all_in_columns = False
23122312

2313-
if (not any_callable and not all_in_columns
2314-
and not any_arraylike and not any_groupers
2315-
and match_axis_length
2316-
and level is None):
2313+
if not any_callable and not all_in_columns and \
2314+
not any_arraylike and not any_groupers and \
2315+
match_axis_length and level is None:
23172316
keys = [com._asarray_tuplesafe(keys)]
23182317

23192318
if isinstance(level, (tuple, list)):
@@ -3695,7 +3694,7 @@ def count(self):
36953694
return self._wrap_agged_blocks(data.items, list(blk))
36963695

36973696

3698-
from pandas.tools.plotting import boxplot_frame_groupby
3697+
from pandas.tools.plotting import boxplot_frame_groupby # noqa
36993698
DataFrameGroupBy.boxplot = boxplot_frame_groupby
37003699

37013700

pandas/core/internals.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3981,7 +3981,7 @@ def form_blocks(arrays, names, axes):
39813981
klass=DatetimeTZBlock,
39823982
fastpath=True,
39833983
placement=[i], )
3984-
for i, names, array in datetime_tz_items]
3984+
for i, _, array in datetime_tz_items]
39853985
blocks.extend(dttz_blocks)
39863986

39873987
if len(bool_items):
@@ -3999,7 +3999,7 @@ def form_blocks(arrays, names, axes):
39993999
if len(cat_items) > 0:
40004000
cat_blocks = [make_block(array, klass=CategoricalBlock, fastpath=True,
40014001
placement=[i])
4002-
for i, names, array in cat_items]
4002+
for i, _, array in cat_items]
40034003
blocks.extend(cat_blocks)
40044004

40054005
if len(extra_locs):

pandas/core/reshape.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def _unstack_multiple(data, clocs):
282282
for i in range(len(clocs)):
283283
val = clocs[i]
284284
result = result.unstack(val)
285-
clocs = [val if i > val else val - 1 for val in clocs]
285+
clocs = [v if i > v else v - 1 for v in clocs]
286286

287287
return result
288288

pandas/sparse/panel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,10 +520,10 @@ def _convert_frames(frames, index, columns, fill_value=np.nan, kind='block'):
520520
output[item] = df
521521

522522
if index is None:
523-
all_indexes = [df.index for df in output.values()]
523+
all_indexes = [x.index for x in output.values()]
524524
index = _get_combined_index(all_indexes)
525525
if columns is None:
526-
all_columns = [df.columns for df in output.values()]
526+
all_columns = [x.columns for x in output.values()]
527527
columns = _get_combined_index(all_columns)
528528

529529
index = _ensure_index(index)

pandas/tests/frame/test_apply.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,8 @@ def transform(row):
262262
return row
263263

264264
def transform2(row):
265-
if (notnull(row['C']) and row['C'].startswith('shin')
266-
and row['A'] == 'foo'):
265+
if (notnull(row['C']) and row['C'].startswith('shin') and
266+
row['A'] == 'foo'):
267267
row['D'] = 7
268268
return row
269269

0 commit comments

Comments
 (0)