Skip to content

Commit c79fc04

Browse files
alimcmaster1jreback
authored andcommitted
Use black 19.10b0 (#29508)
1 parent 054936f commit c79fc04

File tree

24 files changed

+61
-43
lines changed

24 files changed

+61
-43
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/python/black
3-
rev: stable
3+
rev: 19.10b0
44
hooks:
55
- id: black
66
language_version: python3.7

doc/source/development/contributing.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,9 @@ submitting code to run the check yourself::
654654
to auto-format your code. Additionally, many editors have plugins that will
655655
apply ``black`` as you edit files.
656656

657+
You should use a ``black`` version >= 19.10b0 as previous versions are not compatible
658+
with the pandas codebase.
659+
657660
Optionally, you may wish to setup `pre-commit hooks <https://pre-commit.com/>`_
658661
to automatically run ``black`` and ``flake8`` when you make a git commit. This
659662
can be done by installing ``pre-commit``::

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dependencies:
1515
- cython>=0.29.13
1616

1717
# code checks
18-
- black<=19.3b0
18+
- black>=19.10b0
1919
- cpplint
2020
- flake8
2121
- flake8-comprehensions>=3.1.0 # used by flake8, linting of unnecessary comprehensions

pandas/core/algorithms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,7 @@ def compute(self, method):
11591159
n = min(n, narr)
11601160

11611161
kth_val = algos.kth_smallest(arr.copy(), n - 1)
1162-
ns, = np.nonzero(arr <= kth_val)
1162+
(ns,) = np.nonzero(arr <= kth_val)
11631163
inds = ns[arr[ns].argsort(kind="mergesort")]
11641164

11651165
if self.keep != "all":

pandas/core/frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4774,7 +4774,7 @@ def drop_duplicates(self, subset=None, keep="first", inplace=False):
47744774
duplicated = self.duplicated(subset, keep=keep)
47754775

47764776
if inplace:
4777-
inds, = (-duplicated)._ndarray_values.nonzero()
4777+
(inds,) = (-duplicated)._ndarray_values.nonzero()
47784778
new_data = self._data.take(inds)
47794779
self._update_inplace(new_data)
47804780
else:

pandas/core/generic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3599,7 +3599,7 @@ class animal locomotion
35993599

36003600
if isinstance(loc, np.ndarray):
36013601
if loc.dtype == np.bool_:
3602-
inds, = loc.nonzero()
3602+
(inds,) = loc.nonzero()
36033603
return self.take(inds, axis=axis)
36043604
else:
36053605
return self.take(loc, axis=axis)

pandas/core/groupby/grouper.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,7 @@ def __init__(
292292
self.grouper,
293293
self._codes,
294294
self._group_index,
295-
) = index._get_grouper_for_level( # noqa: E501
296-
self.grouper, level
297-
)
295+
) = index._get_grouper_for_level(self.grouper, level)
298296

299297
# a passed Grouper like, directly get the grouper in the same way
300298
# as single grouper groupby, use the group_info to get codes

pandas/core/indexes/base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,8 +1871,7 @@ def _isnan(self):
18711871
@cache_readonly
18721872
def _nan_idxs(self):
18731873
if self._can_hold_na:
1874-
w = self._isnan.nonzero()[0]
1875-
return w
1874+
return self._isnan.nonzero()[0]
18761875
else:
18771876
return np.array([], dtype=np.int64)
18781877

pandas/core/indexing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def _setitem_with_indexer(self, indexer, value):
319319
# if there is only one block/type, still have to take split path
320320
# unless the block is one-dimensional or it can hold the value
321321
if not take_split_path and self.obj._data.blocks:
322-
blk, = self.obj._data.blocks
322+
(blk,) = self.obj._data.blocks
323323
if 1 < blk.ndim: # in case of dict, keys are indices
324324
val = list(value.values()) if isinstance(value, dict) else value
325325
take_split_path = not blk._can_hold_element(val)
@@ -1111,7 +1111,7 @@ def _getitem_iterable(self, key, axis: int):
11111111
if com.is_bool_indexer(key):
11121112
# A boolean indexer
11131113
key = check_bool_indexer(labels, key)
1114-
inds, = key.nonzero()
1114+
(inds,) = key.nonzero()
11151115
return self.obj.take(inds, axis=axis)
11161116
else:
11171117
# A collection of keys
@@ -1255,7 +1255,7 @@ def _convert_to_indexer(self, obj, axis: int, raise_missing: bool = False):
12551255

12561256
if com.is_bool_indexer(obj):
12571257
obj = check_bool_indexer(labels, obj)
1258-
inds, = obj.nonzero()
1258+
(inds,) = obj.nonzero()
12591259
return inds
12601260
else:
12611261
# When setting, missing keys are not allowed, even with .loc:

pandas/core/internals/managers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,7 @@ def _shape_compat(x):
18601860

18611861

18621862
def _interleaved_dtype(
1863-
blocks: List[Block]
1863+
blocks: List[Block],
18641864
) -> Optional[Union[np.dtype, ExtensionDtype]]:
18651865
"""Find the common dtype for `blocks`.
18661866

0 commit comments

Comments
 (0)