-
Notifications
You must be signed in to change notification settings - Fork 59
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
Permit superclass to subclass lazy typing #696
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #696 +/- ##
==========================================
+ Coverage 83.35% 83.52% +0.17%
==========================================
Files 24 24
Lines 4949 4970 +21
Branches 1411 1415 +4
==========================================
+ Hits 4125 4151 +26
+ Misses 816 812 -4
+ Partials 8 7 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
c64b904
to
ff5cb7b
Compare
dcd0a80
to
d6c3e2f
Compare
d6c3e2f
to
7708c9b
Compare
a6605e4
to
fd0e6f1
Compare
NB: rebased on master to pick up new slurm test |
i've restarted the failing slurm test, perhaps we should extend some time in GA |
…in input/output specs
b92e322
to
0faac56
Compare
|
||
wf.add( # Generic task | ||
other_specific_task( | ||
in_file=wf.entry.lzout.out.cast(MyOtherFormatX), |
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.
Is this cast a method on fileformats? Four attribute accesses feels like a lot to follow. I would find it more straightforward to have a function:
in_file=wf.entry.lzout.out.cast(MyOtherFormatX), | |
in_file=pydra.cast(wf.entry.lzout.out, MyOtherFormatX), |
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.
This isn't fileformats specific, it can be any class that is able to be "cast", i.e. newclass(oldinstance) is valid code such as Path("mystring"). I'm not averse to your suggested syntax, but since it would only be applicable to lazy fields I think I would find having it as a method more convenient
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.
Overall this looks good. The pydra.cast()
proposal is a bikeshed we can paint another day.
That last commit seems to have broken things.
|
This is a bit tricky as I can't quite remember what my desired logic was. However, I have decided the tests failed because they were too strict instead of a bug in the code. Basicially, it comes down to whether
Given the philosophy of permissive typing at construction time, i.e. if it could be ok, don't raise an error just because it isn't guaranteed to be (error will be raised at runtime if it is a problem), I think both these cases are ok and therefore I have relaxed the tests accordingly |
Types of changes
Summary
Relaxes typing of lazy fields to allow super-classes to be passed to sub-class fields. Implements #682
Checklist