Skip to content

Commit fe77b4f

Browse files
committed
STYLE: flake8 upgraded to 3.3 on conda
fixes for E305, 2 blank lines after a class definition
1 parent e351ed0 commit fe77b4f

38 files changed

+74
-6
lines changed

pandas/compat/numpy/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def np_array_datetime64_compat(arr, *args, **kwargs):
6767

6868
return np.array(arr, *args, **kwargs)
6969

70+
7071
__all__ = ['np',
7172
'_np_version_under1p8',
7273
'_np_version_under1p9',

pandas/compat/numpy/function.py

+7
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def __call__(self, args, kwargs, fname=None,
5555
raise ValueError("invalid validation method "
5656
"'{method}'".format(method=method))
5757

58+
5859
ARGMINMAX_DEFAULTS = dict(out=None)
5960
validate_argmin = CompatValidator(ARGMINMAX_DEFAULTS, fname='argmin',
6061
method='both', max_fname_arg_count=1)
@@ -97,6 +98,7 @@ def validate_argmax_with_skipna(skipna, args, kwargs):
9798
validate_argmax(args, kwargs)
9899
return skipna
99100

101+
100102
ARGSORT_DEFAULTS = OrderedDict()
101103
ARGSORT_DEFAULTS['axis'] = -1
102104
ARGSORT_DEFAULTS['kind'] = 'quicksort'
@@ -121,6 +123,7 @@ def validate_argsort_with_ascending(ascending, args, kwargs):
121123
validate_argsort(args, kwargs, max_fname_arg_count=1)
122124
return ascending
123125

126+
124127
CLIP_DEFAULTS = dict(out=None)
125128
validate_clip = CompatValidator(CLIP_DEFAULTS, fname='clip',
126129
method='both', max_fname_arg_count=3)
@@ -141,6 +144,7 @@ def validate_clip_with_axis(axis, args, kwargs):
141144
validate_clip(args, kwargs)
142145
return axis
143146

147+
144148
COMPRESS_DEFAULTS = OrderedDict()
145149
COMPRESS_DEFAULTS['axis'] = None
146150
COMPRESS_DEFAULTS['out'] = None
@@ -170,6 +174,7 @@ def validate_cum_func_with_skipna(skipna, args, kwargs, name):
170174
validate_cum_func(args, kwargs, fname=name)
171175
return skipna
172176

177+
173178
LOGICAL_FUNC_DEFAULTS = dict(out=None)
174179
validate_logical_func = CompatValidator(LOGICAL_FUNC_DEFAULTS, method='kwargs')
175180

@@ -236,6 +241,7 @@ def validate_take_with_convert(convert, args, kwargs):
236241
validate_take(args, kwargs, max_fname_arg_count=3, method='both')
237242
return convert
238243

244+
239245
TRANSPOSE_DEFAULTS = dict(axes=None)
240246
validate_transpose = CompatValidator(TRANSPOSE_DEFAULTS, fname='transpose',
241247
method='both', max_fname_arg_count=0)
@@ -318,6 +324,7 @@ def validate_groupby_func(name, args, kwargs, allowed=None):
318324
"with groupby. Use .groupby(...)."
319325
"{func}() instead".format(func=name)))
320326

327+
321328
RESAMPLER_NUMPY_OPS = ('min', 'max', 'sum', 'prod',
322329
'mean', 'std', 'var')
323330

pandas/computation/expr.py

+1
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,7 @@ def visitor(x, y):
669669
operands = node.values
670670
return reduce(visitor, operands)
671671

672+
672673
# ast.Call signature changed on 3.5,
673674
# conditionally change which methods is named
674675
# visit_Call depending on Python version, #11097

pandas/core/algorithms.py

+2
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,7 @@ def _finalize_nsmallest(arr, kth_val, n, keep, narr):
926926
else:
927927
return inds
928928

929+
929930
_dtype_map = {'datetime64[ns]': 'int64', 'timedelta64[ns]': 'int64'}
930931

