Skip to content

STY: Style fix pandas/errors/__init__.py #30066

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions pandas/errors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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}"