-
Notifications
You must be signed in to change notification settings - Fork 6
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
Bug: Sortinfo inheritance #24
Comments
While I'm not certain, this could be due to |
Perhaps it would be a good time to refactor the Sortinfo code using |
Having said that, I can't recreate this bug. >>> import pydmrs.core
>>> n = pydmrs.core.Node(sortinfo=pydmrs.components.EventSortinfo()) I get no errors in the above code. And checking more directly: >>> import pydmrs.components
>>> e = pydmrs.components.EventSortinfo()
>>> isinstance(e, pydmrs.components.Sortinfo)
True
>>> x = pydmrs.components.InstanceSortinfo()
>>> isinstance(x, pydmrs.components.Sortinfo)
True |
Although I wonder why something like SortInfo needs metaclasses at all. It seems the motivation is to allow features to be class attributes ( |
I used a metaclass with other grammars in mind -- I wanted to make it as easy as possible for users to specify features in their own subclasses, e.g. class MatrixInstanceSortinfo(InstanceSortinfo):
__slots__ = ('cog_st',) Although I will admit I haven't documented this properly, other than a comment in the code that says "Users can define subclasses with additional features". |
pydmrs/pydmrs/core.py
Line 145 in 6d24bda
If
sortinfo
is of type EventSortinfo or InstanceSortinfo, the check fails and we end up with PydmrsTypeError: unsupported type for sortinfo. Something is wrong with how the inheritance is set up.This shows up when you're custom building a Node from scratch, I haven't encountered it in other scenarios.
The text was updated successfully, but these errors were encountered: