Skip to content

Commit 542c916

Browse files
committed
TST/STYLE: remove multiprocess nose flags and slight PEP fixes
xref pandas-dev#13856 (comment) Author: Jeff Reback <[email protected]> Closes pandas-dev#15333 from jreback/mcs and squashes the following commits: 2edc842 [Jeff Reback] TST/STYLE: remove multiprocess nose flags and slight PEP fixes
1 parent 8d57450 commit 542c916

File tree

183 files changed

+229
-418
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

183 files changed

+229
-418
lines changed

pandas/__init__.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
missing_dependencies.append(dependency)
1616

1717
if missing_dependencies:
18-
raise ImportError("Missing required dependencies {0}".format(missing_dependencies))
18+
raise ImportError(
19+
"Missing required dependencies {0}".format(missing_dependencies))
1920
del hard_dependencies, dependency, missing_dependencies
2021

2122
# numpy compat
@@ -24,7 +25,8 @@
2425
try:
2526
from pandas import hashtable, tslib, lib
2627
except ImportError as e: # pragma: no cover
27-
module = str(e).lstrip('cannot import name ') # hack but overkill to use re
28+
# hack but overkill to use re
29+
module = str(e).lstrip('cannot import name ')
2830
raise ImportError("C extension: {0} not built. If you want to import "
2931
"pandas from the source directory, you may need to run "
3032
"'python setup.py build_ext --inplace --force' to build "
@@ -61,5 +63,5 @@
6163
# use the closest tagged version if possible
6264
from ._version import get_versions
6365
v = get_versions()
64-
__version__ = v.get('closest-tag',v['version'])
66+
__version__ = v.get('closest-tag', v['version'])
6567
del get_versions, v

pandas/_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
157157
# "stabilization", as well as "HEAD" and "master".
158158
tags = set([r for r in refs if re.search(r'\d', r)])
159159
if verbose:
160-
print("discarding '%s', no digits" % ",".join(refs-tags))
160+
print("discarding '%s', no digits" % ",".join(refs - tags))
161161
if verbose:
162162
print("likely tags: %s" % ",".join(sorted(tags)))
163163
for ref in sorted(tags):

pandas/api/tests/test_api.py

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
from pandas.api import types
99
from pandas.util import testing as tm
1010

11-
_multiprocess_can_split_ = True
12-
1311

1412
class Base(object):
1513

pandas/compat/__init__.py

+15-9
Original file line numberDiff line numberDiff line change
@@ -79,25 +79,25 @@ def signature(f):
7979
args = [
8080
p.name for p in sig.parameters.values()
8181
if p.kind == inspect.Parameter.POSITIONAL_OR_KEYWORD
82-
]
82+
]
8383
varargs = [
8484
p.name for p in sig.parameters.values()
8585
if p.kind == inspect.Parameter.VAR_POSITIONAL
86-
]
86+
]
8787
varargs = varargs[0] if varargs else None
8888
keywords = [
8989
p.name for p in sig.parameters.values()
9090
if p.kind == inspect.Parameter.VAR_KEYWORD
91-
]
91+
]
9292
keywords = keywords[0] if keywords else None
9393
defaults = [
9494
p.default for p in sig.parameters.values()
9595
if p.kind == inspect.Parameter.POSITIONAL_OR_KEYWORD
9696
and p.default is not p.empty
97-
] or None
98-
argspec = namedtuple('Signature',['args','defaults',
99-
'varargs','keywords'])
100-
return argspec(args,defaults,varargs,keywords)
97+
] or None
98+
argspec = namedtuple('Signature', ['args', 'defaults',
99+
'varargs', 'keywords'])
100+
return argspec(args, defaults, varargs, keywords)
101101

102102
# have to explicitly put builtins into the namespace
103103
range = range
@@ -170,7 +170,7 @@ def iterkeys(obj, **kw):
170170
def itervalues(obj, **kw):
171171
return obj.itervalues(**kw)
172172

173-
next = lambda it : it.next()
173+
next = lambda it: it.next()
174174
else:
175175
def iteritems(obj, **kw):
176176
return iter(obj.items(**kw))
@@ -183,6 +183,7 @@ def itervalues(obj, **kw):
183183

184184
next = next
185185

