Skip to content

Commit 4539087

Browse files
ShaharNavehMateusz Górski
authored and
Mateusz Górski
committed
CLN:Typing in pandas/core/dtypes/ (pandas-dev#29606)
1 parent 2e76aa7 commit 4539087

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

pandas/core/dtypes/base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def __from_arrow__(
8686
def __str__(self) -> str:
8787
return self.name
8888

89-
def __eq__(self, other):
89+
def __eq__(self, other) -> bool:
9090
"""
9191
Check whether 'other' is equal to self.
9292
@@ -119,7 +119,7 @@ def __eq__(self, other):
119119
def __hash__(self) -> int:
120120
return hash(tuple(getattr(self, attr) for attr in self._metadata))
121121

122-
def __ne__(self, other):
122+
def __ne__(self, other) -> bool:
123123
return not self.__eq__(other)
124124

125125
@property

pandas/core/dtypes/common.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ def is_string_dtype(arr_or_dtype) -> bool:
726726
"""
727727

728728
# TODO: gh-15585: consider making the checks stricter.
729-
def condition(dtype):
729+
def condition(dtype) -> bool:
730730
return dtype.kind in ("O", "S", "U") and not is_period_dtype(dtype)
731731

732732
return _is_dtype(arr_or_dtype, condition)
@@ -1496,7 +1496,7 @@ def is_bool_dtype(arr_or_dtype) -> bool:
14961496
return issubclass(dtype.type, np.bool_)
14971497

14981498

1499-
def is_extension_type(arr):
1499+
def is_extension_type(arr) -> bool:
15001500
"""
15011501
Check whether an array-like is of a pandas extension class instance.
15021502
@@ -1561,7 +1561,7 @@ def is_extension_type(arr):
15611561
return False
15621562

15631563

1564-
def is_extension_array_dtype(arr_or_dtype):
1564+
def is_extension_array_dtype(arr_or_dtype) -> bool:
15651565
"""
15661566
Check if an object is a pandas extension array type.
15671567

pandas/core/dtypes/concat.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def concat_compat(to_concat, axis: int = 0):
8888

8989
# filter empty arrays
9090
# 1-d dtypes always are included here
91-
def is_nonempty(x):
91+
def is_nonempty(x) -> bool:
9292
if x.ndim <= axis:
9393
return True
9494
return x.shape[axis] > 0

pandas/core/dtypes/dtypes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def register_extension_dtype(cls: Type[ExtensionDtype]) -> Type[ExtensionDtype]:
5151

5252
class Registry:
5353
"""
54-
Registry for dtype inference
54+
Registry for dtype inference.
5555
5656
The registry allows one to map a string repr of a extension
5757
dtype to an extension dtype. The string alias can be used in several

pandas/core/dtypes/missing.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ def notna(obj):
375375
notnull = notna
376376

377377

378-
def _isna_compat(arr, fill_value=np.nan):
378+
def _isna_compat(arr, fill_value=np.nan) -> bool:
379379
"""
380380
Parameters
381381
----------
@@ -392,7 +392,7 @@ def _isna_compat(arr, fill_value=np.nan):
392392
return True
393393

394394

395-
def array_equivalent(left, right, strict_nan: bool = False):
395+
def array_equivalent(left, right, strict_nan: bool = False) -> bool:
396396
"""
397397
True if two arrays, left and right, have equal non-NaN elements, and NaNs
398398
in corresponding locations. False otherwise. It is assumed that left and

0 commit comments

Comments
 (0)