Skip to content

Commit 1761408

Browse files
committed
renamed self.__class__ to type(self)
1 parent d1132f4 commit 1761408

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

pandas/core/indexes/base.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ def take(self, indices, axis=0, allow_fill=True, fill_value=None, **kwargs):
813813
)
814814
else:
815815
if allow_fill and fill_value is not None:
816-
cls_name = self.__class__.__name__
816+
cls_name = type(self).__name__
817817
raise ValueError(
818818
f"Unable to fill values because {cls_name} cannot contain NA"
819819
)
@@ -1287,9 +1287,7 @@ def _set_names(self, values, level=None):
12871287
# All items in 'name' need to be hashable:
12881288
for name in values:
12891289
if not is_hashable(name):
1290-
raise TypeError(
1291-
f"{self.__class__.__name__}.name must be a hashable type"
1292-
)
1290+
raise TypeError(f"{type(self).__name__}.name must be a hashable type")
12931291
self.name = values[0]
12941292

12951293
names = property(fset=_set_names, fget=_get_names)
@@ -2286,7 +2284,7 @@ def __xor__(self, other):
22862284

22872285
def __nonzero__(self):
22882286
raise ValueError(
2289-
f"The truth value of a {self.__class__.__name__} is ambiguous. "
2287+
f"The truth value of a {type(self).__name__} is ambiguous. "
22902288
"Use a.empty, a.bool(), a.item(), a.any() or a.all()."
22912289
)
22922290

0 commit comments

Comments
 (0)