Skip to content

Commit

Permalink
STYLE: Fix linting of benchmarks (#22886)
Browse files Browse the repository at this point in the history
Fixed the following:

* asv_bench/benchmarks/algorithms.py:12:5: E722 do not use bare except'
* asv_bench/benchmarks/timeseries.py:1:1: F401 'warnings' imported but unused
* asv_bench/benchmarks/stat_ops.py:21:9: E722 do not use bare except'
* asv_bench/benchmarks/stat_ops.py:59:9: E722 do not use bare except'
* asv_bench/benchmarks/pandas_vb_common.py:5:1: F401 'pandas.Panel' imported but unused
* asv_bench/benchmarks/pandas_vb_common.py:12:5: E722 do not use bare except'
* asv_bench/benchmarks/pandas_vb_common.py:37:9: E722 do not use bare except'
* asv_bench/benchmarks/join_merge.py:32:9: E722 do not use bare except'
* asv_bench/benchmarks/io/csv.py:2:1: F401 'timeit' imported but unused
* asv_bench/benchmarks/io/csv.py:8:1: F401 'pandas.compat.PY2' imported but unused
* asv_bench/benchmarks/io/csv.py:184:80: E501 line too long (87 > 79 characters)
  • Loading branch information
MatanCohe authored and gfyoung committed Sep 30, 2018
1 parent f849134 commit 14598c6
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion asv_bench/benchmarks/algorithms.py
Expand Up @@ -9,7 +9,7 @@
try:
hashing = import_module(imp)
break
except:
except (ImportError, TypeError, ValueError):
pass

from .pandas_vb_common import setup # noqa
Expand Down
6 changes: 2 additions & 4 deletions asv_bench/benchmarks/io/csv.py
@@ -1,11 +1,9 @@
import random
import timeit
import string

import numpy as np
import pandas.util.testing as tm
from pandas import DataFrame, Categorical, date_range, read_csv
from pandas.compat import PY2
from pandas.compat import cStringIO as StringIO

from ..pandas_vb_common import setup, BaseIO # noqa
Expand Down Expand Up @@ -181,8 +179,8 @@ def time_read_csv(self, sep, decimal, float_precision):
names=list('abc'), float_precision=float_precision)

def time_read_csv_python_engine(self, sep, decimal, float_precision):
read_csv(self.data(self.StringIO_input), sep=sep, header=None, engine='python',
float_precision=None, names=list('abc'))
read_csv(self.data(self.StringIO_input), sep=sep, header=None,
engine='python', float_precision=None, names=list('abc'))


class ReadCSVCategorical(BaseIO):
Expand Down
2 changes: 1 addition & 1 deletion asv_bench/benchmarks/join_merge.py
Expand Up @@ -29,7 +29,7 @@ def setup(self):
try:
with warnings.catch_warnings(record=True):
self.mdf1.consolidate(inplace=True)
except:
except (AttributeError, TypeError):
pass
self.mdf2 = self.mdf1.copy()
self.mdf2.index = self.df2.index
Expand Down
5 changes: 2 additions & 3 deletions asv_bench/benchmarks/pandas_vb_common.py
Expand Up @@ -2,14 +2,13 @@
from importlib import import_module

import numpy as np
from pandas import Panel

# Compatibility import for lib
for imp in ['pandas._libs.lib', 'pandas.lib']:
try:
lib = import_module(imp)
break
except:
except (ImportError, TypeError, ValueError):
pass

numeric_dtypes = [np.int64, np.int32, np.uint32, np.uint64, np.float32,
Expand All @@ -34,7 +33,7 @@ def remove(self, f):
"""Remove created files"""
try:
os.remove(f)
except:
except OSError:
# On Windows, attempting to remove a file that is in use
# causes an exception to be raised
pass
Expand Down
4 changes: 2 additions & 2 deletions asv_bench/benchmarks/stat_ops.py
Expand Up @@ -18,7 +18,7 @@ def setup(self, op, dtype, axis, use_bottleneck):
df = pd.DataFrame(np.random.randn(100000, 4)).astype(dtype)
try:
pd.options.compute.use_bottleneck = use_bottleneck
except:
except TypeError:
from pandas.core import nanops
nanops._USE_BOTTLENECK = use_bottleneck
self.df_func = getattr(df, op)
Expand Down Expand Up @@ -56,7 +56,7 @@ def setup(self, op, dtype, use_bottleneck):
s = pd.Series(np.random.randn(100000)).astype(dtype)
try:
pd.options.compute.use_bottleneck = use_bottleneck
except:
except TypeError:
from pandas.core import nanops
nanops._USE_BOTTLENECK = use_bottleneck
self.s_func = getattr(s, op)
Expand Down
1 change: 0 additions & 1 deletion asv_bench/benchmarks/timeseries.py
@@ -1,4 +1,3 @@
import warnings
from datetime import timedelta

import numpy as np
Expand Down

0 comments on commit 14598c6

Please sign in to comment.