Skip to content

Commit bae6f49

Browse files
author
MomIsBestFriend
committed
Added 'object' annotation to 'other'
1 parent 4b9cc76 commit bae6f49

File tree

13 files changed

+17
-17
lines changed

13 files changed

+17
-17
lines changed

pandas/_libs/tslibs/offsets.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ class _BaseOffset:
328328
def __setattr__(self, name, value):
329329
raise AttributeError("DateOffset objects are immutable.")
330330

331-
def __eq__(self, other) -> bool:
331+
def __eq__(self, other: object) -> bool:
332332
if isinstance(other, str):
333333
try:
334334
# GH#23524 if to_offset fails, we are dealing with an

pandas/core/arrays/sparse/dtype.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __hash__(self):
9090
# __eq__, so we explicitly do it here.
9191
return super().__hash__()
9292

93-
def __eq__(self, other) -> bool:
93+
def __eq__(self, other: object) -> bool:
9494
# We have to override __eq__ to handle NA values in _metadata.
9595
# The base class does simple == checks, which fail for NA.
9696
if isinstance(other, str):

pandas/core/dtypes/base.py

+1-1
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) -> bool:
89+
def __eq__(self, other: object) -> bool:
9090
"""
9191
Check whether 'other' is equal to self.
9292

pandas/core/dtypes/dtypes.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ def __hash__(self) -> int:
370370
# We *do* want to include the real self.ordered here
371371
return int(self._hash_categories(self.categories, self._ordered))
372372

373-
def __eq__(self, other: Any) -> bool:
373+
def __eq__(self, other: object) -> bool:
374374
"""
375375
Rules for CDT equality:
376376
1) Any CDT is equal to the string 'category'
@@ -765,7 +765,7 @@ def __hash__(self) -> int:
765765
# TODO: update this.
766766
return hash(str(self))
767767

768-
def __eq__(self, other) -> bool:
768+
def __eq__(self, other: object) -> bool:
769769
if isinstance(other, str):
770770
return other == self.name
771771

@@ -904,7 +904,7 @@ def __hash__(self) -> int:
904904
# make myself hashable
905905
return hash(str(self))
906906

907-
def __eq__(self, other) -> bool:
907+
def __eq__(self, other: object) -> bool:
908908
if isinstance(other, str):
909909
return other == self.name or other == self.name.title()
910910

@@ -1077,7 +1077,7 @@ def __hash__(self) -> int:
10771077
# make myself hashable
10781078
return hash(str(self))
10791079

1080-
def __eq__(self, other) -> bool:
1080+
def __eq__(self, other: object) -> bool:
10811081
if isinstance(other, str):
10821082
return other.lower() in (self.name.lower(), str(self).lower())
10831083
elif not isinstance(other, IntervalDtype):

pandas/core/indexes/frozen.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def __radd__(self, other):
7777
other = list(other)
7878
return self.__class__(other + list(self))
7979

80-
def __eq__(self, other) -> bool:
80+
def __eq__(self, other: object) -> bool:
8181
if isinstance(other, (tuple, FrozenList)):
8282
other = list(other)
8383
return super().__eq__(other)

pandas/io/pytables.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1773,7 +1773,7 @@ def __repr__(self) -> str:
17731773
)
17741774
)
17751775

1776-
def __eq__(self, other) -> bool:
1776+
def __eq__(self, other: object) -> bool:
17771777
""" compare 2 col items """
17781778
return all(
17791779
getattr(self, a, None) == getattr(other, a, None)
@@ -2109,7 +2109,7 @@ def __repr__(self) -> str:
21092109
)
21102110
)
21112111

2112-
def __eq__(self, other) -> bool:
2112+
def __eq__(self, other: object) -> bool:
21132113
""" compare 2 col items """
21142114
return all(
21152115
getattr(self, a, None) == getattr(other, a, None)

pandas/io/stata.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ def __repr__(self) -> str:
859859
# not perfect :-/
860860
return "{cls}({obj})".format(cls=self.__class__, obj=self)
861861

862-
def __eq__(self, other) -> bool:
862+
def __eq__(self, other: object) -> bool:
863863
return (
864864
isinstance(other, self.__class__)
865865
and self.string == other.string

pandas/tests/groupby/test_function.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,7 @@ def __init__(self, msg="I will raise inside Cython"):
12301230
super().__init__()
12311231
self.msg = msg
12321232

1233-
def __eq__(self, other):
1233+
def __eq__(self, other: object):
12341234
# gets called in Cython to check that raising calls the method
12351235
raise RaisingObjectException(self.msg)
12361236

pandas/tests/indexing/test_indexing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ def __str__(self) -> str:
595595

596596
__repr__ = __str__
597597

598-
def __eq__(self, other) -> bool:
598+
def __eq__(self, other: object) -> bool:
599599
return self.value == other.value
600600

601601
def view(self):

pandas/tests/scalar/timedelta/test_timedelta.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def generic_result(self):
139139
else:
140140
return self.cmp_result
141141

142-
def __eq__(self, other):
142+
def __eq__(self, other: object):
143143
return self.generic_result()
144144

145145
def __gt__(self, other):

pandas/tests/series/test_ufunc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def __add__(self, other):
282282
other = getattr(other, "value", other)
283283
return type(self)(self.value + other)
284284

285-
def __eq__(self, other) -> bool:
285+
def __eq__(self, other: object) -> bool:
286286
return type(other) is Thing and self.value == other.value
287287

288288
def __repr__(self) -> str:

pandas/tests/test_algos.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ def test_same_object_is_in(self):
767767
# with similar behavior, then we at least should
768768
# fall back to usual python's behavior: "a in [a] == True"
769769
class LikeNan:
770-
def __eq__(self, other) -> bool:
770+
def __eq__(self, other: object) -> bool:
771771
return False
772772

773773
def __hash__(self):

pandas/tseries/offsets.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2577,7 +2577,7 @@ def __add__(self, other):
25772577
"will overflow".format(self=self, other=other)
25782578
)
25792579

2580-
def __eq__(self, other) -> bool:
2580+
def __eq__(self, other: object) -> bool:
25812581
if isinstance(other, str):
25822582
from pandas.tseries.frequencies import to_offset
25832583

0 commit comments

Comments
 (0)