-
Notifications
You must be signed in to change notification settings - Fork 166
[DataPipe] Adding a 's' to the functional names of open/list DataPipes #479
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,11 +101,11 @@ def __iter__(self) -> Iterator[str]: | |
yield abs_path | ||
|
||
|
||
@functional_datapipe("open_file_by_fsspec") | ||
@functional_datapipe("open_files_by_fsspec") | ||
class FSSpecFileOpenerIterDataPipe(IterDataPipe[Tuple[str, StreamWrapper]]): | ||
r""" | ||
Opens files from input datapipe which contains `fsspec` paths and yields a tuple of | ||
pathname and opened file stream (functional name: ``open_file_by_fsspec``). | ||
pathname and opened file stream (functional name: ``open_files_by_fsspec``). | ||
|
||
Args: | ||
source_datapipe: Iterable DataPipe that provides the pathnames or URLs | ||
|
@@ -114,7 +114,7 @@ class FSSpecFileOpenerIterDataPipe(IterDataPipe[Tuple[str, StreamWrapper]]): | |
Example: | ||
>>> from torchdata.datapipes.iter import FSSpecFileLister | ||
>>> datapipe = FSSpecFileLister(root=dir_path) | ||
>>> file_dp = datapipe.open_file_by_fsspec() | ||
>>> file_dp = datapipe.open_files_by_fsspec() | ||
""" | ||
|
||
def __init__(self, source_datapipe: IterDataPipe[str], mode: str = "r") -> None: | ||
|
@@ -133,6 +133,10 @@ def __len__(self) -> int: | |
return len(self.source_datapipe) | ||
|
||
|
||
# Register for functional API for backward compatibility | ||
IterDataPipe.register_datapipe_as_function("open_file_by_fsspec", FSSpecFileOpenerIterDataPipe) | ||
Comment on lines
+136
to
+137
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As a follow-up task, add deprecation warning for the functional API. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like we will need to change the registration function and Do you think we should land this PR as it is or make the changes to core first? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's land this PR first and change the core afterwards. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And, could you please update the deprecation table as well? |
||
|
||
|
||
@functional_datapipe("save_by_fsspec") | ||
class FSSpecSaverIterDataPipe(IterDataPipe[str]): | ||
r""" | ||
|
Uh oh!
There was an error while loading. Please reload this page.