186+
186187
def bind_method(cls, name, func):
187188
"""Bind a method to class, python 2 and python 3 compatible.
188189
@@ -307,7 +308,8 @@ def set_function_name(f, name, cls):
307308
f.__name__ = name
308309
return f
309310

310-
class ResourceWarning(Warning): pass
311+
class ResourceWarning(Warning):
312+
pass
311313

312314
string_and_binary_types = string_types + (binary_type,)
313315

@@ -398,14 +400,18 @@ def is_platform_little_endian():
398400
""" am I little endian """
399401
return sys.byteorder == 'little'
400402

403+
401404
def is_platform_windows():
402405
return sys.platform == 'win32' or sys.platform == 'cygwin'
403406

407+
404408
def is_platform_linux():
405409
return sys.platform == 'linux2'
406410

411+
407412
def is_platform_mac():
408413
return sys.platform == 'darwin'
409414

415+
410416
def is_platform_32bit():
411417
return struct.calcsize("P") * 8 < 64

pandas/compat/chainmap.py

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66

77
class DeepChainMap(ChainMap):
8+
89
def __setitem__(self, key, value):
910
for mapping in self.maps:
1011
if key in mapping:

pandas/compat/numpy/function.py

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828

2929
class CompatValidator(object):
30+
3031
def __init__(self, defaults, fname=None, method=None,
3132
max_fname_arg_count=None):
3233
self.fname = fname

pandas/compat/pickle_compat.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from pandas import compat, Index
1010
from pandas.compat import u, string_types
1111

12+
1213
def load_reduce(self):
1314
stack = self.stack
1415
args = stack.pop()
@@ -34,7 +35,7 @@ def load_reduce(self):
3435
pass
3536

3637
# try to reencode the arguments
37-
if getattr(self,'encoding',None) is not None:
38+
if getattr(self, 'encoding', None) is not None:
3839
args = tuple([arg.encode(self.encoding)
3940
if isinstance(arg, string_types)
4041
else arg for arg in args])
@@ -44,7 +45,7 @@ def load_reduce(self):
4445
except:
4546
pass
4647

47-
if getattr(self,'is_verbose',None):
48+
if getattr(self, 'is_verbose', None):
4849
print(sys.exc_info())
4950
print(func, args)
5051
raise
@@ -61,6 +62,7 @@ class Unpickler(pkl.Unpickler):
6162
Unpickler.dispatch = copy.copy(Unpickler.dispatch)
6263
Unpickler.dispatch[pkl.REDUCE[0]] = load_reduce
6364

65+
6466
def load_newobj(self):
6567
args = self.stack.pop()
6668
cls = self.stack[-1]
@@ -75,6 +77,8 @@ def load_newobj(self):
7577
Unpickler.dispatch[pkl.NEWOBJ[0]] = load_newobj
7678

7779
# py3 compat
80+
81+
7882
def load_newobj_ex(self):
7983
kwargs = self.stack.pop()
8084
args = self.stack.pop()
@@ -91,6 +95,7 @@ def load_newobj_ex(self):
9195
except:
9296
pass
9397

98+
9499
def load(fh, encoding=None, compat=False, is_verbose=False):
95100
"""load a pickle, with a provided encoding
96101

pandas/computation/tests/test_eval.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def check_complex_cmp_op(self, lhs, cmp1, rhs, binop, cmp2):
201201
binop=binop,
202202
cmp2=cmp2)
203203
scalar_with_in_notin = (is_scalar(rhs) and (cmp1 in skip_these or
204-
cmp2 in skip_these))
204+
cmp2 in skip_these))
205205
if scalar_with_in_notin:
206206
with tm.assertRaises(TypeError):
207207
pd.eval(ex, engine=self.engine, parser=self.parser)
@@ -702,7 +702,6 @@ def test_float_truncation(self):
702702
tm.assert_frame_equal(expected, result)
703703

704704

705-
706705
class TestEvalNumexprPython(TestEvalNumexprPandas):
707706

708707
@classmethod
@@ -782,6 +781,7 @@ def check_chained_cmp_op(self, lhs, cmp1, mid, cmp2, rhs):
782781
# typecasting rules consistency with python
783782
# issue #12388
784783

784+
785785
class TestTypeCasting(object):
786786

787787
def check_binop_typecasting(self, engine, parser, op, dt):
@@ -803,7 +803,8 @@ def test_binop_typecasting(self):
803803
for engine, parser in ENGINES_PARSERS:
804804
for op in ['+', '-', '*', '**', '/']:
805805
# maybe someday... numexpr has too many upcasting rules now
806-
#for dt in chain(*(np.sctypes[x] for x in ['uint', 'int', 'float'])):
806+
# for dt in chain(*(np.sctypes[x] for x in ['uint', 'int',
807+
# 'float'])):
807808
for dt in [np.float32, np.float64]:
808809
yield self.check_binop_typecasting, engine, parser, op, dt
809810

@@ -1969,10 +1970,11 @@ def test_negate_lt_eq_le():
19691970
for engine, parser in product(_engines, expr._parsers):
19701971
yield check_negate_lt_eq_le, engine, parser
19711972

1973+
19721974
class TestValidate(tm.TestCase):
19731975

