Skip to content

Commit 087a648

Browse files
committed
none-return
1 parent 625490b commit 087a648

Some content is hidden

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

48 files changed

+170
-168
lines changed

pandas/_testing/contexts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def set_timezone(tz: str) -> Iterator[None]:
6666
import os
6767
import time
6868

69-
def setTZ(tz):
69+
def setTZ(tz) -> None:
7070
if tz is None:
7171
try:
7272
del os.environ["TZ"]

pandas/compat/pickle_compat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def find_class(self, module, name):
210210
Unpickler.dispatch[pkl.REDUCE[0]] = load_reduce
211211

212212

213-
def load_newobj(self):
213+
def load_newobj(self) -> None:
214214
args = self.stack.pop()
215215
cls = self.stack[-1]
216216

@@ -234,7 +234,7 @@ def load_newobj(self):
234234
Unpickler.dispatch[pkl.NEWOBJ[0]] = load_newobj
235235

236236

237-
def load_newobj_ex(self):
237+
def load_newobj_ex(self) -> None:
238238
kwargs = self.stack.pop()
239239
args = self.stack.pop()
240240
cls = self.stack.pop()

pandas/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def ignore_doctest_warning(item: pytest.Item, path: str, message: str) -> None:
135135
item.add_marker(pytest.mark.filterwarnings(f"ignore:{message}"))
136136

137137

138-
def pytest_collection_modifyitems(items, config):
138+
def pytest_collection_modifyitems(items, config) -> None:
139139
skip_slow = config.getoption("--skip-slow")
140140
only_slow = config.getoption("--only-slow")
141141
skip_network = config.getoption("--skip-network")