931932

@@ -959,6 +960,7 @@ def _hashtable_algo(f, values, return_dtype=None):
959960
# use Object
960961
return f(htable.PyObjectHashTable, _ensure_object)
961962

963+
962964
_hashtables = {
963965
'float64': (htable.Float64HashTable, htable.Float64Vector),
964966
'uint64': (htable.UInt64HashTable, htable.UInt64Vector),

pandas/core/config.py

+1
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,7 @@ def inner(x):
804804

805805
return inner
806806

807+
807808
# common type validators, for convenience
808809
# usage: register_option(... , validator = is_int)
809810
is_int = is_type_factory(int)

pandas/core/config_init.py

+2
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ def mpl_style_cb(key):
278278

279279
return val
280280

281+
281282
with cf.config_prefix('display'):
282283
cf.register_option('precision', 6, pc_precision_doc, validator=is_int)
283284
cf.register_option('float_format', None, float_format_doc,
@@ -380,6 +381,7 @@ def use_inf_as_null_cb(key):
380381
from pandas.types.missing import _use_inf_as_null
381382
_use_inf_as_null(key)
382383

384+
383385
with cf.config_prefix('mode'):
384386
cf.register_option('use_inf_as_null', False, use_inf_as_null_doc,
385387
cb=use_inf_as_null_cb)

pandas/core/frame.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5741,9 +5741,9 @@ def _from_nested_dict(data):
57415741
def _put_str(s, space):
57425742
return ('%s' % s)[:space].ljust(space)
57435743

5744+
57445745
# ----------------------------------------------------------------------
57455746
# Add plotting methods to DataFrame
5746-
57475747
DataFrame.plot = base.AccessorProperty(gfx.FramePlotMethods,
57485748
gfx.FramePlotMethods)
57495749
DataFrame.hist = gfx.hist_frame

pandas/core/indexing.py

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def get_indexers_list():
3636
('iat', _iAtIndexer),
3737
]
3838

39+
3940
# "null slice"
4041
_NS = slice(None, None)
4142

@@ -1850,6 +1851,7 @@ def _convert_key(self, key, is_setter=False):
18501851
"indexers")
18511852
return key
18521853

1854+
18531855
# 32-bit floating point machine epsilon
18541856
_eps = np.finfo('f4').eps
18551857

pandas/formats/format.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2479,9 +2479,9 @@ def _has_names(index):
24792479
else:
24802480
return index.name is not None
24812481

2482+
24822483
# -----------------------------------------------------------------------------
24832484
# Global formatting options
2484-
24852485
_initial_defencoding = None
24862486

24872487

pandas/indexes/numeric.py

+3
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ def _assert_safe_casting(cls, data, subarr):
159159
raise TypeError('Unsafe NumPy casting, you must '
160160
'explicitly cast')
161161

162+
162163
Int64Index._add_numeric_methods()
163164
Int64Index._add_logical_methods()
164165

@@ -238,6 +239,7 @@ def _assert_safe_casting(cls, data, subarr):
238239
raise TypeError('Unsafe NumPy casting, you must '
239240
'explicitly cast')
240241

242+
241243
UInt64Index._add_numeric_methods()
242244
UInt64Index._add_logical_methods()
243245

@@ -391,5 +393,6 @@ def isin(self, values, level=None):
391393
return lib.ismember_nans(np.array(self), value_set,
392394
isnull(list(value_set)).any())
393395

396+
394397
Float64Index._add_numeric_methods()
395398
Float64Index._add_logical_methods_disabled()

pandas/indexes/range.py

+1
Original file line numberDiff line numberDiff line change
@@ -652,5 +652,6 @@ def _evaluate_numeric_binop(self, other):
652652
reversed=True,
653653
step=operator.div)
654654

655+
655656
RangeIndex._add_numeric_methods()
656657
RangeIndex._add_logical_methods()

pandas/io/common.py

