Skip to content

Commit ae783f2

Browse files
ShaharNavehproost
authored andcommitted
1 parent 0372e23 commit ae783f2

File tree

8 files changed

+17
-13
lines changed

8 files changed

+17
-13
lines changed

pandas/_libs/tslibs/offsets.pyx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import cython
22

33
import time
4+
from typing import Any
45
from cpython.datetime cimport (PyDateTime_IMPORT,
56
PyDateTime_Check,
67
PyDelta_Check,
@@ -328,7 +329,7 @@ class _BaseOffset:
328329
def __setattr__(self, name, value):
329330
raise AttributeError("DateOffset objects are immutable.")
330331

331-
def __eq__(self, other) -> bool:
332+
def __eq__(self, other: Any) -> bool:
332333
if isinstance(other, str):
333334
try:
334335
# 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: Any) -> 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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Extend pandas with custom array types"""
2-
from typing import List, Optional, Tuple, Type
2+
from typing import Any, List, Optional, Tuple, Type
33

44
import numpy as np
55

@@ -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: Any) -> bool:
9090
"""
9191
Check whether 'other' is equal to self.
9292

pandas/core/dtypes/dtypes.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ def __hash__(self) -> int:
764764
# TODO: update this.
765765
return hash(str(self))
766766

767-
def __eq__(self, other) -> bool:
767+
def __eq__(self, other: Any) -> bool:
768768
if isinstance(other, str):
769769
return other == self.name
770770

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

906-
def __eq__(self, other) -> bool:
906+
def __eq__(self, other: Any) -> bool:
907907
if isinstance(other, str):
908908
return other == self.name or other == self.name.title()
909909

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

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

pandas/core/indexes/frozen.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
88
"""
99

10+
from typing import Any
11+
1012
from pandas.core.base import PandasObject
1113

1214
from pandas.io.formats.printing import pprint_thing
@@ -71,7 +73,7 @@ def __radd__(self, other):
7173
other = list(other)
7274
return type(self)(other + list(self))
7375

74-
def __eq__(self, other) -> bool:
76+
def __eq__(self, other: Any) -> bool:
7577
if isinstance(other, (tuple, FrozenList)):
7678
other = list(other)
7779
return super().__eq__(other)

pandas/io/pytables.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1787,7 +1787,7 @@ def __repr__(self) -> str:
17871787
)
17881788
)
17891789

1790-
def __eq__(self, other) -> bool:
1790+
def __eq__(self, other: Any) -> bool:
17911791
""" compare 2 col items """
17921792
return all(
17931793
getattr(self, a, None) == getattr(other, a, None)
@@ -2113,7 +2113,7 @@ def __repr__(self) -> str:
21132113
)
21142114
)
21152115

2116-
def __eq__(self, other) -> bool:
2116+
def __eq__(self, other: Any) -> bool:
21172117
""" compare 2 col items """
21182118
return all(
21192119
getattr(self, a, None) == getattr(other, a, None)

pandas/io/stata.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import os
1616
import struct
1717
import sys
18+
from typing import Any
1819
import warnings
1920

2021
from dateutil.relativedelta import relativedelta
@@ -857,7 +858,7 @@ def __str__(self) -> str:
857858
def __repr__(self) -> str:
858859
return f"{type(self)}({self})"
859860

860-
def __eq__(self, other) -> bool:
861+
def __eq__(self, other: Any) -> bool:
861862
return (
862863
isinstance(other, type(self))
863864
and self.string == other.string

pandas/tseries/offsets.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from datetime import date, datetime, timedelta
22
import functools
33
import operator
4-
from typing import Optional
4+
from typing import Any, Optional
55

66
from dateutil.easter import easter
77
import numpy as np
@@ -2551,7 +2551,7 @@ def __add__(self, other):
25512551
f"the add operation between {self} and {other} will overflow"
25522552
)
25532553

2554-
def __eq__(self, other) -> bool:
2554+
def __eq__(self, other: Any) -> bool:
25552555
if isinstance(other, str):
25562556
from pandas.tseries.frequencies import to_offset
25572557

0 commit comments

Comments
 (0)