Skip to content

Commit a04762d

Browse files
committed
#22885, Moved all setup imports to bottom of benchmark files and added noqa: F401 to each
1 parent ca7d518 commit a04762d

34 files changed

+119
-57
lines changed

asv_bench/benchmarks/algorithms.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
except (ImportError, TypeError, ValueError):
1313
pass
1414

15-
from .pandas_vb_common import setup # noqa
16-
1715

1816
class Factorize(object):
1917

@@ -126,3 +124,6 @@ def time_series_timedeltas(self, df):
126124

127125
def time_series_dates(self, df):
128126
hashing.hash_pandas_object(df['dates'])
127+
128+
129+
from .pandas_vb_common import setup # noqa: F401

asv_bench/benchmarks/attrs_caching.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
except ImportError:
66
from pandas.util.decorators import cache_readonly
77

8-
from .pandas_vb_common import setup # noqa
9-
108

119
class DataFrameAttributes(object):
1210

@@ -38,3 +36,6 @@ def prop(self):
3836

3937
def time_cache_readonly(self):
4038
self.obj.prop
39+
40+
41+
from .pandas_vb_common import setup # noqa: F401

asv_bench/benchmarks/binary_ops.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
except ImportError:
77
import pandas.computation.expressions as expr
88

9-
from .pandas_vb_common import setup # noqa
10-
119

1210
class Ops(object):
1311

@@ -149,3 +147,6 @@ def time_add_overflow_b_mask_nan(self):
149147
def time_add_overflow_both_arg_nan(self):
150148
checked_add_with_arr(self.arr, self.arr_mixed, arr_mask=self.arr_nan_1,
151149
b_mask=self.arr_nan_2)
150+
151+
152+
from .pandas_vb_common import setup # noqa: F401

asv_bench/benchmarks/categoricals.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
except ImportError:
1212
pass
1313

14-
from .pandas_vb_common import setup # noqa
15-
1614

1715
class Concat(object):
1816

@@ -245,3 +243,6 @@ def time_getitem_list(self, index):
245243

246244
def time_getitem_bool_array(self, index):
247245
self.data[self.data == self.cat_scalar]
246+
247+
248+
from .pandas_vb_common import setup # noqa: F401

asv_bench/benchmarks/ctors.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
import pandas.util.testing as tm
33
from pandas import Series, Index, DatetimeIndex, Timestamp, MultiIndex
44

5-
from .pandas_vb_common import setup # noqa
6-
75

86
class SeriesConstructors(object):
97

@@ -64,3 +62,6 @@ def setup(self):
6462

6563
def time_multiindex_from_iterables(self):
6664
MultiIndex.from_product(self.iterables)
65+
66+
67+
from .pandas_vb_common import setup # noqa: F401

asv_bench/benchmarks/eval.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
except ImportError:
66
import pandas.computation.expressions as expr
77

8-
from .pandas_vb_common import setup # noqa
9-
108

119
class Eval(object):
1210

@@ -65,3 +63,6 @@ def time_query_datetime_column(self):
6563

6664
def time_query_with_boolean_selection(self):
6765
self.df.query('(a >= @self.min_val) & (a <= @self.max_val)')
66+
67+
68+
from .pandas_vb_common import setup # noqa: F401

asv_bench/benchmarks/frame_ctor.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
# For compatibility with older versions
88
from pandas.core.datetools import * # noqa
99

10-
from .pandas_vb_common import setup # noqa
11-
1210

1311
class FromDicts(object):
1412

@@ -99,3 +97,6 @@ def setup(self):
9997

10098
def time_frame_from_ndarray(self):
10199
self.df = DataFrame(self.data)
100+
101+
102+
from .pandas_vb_common import setup # noqa: F401

asv_bench/benchmarks/frame_methods.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
from pandas import (DataFrame, Series, MultiIndex, date_range, period_range,
77
isnull, NaT)
88

9-
from .pandas_vb_common import setup # noqa
10-
119

1210
class GetNumericData(object):
1311

@@ -537,3 +535,6 @@ def time_series_describe(self):
537535

538536
def time_dataframe_describe(self):
539537
self.df.describe()
538+
539+
540+
from .pandas_vb_common import setup # noqa: F401

asv_bench/benchmarks/gil.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def wrapper(fname):
2323
return fname
2424
return wrapper
2525

26-
from .pandas_vb_common import BaseIO, setup # noqa
26+
from .pandas_vb_common import BaseIO
2727

2828

2929
class ParallelGroupbyMethods(object):
@@ -273,3 +273,6 @@ def time_parallel(self, threads):
273273
def time_loop(self, threads):
274274
for i in range(threads):
275275
self.loop()
276+
277+
278+
from .pandas_vb_common import setup # noqa: F401

asv_bench/benchmarks/groupby.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
TimeGrouper, Categorical, Timestamp)
99
import pandas.util.testing as tm
1010

11-
from .pandas_vb_common import setup # noqa
12-
1311

1412
method_blacklist = {
1513
'object': {'median', 'prod', 'sem', 'cumsum', 'sum', 'cummin', 'mean',
@@ -579,3 +577,6 @@ def setup(self):
579577

580578
def time_first(self):
581579
self.df_nans.groupby('key').transform('first')
580+
581+
582+
from .pandas_vb_common import setup # noqa: F401

0 commit comments

Comments
 (0)