19741976
def test_validate_bool_args(self):
1975-
invalid_values = [1, "True", [1,2,3], 5.0]
1977+
invalid_values = [1, "True", [1, 2, 3], 5.0]
19761978

19771979
for value in invalid_values:
19781980
with self.assertRaises(ValueError):

pandas/core/base.py

+2
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ def f(self, *args, **kwargs):
230230
class AccessorProperty(object):
231231
"""Descriptor for implementing accessor properties like Series.str
232232
"""
233+
233234
def __init__(self, accessor_cls, construct_accessor):
234235
self.accessor_cls = accessor_cls
235236
self.construct_accessor = construct_accessor
@@ -651,6 +652,7 @@ class GroupByMixin(object):
651652
@staticmethod
652653
def _dispatch(name, *args, **kwargs):
653654
""" dispatch to apply """
655+
654656
def outer(self, *args, **kwargs):
655657
def f(x):
656658
x = self._shallow_copy(x, groupby=self._groupby)

pandas/core/config.py

+1
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ def __dir__(self):
215215

216216

217217
class CallableDynamicDoc(object):
218+
218219
def __init__(self, func, doc_tmpl):
219220
self.__doc_tmpl__ = doc_tmpl
220221
self.__func__ = func

pandas/core/frame.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -5326,9 +5326,10 @@ def isin(self, values):
53265326
"allowed to be passed to DataFrame.isin(), "
53275327
"you passed a "
53285328
"{0!r}".format(type(values).__name__))
5329-
return DataFrame(lib.ismember(self.values.ravel(),
5329+
return DataFrame(
5330+
lib.ismember(self.values.ravel(),
53305331
set(values)).reshape(self.shape), self.index,
5331-
self.columns)
5332+
self.columns)
53325333

53335334
# ----------------------------------------------------------------------
53345335
# Deprecated stuff

pandas/core/indexing.py

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def get_indexers_list():
4242

4343
# the public IndexSlicerMaker
4444
class _IndexSlice(object):
45+
4546
def __getitem__(self, arg):
4647
return arg
4748

pandas/core/internals.py

+1
Original file line numberDiff line numberDiff line change
@@ -5122,6 +5122,7 @@ def trim_join_unit(join_unit, length):
51225122

51235123

51245124
class JoinUnit(object):
5125+
51255126
def __init__(self, block, shape, indexers=None):
51265127
# Passing shape explicitly is required for cases when block is None.
51275128
if indexers is None:

pandas/core/nanops.py

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727

2828
class disallow(object):
29+
2930
def __init__(self, *dtypes):
3031
super(disallow, self).__init__()
3132
self.dtypes = tuple(np.dtype(dtype).type for dtype in dtypes)
@@ -58,6 +59,7 @@ def _f(*args, **kwargs):
5859

5960

6061
class bottleneck_switch(object):
62+
6163
def __init__(self, zero_value=None, **kwargs):
6264
self.zero_value = zero_value
6365
self.kwargs = kwargs

pandas/core/panel.py

+2
Original file line numberDiff line numberDiff line change
@@ -1560,6 +1560,7 @@ def f(self, other, axis=0):
15601560

15611561
# legacy
15621562
class WidePanel(Panel):
1563+
15631564
def __init__(self, *args, **kwargs):
15641565
# deprecation, #10892
15651566
warnings.warn("WidePanel is deprecated. Please use Panel",
@@ -1569,6 +1570,7 @@ def __init__(self, *args, **kwargs):
15691570

15701571

15711572
class LongPanel(DataFrame):
1573+
15721574
def __init__(self, *args, **kwargs):
15731575
# deprecation, #10892
15741576
warnings.warn("LongPanel is deprecated. Please use DataFrame",

pandas/core/series.py

+1
Original file line numberDiff line numberDiff line change
@@ -2987,6 +2987,7 @@ def create_from_value(value, index, dtype):
29872987

29882988
# backwards compatiblity
29892989
class TimeSeries(Series):
2990+
29902991
def __init__(self, *args, **kwargs):
29912992
# deprecation TimeSeries, #10890
29922993
warnings.warn("TimeSeries is deprecated. Please use Series",

pandas/core/window.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,7 @@ def f(x, name=name, *args):
659659

660660

661661
class _Rolling(_Window):
662+
662663
@property
663664
def _constructor(self):
664665
return Rolling
@@ -1718,7 +1719,7 @@ def dataframe_from_int_dict(data, frame_template):
17181719

17191720
def _get_center_of_mass(com, span, halflife, alpha):
17201721
valid_count = len([x for x in [com, span, halflife, alpha]
1721-
if x is not None])
1722+
if x is not None])
17221723
if valid_count > 1:
17231724
raise ValueError("com, span, halflife, and alpha "
17241725
"are mutually exclusive")

0 commit comments

Comments
 (0)