-
Notifications
You must be signed in to change notification settings - Fork 323
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
Adding types to some of datamodules #462
Adding types to some of datamodules #462
Conversation
Hello @briankosw! Thanks for updating this PR. There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2021-01-20 12:45:02 UTC |
Codecov Report
@@ Coverage Diff @@
## master #462 +/- ##
==========================================
+ Coverage 77.53% 77.55% +0.02%
==========================================
Files 114 114
Lines 6664 6671 +7
==========================================
+ Hits 5167 5174 +7
Misses 1497 1497
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
A couple things that I need some guidance on:
|
@briankosw how is it going, still wip or ready to review? |
Just need some guidance on the comment I've left above, but otherwise I'm done! |
@akihironitta would love to get your feedback on these points! |
@akihironitta mind re-review so we can land this one :] |
@briankosw I'm sorry for replying very late.
For types using optional packages, can you have a look at: #444 (review)? |
For complicated ones, I guess, for now, we can just annotate them with For functions returning class AsynchronousLoader(object):
...
def __iter__(self) -> "AsynchronousLoader":
# We don't want to run the thread more than once
# Start a new thread if we are at the beginning of a new epoch, and our current worker is dead
if (not hasattr(self, 'worker') or not self.worker.is_alive()) and self.queue.empty() and self.idx == 0:
self.worker = Thread(target=self.load_loop)
self.worker.daemon = True
self.worker.start()
return self |
@Borda Sure. |
This is a lot more work than I expected. Hopefully, I'll finish this PR today... |
you can just pin the failing files so spilt the datamodiles into particular files and lets ignore the failing ones only |
@@ -76,7 +78,7 @@ def __init__( | |||
"You want to use transforms loaded from `torchvision` which is not installed yet." | |||
) | |||
|
|||
super().__init__( | |||
super().__init__( # type: ignore[misc] |
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.
mypy will raise errors without these # type: ignore[misc]
due to the bug reported in python/mypy#6799.
@Borda Some datamodule files are still included in the ignore list, but I think this PR is ready for review for now. |
# yapf: disable | ||
if (not hasattr(self, 'worker') or not self.worker.is_alive()) and self.queue.empty() and self.idx == 0: # type: ignore[has-type] # noqa: E501 | ||
self.worker = Thread(target=self.load_loop) | ||
# yapf: enable |
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.
Just for the record, I had a collision here between yapf and flake8. Lightning-AI/pytorch-lightning#5591
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.
Applying yapf
will cause flake8's error [W503] line break before binary operator
if without these ignores.
Thank you for finishing this up and my apologies @akihironitta. It was a hectic week, so I couldn't get to it. |
@briankosw No worries :) |
What does this PR do?
Adding types to
pl_bolts.datamodules
.related to #434
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