Skip to content

Commit b18024d

Browse files
ShaharNavehsimonjayhawkins
authored andcommitted
STY: Whitespaces placed at the beginning instead at the end of a line (#30996)
1 parent 0f048cb commit b18024d

Some content is hidden

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

42 files changed

+150
-154
lines changed

pandas/core/arrays/categorical.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2404,8 +2404,8 @@ def isin(self, values):
24042404
if not is_list_like(values):
24052405
values_type = type(values).__name__
24062406
raise TypeError(
2407-
"only list-like objects are allowed to be passed"
2408-
f" to isin(), you passed a [{values_type}]"
2407+
"only list-like objects are allowed to be passed "
2408+
f"to isin(), you passed a [{values_type}]"
24092409
)
24102410
values = sanitize_array(values, None, None)
24112411
null_mask = np.asarray(isna(values))

pandas/core/arrays/datetimes.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,10 @@ def __init__(self, values, dtype=_NS_DTYPE, freq=None, copy=False):
234234
values = values._data
235235

236236
if not isinstance(values, np.ndarray):
237-
msg = (
237+
raise ValueError(
238238
f"Unexpected type '{type(values).__name__}'. 'values' must be "
239239
"a DatetimeArray ndarray, or Series or Index containing one of those."
240240
)
241-
raise ValueError(msg)
242241
if values.ndim not in [1, 2]:
243242
raise ValueError("Only 1-dimensional input arrays are supported.")
244243

@@ -249,20 +248,18 @@ def __init__(self, values, dtype=_NS_DTYPE, freq=None, copy=False):
249248
values = values.view(_NS_DTYPE)
250249

251250
if values.dtype != _NS_DTYPE:
252-
msg = (
253-
"The dtype of 'values' is incorrect. Must be 'datetime64[ns]'."
254-
f" Got {values.dtype} instead."
251+
raise ValueError(
252+
"The dtype of 'values' is incorrect. Must be 'datetime64[ns]'. "
253+
f"Got {values.dtype} instead."
255254
)
256-
raise ValueError(msg)
257255

258256
dtype = _validate_dt64_dtype(dtype)
259257

260258
if freq == "infer":
261-
msg = (
259+
raise ValueError(
262260
"Frequency inference not allowed in DatetimeArray.__init__. "
263261
"Use 'pd.array()' instead."
264262
)
265-
raise ValueError(msg)
266263

267264
if copy:
268265
values = values.copy()

pandas/core/arrays/period.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,8 @@ def __arrow_array__(self, type=None):
297297
# ensure we have the same freq
298298
if self.freqstr != type.freq:
299299
raise TypeError(
300-
"Not supported to convert PeriodArray to array with different"
301-
f" 'freq' ({self.freqstr} vs {type.freq})"
300+
"Not supported to convert PeriodArray to array with different "
301+
f"'freq' ({self.freqstr} vs {type.freq})"
302302
)
303303
else:
304304
raise TypeError(

pandas/core/computation/expr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,8 @@ def _maybe_evaluate_binop(
466466

467467
if res.has_invalid_return_type:
468468
raise TypeError(
469-
f"unsupported operand type(s) for {res.op}:"
470-
f" '{lhs.type}' and '{rhs.type}'"
469+
f"unsupported operand type(s) for {res.op}: "
470+
f"'{lhs.type}' and '{rhs.type}'"
471471
)
472472

473473
if self.engine != "pytables":

pandas/core/generic.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,8 @@ def _validate_dtype(self, dtype):
265265
# a compound dtype
266266
if dtype.kind == "V":
267267
raise NotImplementedError(
268-
"compound dtypes are not implemented"
269-
f" in the {type(self).__name__} constructor"
268+
"compound dtypes are not implemented "
269+
f"in the {type(self).__name__} constructor"
270270
)
271271

272272
return dtype
@@ -8993,11 +8993,10 @@ def tshift(
89938993
new_data = self._data.copy()
89948994
new_data.axes[block_axis] = index.shift(periods)
89958995
elif orig_freq is not None:
8996-
msg = (
8997-
f"Given freq {freq.rule_code} does not match"
8998-
f" PeriodIndex freq {orig_freq.rule_code}"
8996+
raise ValueError(
8997+
f"Given freq {freq.rule_code} does not match "
8998+
f"PeriodIndex freq {orig_freq.rule_code}"
89998999
)
9000-
raise ValueError(msg)
90019000
else:
90029001
new_data = self._data.copy()
90039002
new_data.axes[block_axis] = index.shift(periods, freq)

pandas/core/indexes/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4790,8 +4790,8 @@ def get_slice_bound(self, label, side, kind):
47904790

47914791
if side not in ("left", "right"):
47924792
raise ValueError(
4793-
f"Invalid value for side kwarg, must be either"
4794-
f" 'left' or 'right': {side}"
4793+
"Invalid value for side kwarg, must be either "
4794+
f"'left' or 'right': {side}"
47954795
)
47964796

47974797
original_label = label

pandas/core/indexes/multi.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,8 +1288,8 @@ def _get_level_number(self, level) -> int:
12881288
if level < 0:
12891289
orig_level = level - self.nlevels
12901290
raise IndexError(
1291-
f"Too many levels: Index has only {self.nlevels} levels,"
1292-
f" {orig_level} is not a valid level number"
1291+
f"Too many levels: Index has only {self.nlevels} levels, "
1292+
f"{orig_level} is not a valid level number"
12931293
)
12941294
# Note: levels are zero-based
12951295
elif level >= self.nlevels:
@@ -2171,8 +2171,8 @@ def reorder_levels(self, order):
21712171
order = [self._get_level_number(i) for i in order]
21722172
if len(order) != self.nlevels:
21732173
raise AssertionError(
2174-
f"Length of order must be same as number of levels ({self.nlevels}),"
2175-
f" got {len(order)}"
2174+
f"Length of order must be same as number of levels ({self.nlevels}), "
2175+
f"got {len(order)}"
21762176
)
21772177
new_levels = [self.levels[i] for i in order]
21782178
new_codes = [self.codes[i] for i in order]
@@ -2527,8 +2527,8 @@ def slice_locs(self, start=None, end=None, step=None, kind=None):
25272527
def _partial_tup_index(self, tup, side="left"):
25282528
if len(tup) > self.lexsort_depth:
25292529
raise UnsortedIndexError(
2530-
f"Key length ({len(tup)}) was greater than MultiIndex lexsort depth"
2531-
f" ({self.lexsort_depth})"
2530+
f"Key length ({len(tup)}) was greater than MultiIndex lexsort depth "
2531+
f"({self.lexsort_depth})"
25322532
)
25332533

25342534
n = len(tup)

pandas/core/series.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,8 +1404,8 @@ def to_string(
14041404
# catch contract violations
14051405
if not isinstance(result, str):
14061406
raise AssertionError(
1407-
"result must be of type str, type"
1408-
f" of result is {repr(type(result).__name__)}"
1407+
"result must be of type str, type "
1408+
f"of result is {repr(type(result).__name__)}"
14091409
)
14101410

14111411
if buf is None:

pandas/io/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ def get_handle(
406406
raise ValueError(f"Zero files found in ZIP file {path_or_buf}")
407407
else:
408408
raise ValueError(
409-
"Multiple files found in ZIP file."
410-
f" Only one file per ZIP: {zip_names}"
409+
"Multiple files found in ZIP file. "
410+
f"Only one file per ZIP: {zip_names}"
411411
)
412412

413413
# XZ Compression

pandas/io/parsers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -906,8 +906,8 @@ def _get_options_with_defaults(self, engine):
906906
pass
907907
else:
908908
raise ValueError(
909-
f"The {repr(argname)} option is not supported with the"
910-
f" {repr(engine)} engine"
909+
f"The {repr(argname)} option is not supported with the "
910+
f"{repr(engine)} engine"
911911
)
912912
else:
913913
value = _deprecated_defaults.get(argname, default)

0 commit comments

Comments
 (0)