-
Notifications
You must be signed in to change notification settings - Fork 166
Add type hint stub #780
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
Add type hint stub #780
Conversation
@ejguan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
This breaks
I haven't looked in detail, but some of the errors don't seem to be a usage error. I'll keep you posted. |
An example where I don't think we are responsible from typing import BinaryIO, Tuple
import pathlib
from torchdata.datapipes.iter import FileLister, FileOpener, IterDataPipe, IterableWrapper
def load(path: pathlib.Path) -> IterDataPipe[Tuple[str, BinaryIO]]:
if path.is_dir():
dp = FileLister(str(path), recursive=True)
else:
dp = IterableWrapper([str(path)])
return FileOpener(dp, mode="rb") Running
The actual function is a little more complicated and we can't use Could you advise how you want us to annotate? Can we maybe revert this PR and resolve all issues that this brings to torchvision before we merge a second time? |
@pmeier def load(path: pathlib.Path) -> IterDataPipe[Tuple[str, BinaryIO]]:
if path.is_dir():
dp: IterDataPipe = FileLister(str(path), recursive=True)
else:
dp = IterableWrapper([str(path)])
return FileOpener(dp, mode="rb") However, even with the proper typing shown above, the Error is changed to All Errors are eliminated when I remove new cc: @NivekT for python interface file For this PR, I will revert it because our typing system needs to be fixed generally. |
This pull request has been reverted by b87e016. |
Fixes #779
Changes
py.typed
file stub