-
Notifications
You must be signed in to change notification settings - Fork 5
Allow classmethods to return sub-classes #35
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
Conversation
|
shouldn't we be using |
|
I don't think so, because these are classmethods and therefore don't have a self argument. I took this solution from here: python/typing#254 (comment) |
|
i think the type checker will resolve |
|
ooh okay, let me try |
|
seems to work 👍 |
|
Woops, I should have fixed the string casting in the latest commit. |
|
doctests are failing but that's not due to your changes. |
|
Any chance of a release with this in? - would help with typing over at |
|
sure, I can put out a release tonight or tomorrow |
Currently the
from_zarr()methods are not typed as returning sub-classes correctly. As a concrete example, this means that in this line:https://github.com/BioImageTools/ome-zarr-models-py/blob/4a6851ed1487a90274058dc92ebc3a16539557ed/tests/v04/test_hcs.py#L12
the
hcsvariable does not have the typeHCS, but instead a widerGroupSpectype.This PR should fix that so the from_zarr() methods are correctly typed for sub-classes.