pandas/core/accessor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def _delegate_method(self, name, *args, **kwargs):
5959
@classmethod
6060
def _add_delegate_accessors(
6161
cls, delegate, accessors, typ: str, overwrite: bool = False
62-
):
62+
) -> None:
6363
"""
6464
Add accessors to cls from the delegate class.
6565

pandas/core/array_algos/take.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ def _get_take_nd_function(
337337

338338
if func is None:
339339

340-
def func(arr, indexer, out, fill_value=np.nan):
340+
def func(arr, indexer, out, fill_value=np.nan) -> None:
341341
indexer = ensure_platform_int(indexer)
342342
_take_nd_object(
343343
arr, indexer, out, axis=axis, fill_value=fill_value, mask_info=mask_info
@@ -349,7 +349,7 @@ def func(arr, indexer, out, fill_value=np.nan):
349349
def _view_wrapper(f, arr_dtype=None, out_dtype=None, fill_wrap=None):
350350
def wrapper(
351351
arr: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=np.nan
352-
):
352+
) -> None:
353353
if arr_dtype is not None:
354354
arr = arr.view(arr_dtype)
355355
if out_dtype is not None:
@@ -364,7 +364,7 @@ def wrapper(
364364
def _convert_wrapper(f, conv_dtype):
365365
def wrapper(
366366
arr: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=np.nan
367-
):
367+
) -> None:
368368
if conv_dtype == object:
369369
# GH#39755 avoid casting dt64/td64 to integers
370370
arr = ensure_wrapped_if_datetimelike(arr)
@@ -506,7 +506,7 @@ def _take_nd_object(
506506
axis: int,
507507
fill_value,
508508
mask_info,
509-
):
509+
) -> None:
510510
if mask_info is not None:
511511
mask, needs_masking = mask_info
512512
else:

pandas/core/arrays/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1698,7 +1698,7 @@ def _create_arithmetic_method(cls, op):
16981698
raise AbstractMethodError(cls)
16991699

17001700
@classmethod
1701-
def _add_arithmetic_ops(cls):
1701+
def _add_arithmetic_ops(cls) -> None:
17021702
setattr(cls, "__add__", cls._create_arithmetic_method(operator.add))
17031703
setattr(cls, "__radd__", cls._create_arithmetic_method(roperator.radd))
17041704
setattr(cls, "__sub__", cls._create_arithmetic_method(operator.sub))
@@ -1723,7 +1723,7 @@ def _create_comparison_method(cls, op):
17231723
raise AbstractMethodError(cls)
17241724

17251725
@classmethod
1726-
def _add_comparison_ops(cls):
1726+
def _add_comparison_ops(cls) -> None:
17271727
setattr(cls, "__eq__", cls._create_comparison_method(operator.eq))
17281728
setattr(cls, "__ne__", cls._create_comparison_method(operator.ne))
17291729
setattr(cls, "__lt__", cls._create_comparison_method(operator.lt))
@@ -1736,7 +1736,7 @@ def _create_logical_method(cls, op):
17361736
raise AbstractMethodError(cls)
17371737

17381738
@classmethod
1739-
def _add_logical_ops(cls):
1739+
def _add_logical_ops(cls) -> None:
17401740
setattr(cls, "__and__", cls._create_logical_method(operator.and_))
17411741
setattr(cls, "__rand__", cls._create_logical_method(roperator.rand_))
17421742
setattr(cls, "__or__", cls._create_logical_method(operator.or_))

pandas/core/arrays/categorical.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2060,7 +2060,7 @@ def _codes(self) -> np.ndarray:
20602060
return self._ndarray
20612061

20622062
@_codes.setter
2063-
def _codes(self, value: np.ndarray):
2063+
def _codes(self, value: np.ndarray) -> None:
20642064
warn(
20652065
"Setting the codes on a Categorical is deprecated and will raise in "
20662066
"a future version. Create a new Categorical object instead",

pandas/core/arrays/datetimelike.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ def __setitem__( # type: ignore[override]
419419

420420
self._maybe_clear_freq()
421421

422-
def _maybe_clear_freq(self):
422+
def _maybe_clear_freq(self) -> None:
423423
# inplace operations like __setitem__ may invalidate the freq of
424424
# DatetimeArray and TimedeltaArray
425425
pass

pandas/core/arrays/period.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ def _unbox_scalar( # type: ignore[override]
342342
def _scalar_from_string(self, value: str) -> Period:
343343
return Period(value, freq=self.freq)
344344

345-
def _check_compatible_with(self, other, setitem: bool = False):
345+
def _check_compatible_with(self, other, setitem: bool = False) -> None:
346346
if other is NaT:
347347
return
348348
self._require_matching_freq(other)

pandas/core/arrays/sparse/array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ def fill_value(self):
661661
return self.dtype.fill_value
662662

663663
@fill_value.setter
664-
def fill_value(self, value):
664+
def fill_value(self, value) -> None:
665665
self._dtype = SparseDtype(self.dtype.subtype, value)
666666

667667
@property

pandas/core/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class NoNewAttributesMixin:
159159
`object.__setattr__(self, key, value)`.
160160
"""
161161

162-
def _freeze(self):
162+
def _freeze(self) -> None:
163163
"""
164164
Prevents setting additional attributes.
165165
"""

pandas/core/computation/engines.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def _is_aligned(self) -> bool:
8888
return self.aligned_axes is not None and self.result_type is not None
8989

9090
@abc.abstractmethod
91-
def _evaluate(self):
91+
def _evaluate(self) -> None:
9292
"""
9393
Return an evaluated expression.
9494

pandas/core/computation/ops.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def value(self):
171171
return self._value
172172

173173
@value.setter
174-
def value(self, new_value):
174+
def value(self, new_value) -> None:
175175
self._value = new_value
176176

177177
@property
@@ -330,7 +330,7 @@ def _not_in(x, y):
330330
_binary_ops_dict.update(d)
331331

332332

333-
def _cast_inplace(terms, acceptable_dtypes, dtype):
333+
def _cast_inplace(terms, acceptable_dtypes, dtype) -> None:
334334
"""
335335
Cast an expression inplace.
336336

pandas/core/computation/pytables.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def __init__(self, op: str, lhs, rhs, queryables: dict[str, Any], encoding) -> N
112112
self.encoding = encoding
113113
self.condition = None
114114

115-
def _disallow_scalar_only_bool_ops(self):
115+
def _disallow_scalar_only_bool_ops(self) -> None:
116116
pass
117117

