Skip to content

Commit 631f0b2

Browse files
MarcoGorelliKevin D Smith
authored and
Kevin D Smith
committed
CLN remove unnecessary trailing commas to get ready for new version of black: _testing -> generic (pandas-dev#35949)
* pandas/_testing.py * pandas/core/algorithms.py * pandas/core/arrays/_mixins.py * pandas/core/arrays/categorical.py * pandas/core/arrays/integer.py * pandas/core/arrays/masked.py * pandas/core/arrays/numpy_.py * pandas/core/arrays/period.py * pandas/core/construction.py * pandas/core/generic.py
1 parent 110d5c9 commit 631f0b2

File tree

10 files changed

+21
-29
lines changed

10 files changed

+21
-29
lines changed

pandas/_testing.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,7 @@ def assert_categorical_equal(
939939
if check_category_order:
940940
assert_index_equal(left.categories, right.categories, obj=f"{obj}.categories")
941941
assert_numpy_array_equal(
942-
left.codes, right.codes, check_dtype=check_dtype, obj=f"{obj}.codes",
942+
left.codes, right.codes, check_dtype=check_dtype, obj=f"{obj}.codes"
943943
)
944944
else:
945945
try:
@@ -948,9 +948,7 @@ def assert_categorical_equal(
948948
except TypeError:
949949
# e.g. '<' not supported between instances of 'int' and 'str'
950950
lc, rc = left.categories, right.categories
951-
assert_index_equal(
952-
lc, rc, obj=f"{obj}.categories",
953-
)
951+
assert_index_equal(lc, rc, obj=f"{obj}.categories")
954952
assert_index_equal(
955953
left.categories.take(left.codes),
956954
right.categories.take(right.codes),
@@ -1092,7 +1090,7 @@ def _raise(left, right, err_msg):
10921090
if err_msg is None:
10931091
if left.shape != right.shape:
10941092
raise_assert_detail(
1095-
obj, f"{obj} shapes are different", left.shape, right.shape,
1093+
obj, f"{obj} shapes are different", left.shape, right.shape
10961094
)
10971095

10981096
diff = 0
@@ -1559,7 +1557,7 @@ def assert_frame_equal(
15591557
# shape comparison
15601558
if left.shape != right.shape:
15611559
raise_assert_detail(
1562-
obj, f"{obj} shape mismatch", f"{repr(left.shape)}", f"{repr(right.shape)}",
1560+
obj, f"{obj} shape mismatch", f"{repr(left.shape)}", f"{repr(right.shape)}"
15631561
)
15641562

15651563
if check_like:
@@ -2884,7 +2882,7 @@ def convert_rows_list_to_csv_str(rows_list: List[str]):
28842882
return expected
28852883

28862884

2887-
def external_error_raised(expected_exception: Type[Exception],) -> ContextManager:
2885+
def external_error_raised(expected_exception: Type[Exception]) -> ContextManager:
28882886
"""
28892887
Helper function to mark pytest.raises that have an external error message.
28902888

pandas/core/algorithms.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ def isin(comps: AnyArrayLike, values: AnyArrayLike) -> np.ndarray:
462462

463463

464464
def _factorize_array(
465-
values, na_sentinel: int = -1, size_hint=None, na_value=None, mask=None,
465+
values, na_sentinel: int = -1, size_hint=None, na_value=None, mask=None
466466
) -> Tuple[np.ndarray, np.ndarray]:
467467
"""
468468
Factorize an array-like to codes and uniques.

pandas/core/arrays/_mixins.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def take(
4040
fill_value = self._validate_fill_value(fill_value)
4141

4242
new_data = take(
43-
self._ndarray, indices, allow_fill=allow_fill, fill_value=fill_value,
43+
self._ndarray, indices, allow_fill=allow_fill, fill_value=fill_value
4444
)
4545
return self._from_backing_data(new_data)
4646

pandas/core/arrays/categorical.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1505,7 +1505,7 @@ def argsort(self, ascending=True, kind="quicksort", **kwargs):
15051505
return super().argsort(ascending=ascending, kind=kind, **kwargs)
15061506

15071507
def sort_values(
1508-
self, inplace: bool = False, ascending: bool = True, na_position: str = "last",
1508+
self, inplace: bool = False, ascending: bool = True, na_position: str = "last"
15091509
):
15101510
"""
15111511
Sort the Categorical by category value returning a new

pandas/core/arrays/integer.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def __from_arrow__(
138138
return IntegerArray._concat_same_type(results)
139139

140140

141-
def integer_array(values, dtype=None, copy: bool = False,) -> "IntegerArray":
141+
def integer_array(values, dtype=None, copy: bool = False) -> "IntegerArray":
142142
"""
143143
Infer and return an integer array of the values.
144144
@@ -182,7 +182,7 @@ def safe_cast(values, dtype, copy: bool):
182182

183183

184184
def coerce_to_array(
185-
values, dtype, mask=None, copy: bool = False,
185+
values, dtype, mask=None, copy: bool = False
186186
) -> Tuple[np.ndarray, np.ndarray]:
187187
"""
188188
Coerce the input values array to numpy arrays with a mask

pandas/core/arrays/masked.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def __invert__(self: BaseMaskedArrayT) -> BaseMaskedArrayT:
126126
return type(self)(~self._data, self._mask)
127127

128128
def to_numpy(
129-
self, dtype=None, copy: bool = False, na_value: Scalar = lib.no_default,
129+
self, dtype=None, copy: bool = False, na_value: Scalar = lib.no_default
130130
) -> np.ndarray:
131131
"""
132132
Convert to a NumPy Array.

pandas/core/arrays/numpy_.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def isna(self) -> np.ndarray:
280280
return isna(self._ndarray)
281281

282282
def fillna(
283-
self, value=None, method: Optional[str] = None, limit: Optional[int] = None,
283+
self, value=None, method: Optional[str] = None, limit: Optional[int] = None
284284
) -> "PandasArray":
285285
# TODO(_values_for_fillna): remove this
286286
value, method = validate_fillna_kwargs(value, method)

pandas/core/arrays/period.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ def _sub_period_array(self, other):
634634
return new_values
635635

636636
def _addsub_int_array(
637-
self, other: np.ndarray, op: Callable[[Any, Any], Any],
637+
self, other: np.ndarray, op: Callable[[Any, Any], Any]
638638
) -> "PeriodArray":
639639
"""
640640
Add or subtract array of integers; equivalent to applying

pandas/core/construction.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,7 @@ def sanitize_array(
514514
return subarr
515515

516516

517-
def _try_cast(
518-
arr, dtype: Optional[DtypeObj], copy: bool, raise_cast_failure: bool,
519-
):
517+
def _try_cast(arr, dtype: Optional[DtypeObj], copy: bool, raise_cast_failure: bool):
520518
"""
521519
Convert input to numpy ndarray and optionally cast to a given dtype.
522520

pandas/core/generic.py

+7-11
Original file line numberDiff line numberDiff line change
@@ -315,17 +315,13 @@ def _data(self):
315315
@property
316316
def _AXIS_NUMBERS(self) -> Dict[str, int]:
317317
""".. deprecated:: 1.1.0"""
318-
warnings.warn(
319-
"_AXIS_NUMBERS has been deprecated.", FutureWarning, stacklevel=3,
320-
)
318+
warnings.warn("_AXIS_NUMBERS has been deprecated.", FutureWarning, stacklevel=3)
321319
return {"index": 0}
322320

323321
@property
324322
def _AXIS_NAMES(self) -> Dict[int, str]:
325323
""".. deprecated:: 1.1.0"""
326-
warnings.warn(
327-
"_AXIS_NAMES has been deprecated.", FutureWarning, stacklevel=3,
328-
)
324+
warnings.warn("_AXIS_NAMES has been deprecated.", FutureWarning, stacklevel=3)
329325
return {0: "index"}
330326

331327
def _construct_axes_dict(self, axes=None, **kwargs):
@@ -5128,7 +5124,7 @@ def pipe(self, func, *args, **kwargs):
51285124
... .pipe(g, arg1=a)
51295125
... .pipe((func, 'arg2'), arg1=a, arg3=c)
51305126
... ) # doctest: +SKIP
5131-
"""
5127+
"""
51325128
return com.pipe(self, func, *args, **kwargs)
51335129

51345130
_shared_docs["aggregate"] = dedent(
@@ -5630,7 +5626,7 @@ def astype(
56305626

56315627
else:
56325628
# else, only a single dtype is given
5633-
new_data = self._mgr.astype(dtype=dtype, copy=copy, errors=errors,)
5629+
new_data = self._mgr.astype(dtype=dtype, copy=copy, errors=errors)
56345630
return self._constructor(new_data).__finalize__(self, method="astype")
56355631

56365632
# GH 33113: handle empty frame or series
@@ -6520,7 +6516,7 @@ def replace(
65206516
3 b
65216517
4 b
65226518
dtype: object
6523-
"""
6519+
"""
65246520
if not (
65256521
is_scalar(to_replace)
65266522
or is_re_compilable(to_replace)
@@ -7772,7 +7768,7 @@ def between_time(
77727768
raise TypeError("Index must be DatetimeIndex")
77737769

77747770
indexer = index.indexer_between_time(
7775-
start_time, end_time, include_start=include_start, include_end=include_end,
7771+
start_time, end_time, include_start=include_start, include_end=include_end
77767772
)
77777773
return self._take_with_is_copy(indexer, axis=axis)
77787774

@@ -8939,7 +8935,7 @@ def _where(
89398935

89408936
self._check_inplace_setting(other)
89418937
new_data = self._mgr.putmask(
8942-
mask=cond, new=other, align=align, axis=block_axis,
8938+
mask=cond, new=other, align=align, axis=block_axis
89438939
)
89448940
result = self._constructor(new_data)
89458941
return self._update_inplace(result)

0 commit comments

Comments
 (0)