+2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class ParserError(ValueError):
7575
"""
7676
pass
7777

78+
7879
# gh-12665: Alias for now and remove later.
7980
CParserError = ParserError
8081

@@ -116,6 +117,7 @@ def __iter__(self):
116117
def __next__(self):
117118
raise AbstractMethodError(self)
118119

120+
119121
if not compat.PY3:
120122
BaseIterator.next = lambda self: self.__next__()
121123

pandas/io/excel.py

+5
Original file line numberDiff line numberDiff line change
@@ -886,12 +886,14 @@ def _convert_to_style(cls, style_dict):
886886

887887
return xls_style
888888

889+
889890
register_writer(_Openpyxl1Writer)
890891

891892

892893
class _OpenpyxlWriter(_Openpyxl1Writer):
893894
engine = 'openpyxl'
894895

896+
895897
register_writer(_OpenpyxlWriter)
896898

897899

@@ -1368,6 +1370,7 @@ def write_cells(self, cells, sheet_name=None, startrow=0, startcol=0):
13681370
for k, v in style_kwargs.items():
13691371
setattr(xcell, k, v)
13701372

1373+
13711374
register_writer(_Openpyxl22Writer)
13721375

13731376

@@ -1491,6 +1494,7 @@ def _convert_to_style(cls, style_dict, num_format_str=None):
14911494

14921495
return style
14931496

1497+
14941498
register_writer(_XlwtWriter)
14951499

14961500

@@ -1603,4 +1607,5 @@ def _convert_to_style(self, style_dict, num_format_str=None):
16031607

16041608
return xl_format
16051609

1610+
16061611
register_writer(_XlsxWriter)

pandas/io/gbq.py

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def _test_google_api_imports():
5858
raise ImportError("Missing module required for Google BigQuery "
5959
"support: {0}".format(str(e)))
6060

61+
6162
logger = logging.getLogger('pandas.io.gbq')
6263
logger.setLevel(logging.ERROR)
6364

pandas/io/packers.py

+2
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ def read(fh):
217217

218218
raise ValueError('path_or_buf needs to be a string file path or file-like')
219219

220+
220221
dtype_dict = {21: np.dtype('M8[ns]'),
221222
u('datetime64[ns]'): np.dtype('M8[ns]'),
222223
u('datetime64[us]'): np.dtype('M8[us]'),
@@ -237,6 +238,7 @@ def dtype_for(t):
237238
return dtype_dict[t]
238239
return np.typeDict.get(t, t)
239240

241+
240242
c2f_dict = {'complex': np.float64,
241243
'complex128': np.float64,
242244
'complex64': np.float32}

pandas/io/parsers.py

+2
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ def _read(filepath_or_buffer, kwds):
409409

410410
return data
411411

412+
412413
_parser_defaults = {
413414
'delimiter': None,
414415

@@ -655,6 +656,7 @@ def parser_f(filepath_or_buffer,
655656

656657
return parser_f
657658

659+
658660
read_csv = _make_parser_function('read_csv', sep=',')
659661
read_csv = Appender(_read_csv_doc)(read_csv)
660662

pandas/io/pytables.py

+4
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def _ensure_encoding(encoding):
7474
encoding = _default_encoding
7575
return encoding
7676

77+
7778
Term = Expr
7879

7980

@@ -112,6 +113,7 @@ class ClosedFileError(Exception):
112113
class IncompatibilityWarning(Warning):
113114
pass
114115

116+
115117
incompatibility_doc = """
116118
where criteria is being ignored as this version [%s] is too old (or
117119
not-defined), read the file in and write it out to a new file to upgrade (with
@@ -122,6 +124,7 @@ class IncompatibilityWarning(Warning):
122124
class AttributeConflictWarning(Warning):
123125
pass
124126

127+
125128
attribute_conflict_doc = """
126129
the [%s] attribute of the existing index is [%s] which conflicts with the new
127130
[%s], resetting the attribute to None
@@ -131,6 +134,7 @@ class AttributeConflictWarning(Warning):
131134
class DuplicateWarning(Warning):
132135
pass
133136

137+
134138
duplicate_doc = """
135139
duplicate entries in table, taking most recently appended
136140
"""

pandas/io/sql.py

+1
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,7 @@ def has_table(table_name, con, flavor=None, schema=None):
495495
pandas_sql = pandasSQL_builder(con, flavor=flavor, schema=schema)
496496
return pandas_sql.has_table(table_name)
497497

498+
498499
table_exists = has_table
499500

500501

pandas/io/stata.py

+1
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ class PossiblePrecisionLoss(Warning):
459459
class ValueLabelTypeMismatch(Warning):
460460
pass
461461

462+
462463
value_label_mismatch_doc = """
463464
Stata value labels (pandas categories) must be strings. Column {0} contains
464465
non-string labels which will be converted to strings. Please check that the

pandas/msgpack/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def packb(o, **kwargs):
4141
"""
4242
return Packer(**kwargs).pack(o)
4343

44+
4445
# alias for compatibility to simplejson/marshal/pickle.
4546
load = unpack
4647
loads = unpackb

pandas/sparse/frame.py

+1
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,7 @@ def homogenize(series_dict):
863863

864864
return output
865865

866+
866867
# use unaccelerated ops for sparse objects
867868
ops.add_flex_arithmetic_methods(SparseDataFrame, use_numexpr=False,
868869
**ops.frame_flex_funcs)

pandas/sparse/series.py

+1
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,7 @@ def from_coo(cls, A, dense_index=False):
832832
"""
833833
return _coo_to_sparse_series(A, dense_index=dense_index)
834834

835+
835836
# overwrite series methods with unaccelerated versions
836837
ops.add_special_arithmetic_methods(SparseSeries, use_numexpr=False,
837838
**ops.series_special_funcs)

pandas/stats/moments.py

+3
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ def ewmstd(arg, com=None, span=None, halflife=None, alpha=None, min_periods=0,
385385
bias=bias,
386386
func_kw=['bias'])
387387

388+
388389
ewmvol = ewmstd
389390

390391

@@ -476,6 +477,7 @@ def f(arg, window, min_periods=None, freq=None, center=False,
476477
**kwargs)
477478
return f
478479

480+
479481
rolling_max = _rolling_func('max', 'Moving maximum.', how='max')
480482
rolling_min = _rolling_func('min', 'Moving minimum.', how='min')
481483
rolling_sum = _rolling_func('sum', 'Moving sum.')
@@ -683,6 +685,7 @@ def f(arg, min_periods=1, freq=None, **kwargs):
683685
**kwargs)
684686
return f
685687

688+
686689
expanding_max = _expanding_func('max', 'Expanding maximum.')
687690
expanding_min = _expanding_func('min', 'Expanding minimum.')
688691
expanding_sum = _expanding_func('sum', 'Expanding sum.')

pandas/tests/sparse/test_libsparse.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -560,8 +560,8 @@ def _check_case(xloc, xlen, yloc, ylen, eloc, elen):
560560

561561
check_cases(_check_case)
562562

563-
# too cute? oh but how I abhor code duplication
564563

564+
# too cute? oh but how I abhor code duplication
565565
check_ops = ['add', 'sub', 'mul', 'truediv', 'floordiv']
566566

567567

pandas/tests/test_generic.py

+1
Original file line numberDiff line numberDiff line change
@@ -1588,6 +1588,7 @@ def test_to_xarray(self):
15881588
# non-convertible
15891589
self.assertRaises(ValueError, lambda: result.to_pandas())
15901590

1591+
15911592
# run all the tests, but wrap each in a warning catcher
15921593
for t in ['test_rename', 'test_rename_axis', 'test_get_numeric_data',
15931594
'test_get_default', 'test_nonzero',

0 commit comments

Comments
 (0)