118118
def prune(self, klass):
@@ -261,7 +261,7 @@ def stringify(value):
261261
else:
262262
raise TypeError(f"Cannot compare {v} of type {type(v)} to {kind} column")
263263

264-
def convert_values(self):
264+
def convert_values(self) -> None:
265265
pass
266266

267267

pandas/core/config_init.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ def is_terminal() -> bool:
365365
validator=is_one_of_factory([None, is_callable]),
366366
)
367367

368-
def _deprecate_column_space(key):
368+
def _deprecate_column_space(key) -> None:
369369
warnings.warn(
370370
"column_space is deprecated and will be removed "
371371
"in a future version. Use df.to_string(col_space=...) "
@@ -390,7 +390,7 @@ def _deprecate_column_space(key):
390390
)
391391
cf.register_option("max_categories", 8, pc_max_categories_doc, validator=is_int)
392392

393-
def _deprecate_negative_int_max_colwidth(key):
393+
def _deprecate_negative_int_max_colwidth(key) -> None:
394394
value = cf.get_option(key)
395395
if value is not None and value < 0:
396396
warnings.warn(

pandas/core/dtypes/missing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def _isna(obj, inf_as_na: bool = False):
234234
return False
235235

236236

237-
def _use_inf_as_na(key):
237+
def _use_inf_as_na(key) -> None:
238238
"""
239239
Option change callback for na/inf behaviour.
240240

pandas/core/frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3949,7 +3949,7 @@ def __setitem__(self, key, value):
39493949
# set column
39503950
self._set_item(key, value)
39513951

3952-
def _setitem_slice(self, key: slice, value):
3952+
def _setitem_slice(self, key: slice, value) -> None:
39533953
# NB: we can't just use self.loc[key] = value because that
39543954
# operates on labels and we need to operate positional for
39553955
# backwards-compat, xref GH#31469

pandas/core/generic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5988,7 +5988,7 @@ def _protect_consolidate(self, f):
59885988
def _consolidate_inplace(self) -> None:
59895989
"""Consolidate data in place and return None"""
59905990

5991-
def f():
5991+
def f() -> None:
59925992
self._mgr = self._mgr.consolidate()
59935993

59945994
self._protect_consolidate(f)
@@ -11564,7 +11564,7 @@ def mad(
1156411564
return np.abs(demeaned).mean(axis=axis, skipna=skipna)
1156511565

1156611566
@classmethod
11567-
def _add_numeric_operations(cls):
11567+
def _add_numeric_operations(cls) -> None:
1156811568
"""
1156911569
Add the operations to the cls; evaluate the doc strings again
1157011570
"""

pandas/core/groupby/grouper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ def _convert_grouper(axis: Index, grouper):
951951
return grouper
952952

953953

954-
def _check_deprecated_resample_kwargs(kwargs, origin):
954+
def _check_deprecated_resample_kwargs(kwargs, origin) -> None:
955955
"""
956956
Check for use of deprecated parameters in ``resample`` and related functions.
957957

pandas/core/indexes/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3199,7 +3199,7 @@ def _validate_sort_keyword(self, sort):
31993199
)
32003200

