Skip to content

Commit 147e274

Browse files
Clean up merge glitches
Some merge resolutions stepped on my changes. Also run black over everything. Hopefully fixed now. Signed-off-by: Michael Tiemann <[email protected]>
1 parent 84861d2 commit 147e274

File tree

14 files changed

+73
-20
lines changed

14 files changed

+73
-20
lines changed

pandas/core/arrays/_mixins.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,9 @@ def _cast_quantile_result(self, res_values: np.ndarray) -> np.ndarray:
517517
# numpy-like methods
518518

519519
@classmethod
520-
def _empty(cls, shape: Shape, dtype: ExtensionDtype, fill_value: object = None) -> Self:
520+
def _empty(
521+
cls, shape: Shape, dtype: ExtensionDtype, fill_value: object = None
522+
) -> Self:
521523
"""
522524
Analogous to np.empty(shape, dtype=dtype)
523525

pandas/core/arrays/arrow/array.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,14 @@ def __init__(self, values: pa.Array | pa.ChunkedArray) -> None:
251251
self._dtype = ArrowDtype(self._pa_array.type)
252252

253253
@classmethod
254-
def _from_sequence(cls, scalars, *, dtype: Dtype | None = None, fill_value: object | None = None, copy: bool = False):
254+
def _from_sequence(
255+
cls,
256+
scalars,
257+
*,
258+
dtype: Dtype | None = None,
259+
fill_value: object | None = None,
260+
copy: bool = False,
261+
):
255262
"""
256263
Construct a new ExtensionArray from a sequence of scalars.
257264
"""

pandas/core/arrays/base.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,14 @@ class ExtensionArray:
262262
# ------------------------------------------------------------------------
263263

264264
@classmethod
265-
def _from_sequence(cls, scalars, *, dtype: Dtype | None = None, fill_value: object = None, copy: bool = False):
265+
def _from_sequence(
266+
cls,
267+
scalars,
268+
*,
269+
dtype: Dtype | None = None,
270+
fill_value: object = None,
271+
copy: bool = False,
272+
):
266273
"""
267274
Construct a new ExtensionArray from a sequence of scalars.
268275

pandas/core/arrays/categorical.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,12 @@ def _internal_fill_value(self) -> int:
505505

506506
@classmethod
507507
def _from_sequence(
508-
cls, scalars, *, dtype: Dtype | None = None, fill_value: object = None, copy: bool = False
508+
cls,
509+
scalars,
510+
*,
511+
dtype: Dtype | None = None,
512+
fill_value: object = None,
513+
copy: bool = False,
509514
) -> Self:
510515
return cls(scalars, dtype=dtype, copy=copy)
511516

