diff --git a/pandas/errors/__init__.py b/pandas/errors/__init__.py index 43ce8ad4abb45..ebe9a3d5bf472 100644 --- a/pandas/errors/__init__.py +++ b/pandas/errors/__init__.py @@ -156,19 +156,23 @@ class MergeError(ValueError): class AccessorRegistrationWarning(Warning): - """Warning for attribute conflicts in accessor registration.""" + """ + Warning for attribute conflicts in accessor registration. + """ class AbstractMethodError(NotImplementedError): - """Raise this error instead of NotImplementedError for abstract methods + """ + Raise this error instead of NotImplementedError for abstract methods while keeping compatibility with Python 2 and Python 3. """ def __init__(self, class_instance, methodtype="method"): types = {"method", "classmethod", "staticmethod", "property"} if methodtype not in types: - msg = f"methodtype must be one of {methodtype}, got {types} instead." - raise ValueError(msg) + raise ValueError( + f"methodtype must be one of {methodtype}, got {types} instead." + ) self.methodtype = methodtype self.class_instance = class_instance @@ -177,5 +181,4 @@ def __str__(self) -> str: name = self.class_instance.__name__ else: name = type(self.class_instance).__name__ - msg = f"This {self.methodtype} must be defined in the concrete class {name}" - return msg.format(methodtype=self.methodtype, name=name) + return f"This {self.methodtype} must be defined in the concrete class {name}"