32013201
@final
3202-
def _deprecate_dti_setop(self, other: Index, setop: str_t):
3202+
def _deprecate_dti_setop(self, other: Index, setop: str_t) -> None:
32033203
"""
32043204
Deprecate setop behavior between timezone-aware DatetimeIndexes with
32053205
mismatched timezones.

pandas/core/indexes/extension.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def fget(self):
7777
return Index(result, name=self.name)
7878
return result
7979

80-
def fset(self, value):
80+
def fset(self, value) -> None:
8181
setattr(self._data, name, value)
8282

8383
fget.__name__ = name

pandas/core/indexing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ def _maybe_mask_setitem_value(self, indexer, value):
769769
return indexer, value
770770

771771
@final
772-
def _ensure_listlike_indexer(self, key, axis=None, value=None):
772+
def _ensure_listlike_indexer(self, key, axis=None, value=None) -> None:
773773
"""
774774
Ensure that a list-like of column labels are all present by adding them if
775775
they do not already exist.
@@ -1952,7 +1952,7 @@ def _setitem_with_indexer_frame_value(self, indexer, value: DataFrame, name: str
19521952

19531953
self._setitem_single_column(loc, val, pi)
19541954

1955-
def _setitem_single_column(self, loc: int, value, plane_indexer):
1955+
def _setitem_single_column(self, loc: int, value, plane_indexer) -> None:
19561956
"""
19571957
19581958
Parameters
@@ -2035,7 +2035,7 @@ def _setitem_single_column(self, loc: int, value, plane_indexer):
20352035
# TODO: what if we got here indirectly via loc?
20362036
return
20372037

2038-
def _setitem_single_block(self, indexer, value, name: str):
2038+
def _setitem_single_block(self, indexer, value, name: str) -> None:
20392039
"""
20402040
_setitem_with_indexer for the case when we have a single Block.
20412041
"""

pandas/core/interchange/dataframe_protocol.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ class DataFrame(ABC):
389389
version = 0 # version of the protocol
390390

391391
@abstractmethod
392-
def __dataframe__(self, nan_as_null: bool = False, allow_copy: bool = True):
392+
def __dataframe__(self, nan_as_null: bool = False, allow_copy: bool = True) -> None:
393393
"""Construct a new interchange object, potentially changing the parameters."""
394394
pass
395395

pandas/core/internals/managers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,7 +1961,7 @@ def unpickle_block(values, mgr_locs, ndim: int) -> Block:
19611961

19621962
self._post_setstate()
19631963

1964-
def _post_setstate(self):
1964+
def _post_setstate(self) -> None:
19651965
pass
19661966

19671967
@cache_readonly
@@ -2077,7 +2077,7 @@ def fast_xs(self, loc):
20772077
"""
20782078
raise NotImplementedError("Use series._values[loc] instead")
20792079

2080-
def set_values(self, values: ArrayLike):
2080+
def set_values(self, values: ArrayLike) -> None:
20812081
"""
20822082
Set the values of the single block in place.
20832083

pandas/core/internals/ops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def operate_blockwise(
8686
return new_mgr
8787

8888

89-
def _reset_block_mgr_locs(nbs: list[Block], locs):
89+
def _reset_block_mgr_locs(nbs: list[Block], locs) -> None:
9090
"""
9191
Reset mgr_locs to correspond to our original DataFrame.
9292
"""

pandas/core/missing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ def _interpolate_1d(
376376
bounds_error: bool = False,
377377
order: int | None = None,
378378
**kwargs,
379-
):
379+
) -> None:
380380
"""
381381
Logic for the 1-d interpolation. The input
382382
indices and yvalues will each be 1-d arrays of the same length.

pandas/core/ops/methods.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,6 @@ def _create_methods(cls, arith_method, comp_method):
119119
return new_methods
120120

121121

122-
def _add_methods(cls, new_methods):
122+
def _add_methods(cls, new_methods) -> None:
123123
for name, method in new_methods.items():
124124
setattr(cls, name, method)

pandas/core/series.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ def _set_with_engine(self, key, value) -> None:
11771177
# this is equivalent to self._values[key] = value
11781178
self._mgr.setitem_inplace(loc, value)
11791179

1180-
def _set_with(self, key, value):
1180+
def _set_with(self, key, value) -> None:
11811181
# We got here via exception-handling off of InvalidIndexError, so
11821182
# key should always be listlike at this point.
11831183
assert not isinstance(key, tuple)
@@ -1215,7 +1215,7 @@ def _set_values(self, key, value) -> None:
12151215
self._mgr = self._mgr.setitem(indexer=key, value=value)
12161216
self._maybe_update_cacher()
12171217

1218-
def _set_value(self, label, value, takeable: bool = False):
1218+
def _set_value(self, label, value, takeable: bool = False) -> None:
12191219
"""
12201220
Quickly set single value at passed label.
12211221

0 commit comments

Comments
 (0)