@@ -1800,7 +1805,7 @@ def value_counts(self, dropna: bool = True) -> Series:
18001805
# "ExtensionDtype"
18011806
@classmethod
18021807
def _empty( # type: ignore[override]
1803-
cls, shape: Shape, dtype: CategoricalDtype, fill_value: object = None
1808+
cls, shape: Shape, dtype: CategoricalDtype, fill_value: object = None
18041809
) -> Self:
18051810
"""
18061811
Analogous to np.empty(shape, dtype=dtype)

pandas/core/arrays/datetimes.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,9 @@ def _simple_new( # type: ignore[override]
293293
return result
294294

295295
@classmethod
296-
def _from_sequence(cls, scalars, *, dtype=None, fill_value: object = None, copy: bool = False):
296+
def _from_sequence(
297+
cls, scalars, *, dtype=None, fill_value: object = None, copy: bool = False
298+
):
297299
return cls._from_sequence_not_strict(scalars, dtype=dtype, copy=copy)
298300

299301
@classmethod

pandas/core/arrays/masked.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ def __init__(
145145
self._mask = mask
146146

147147
@classmethod
148-
def _from_sequence(cls, scalars, *, dtype=None, fill_value: object = None, copy: bool = False) -> Self:
148+
def _from_sequence(
149+
cls, scalars, *, dtype=None, fill_value: object = None, copy: bool = False
150+
) -> Self:
149151
values, mask = cls._coerce_to_array(scalars, dtype=dtype, copy=copy)
150152
return cls(values, mask)
151153

pandas/core/arrays/numpy_.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,12 @@ def __init__(
117117

118118
@classmethod
119119
def _from_sequence(
120-
cls, scalars, *, dtype: Dtype | None = None, fill_value: object = None, copy: bool = False
120+
cls,
121+
scalars,
122+
*,
123+
dtype: Dtype | None = None,
124+
fill_value: object = None,
125+
copy: bool = False,
121126
) -> NumpyExtensionArray:
122127
if isinstance(dtype, NumpyEADtype):
123128
dtype = dtype._dtype

pandas/core/arrays/sparse/array.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,14 @@ def __setitem__(self, key, value) -> None:
583583
raise TypeError(msg)
584584

585585
@classmethod
586-
def _from_sequence(cls, scalars, *, dtype: Dtype | None = None, fill_value: object | None = None, copy: bool = False):
586+
def _from_sequence(
587+
cls,
588+
scalars,
589+
*,
590+
dtype: Dtype | None = None,
591+
fill_value: object | None = None,
592+
copy: bool = False,
593+
):
587594
return cls(scalars, dtype=dtype)
588595

589596
@classmethod

pandas/core/arrays/string_.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,14 @@ def _validate(self):
340340
lib.convert_nans_to_NA(self._ndarray)
341341

342342
@classmethod
343-
def _from_sequence(cls, scalars, *, dtype: Dtype | None = None, fill_value: object | None = None, copy: bool = False):
343+
def _from_sequence(
344+
cls,
345+
scalars,
346+
*,
347+
dtype: Dtype | None = None,
348+
fill_value: object | None = None,
349+
copy: bool = False,
350+
):
344351
if dtype and not (isinstance(dtype, str) and dtype == "string"):
345352
dtype = pandas_dtype(dtype)
346353
assert isinstance(dtype, StringDtype) and dtype.storage == "python"
@@ -377,7 +384,7 @@ def _from_sequence_of_strings(
377384
return cls._from_sequence(strings, dtype=dtype, copy=copy)
378385

379386
@classmethod
380-
def _empty(cls, shape, dtype, fill_value = None) -> StringArray:
387+
def _empty(cls, shape, dtype, fill_value=None) -> StringArray:
381388
values = np.empty(shape, dtype=object)
382389
values[:] = libmissing.NA
383390
return cls(values).astype(dtype, copy=False)

pandas/core/arrays/string_arrow.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,13 @@ def __len__(self) -> int:
137137
return len(self._pa_array)
138138

139139
@classmethod
140-
def _from_sequence(cls, scalars, dtype: Dtype | None = None, fill_value: object | None = None, copy: bool = False):
140+
def _from_sequence(
141+
cls,
142+
scalars,
143+
dtype: Dtype | None = None,
144+
fill_value: object | None = None,
145+
copy: bool = False,
146+
):
141147
from pandas.core.arrays.masked import BaseMaskedArray
142148

143149
_chk_pyarrow_available()

pandas/core/arrays/timedeltas.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,9 @@ def _simple_new( # type: ignore[override]
229229
return result
230230

231231
@classmethod
232-
def _from_sequence(cls, data, *, dtype=None, fill_value: object = None, copy: bool = False) -> Self:
232+
def _from_sequence(
233+
cls, data, *, dtype=None, fill_value: object = None, copy: bool = False
234+
) -> Self:
233235
if dtype:
234236
dtype = _validate_td64_dtype(dtype)
235237

pandas/tests/extension/decimal/test_decimal.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def data_for_grouping():
6767

6868
class TestDecimalArray(base.ExtensionTests):
6969
def _get_expected_exception(
70-
self, op_name: str, obj, other
70+
self, op_name: str, obj, other, request
7171
) -> type[Exception] | None:
7272
return None
7373

@@ -108,7 +108,7 @@ def test_compare_array(self, data, comparison_op):
108108
other = pd.Series(data) * [decimal.Decimal(pow(2.0, i)) for i in alter]
109109
self._compare_other(ser, data, comparison_op, other)
110110

111-
def test_arith_series_with_array(self, data, all_arithmetic_operators):
111+
def test_arith_series_with_array(self, data, all_arithmetic_operators, request):
112112
op_name = all_arithmetic_operators
113113
ser = pd.Series(data)
114114

@@ -120,13 +120,13 @@ def test_arith_series_with_array(self, data, all_arithmetic_operators):
120120

121121
# Decimal supports ops with int, but not float
122122
other = pd.Series([int(d * 100) for d in data])
123-
self.check_opname(ser, op_name, other)
123+
self.check_opname(ser, op_name, other, request)
124124

125125
if "mod" not in op_name:
126-
self.check_opname(ser, op_name, ser * 2)
126+
self.check_opname(ser, op_name, ser * 2, request)
127127

128-
self.check_opname(ser, op_name, 0)
129-
self.check_opname(ser, op_name, 5)
128+
self.check_opname(ser, op_name, 0, request)
129+
self.check_opname(ser, op_name, 5, request)
130130
context.traps[decimal.DivisionByZero] = divbyzerotrap
131131
context.traps[decimal.InvalidOperation] = invalidoptrap
132132

pandas/tests/extension/test_masked.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def data_for_grouping(dtype):
160160

161161

162162
class TestMaskedArrays(base.ExtensionTests):
163-
def _get_expected_exception(self, op_name, obj, other):
163+
def _get_expected_exception(self, op_name, obj, other, request):
164164
try:
165165
dtype = tm.get_dtype(obj)
166166
except AttributeError:

pandas/tests/extension/test_numpy.py

+1
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ def _get_expected_exception(
315315
pytest.mark.xfail(
316316
raises=TypeError,
317317
reason=f"{marked_reason} does not support {op_name}",
318+
strict=False,
318319
)
319320
)
320321
return TypeError

0 commit comments

Comments
 (0)