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
Use abstract base class syntax #1562
Conversation
def labels(self): | ||
""" | ||
:return: the list of category labels used by this classifier. | ||
:rtype: list of (immutable) | ||
""" | ||
raise NotImplementedError() | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WekaClassifier
doesn't implement labels()
- this would throw an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, pass
is not needed here, the docstring is enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, thanks. Actually I was just figuring out how to reconcile the "hard" enforcement of abc.abstractmethod
with how how the ClassifierI
ABC is implemented - see 121a24c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dimazest so is it better to remove the pass
statements? Most examples of abstract methods I've seen elsewhere leave it in. I think it's a bit more explicit and clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I would not put the pass
if there is a docstring. It looks redundant, in the sense that there is a code that does nothing.
Looks like some of the abstract classes are tricky - moved the simpler ones to #1639. |
Ref: #1130
This updates most of the abstract base classes with the
@six.add_metaclass
and@abc.abstractmethod
decorators.TODO: