@@ -96,11 +96,11 @@ def __iter__(self) -> Iterator[str]:
96
96
yield os .path .join (path , file_name )
97
97
98
98
99
- @functional_datapipe ("open_file_by_iopath " )
99
+ @functional_datapipe ("open_files_by_iopath " )
100
100
class IoPathFileOpenerIterDataPipe (IterDataPipe [Tuple [str , StreamWrapper ]]):
101
101
r"""
102
102
Opens files from input datapipe which contains pathnames or URLs,
103
- and yields a tuple of pathname and opened file stream (functional name: ``open_file_by_iopath ``).
103
+ and yields a tuple of pathname and opened file stream (functional name: ``open_files_by_iopath ``).
104
104
105
105
Args:
106
106
source_datapipe: Iterable DataPipe that provides the pathnames or URLs
@@ -114,7 +114,7 @@ class IoPathFileOpenerIterDataPipe(IterDataPipe[Tuple[str, StreamWrapper]]):
114
114
Example:
115
115
>>> from torchdata.datapipes.iter import IoPathFileLister
116
116
>>> datapipe = IoPathFileLister(root=S3URL)
117
- >>> file_dp = datapipe.open_file_by_iopath ()
117
+ >>> file_dp = datapipe.open_files_by_iopath ()
118
118
"""
119
119
120
120
def __init__ (self , source_datapipe : IterDataPipe [str ], mode : str = "r" , pathmgr = None ) -> None :
@@ -141,6 +141,10 @@ def __len__(self) -> int:
141
141
return len (self .source_datapipe )
142
142
143
143
144
+ # Register for functional API for backward compatibility
145
+ IterDataPipe .register_datapipe_as_function ("open_file_by_iopath" , IoPathFileOpenerIterDataPipe )
146
+
147
+
144
148
@functional_datapipe ("save_by_iopath" )
145
149
class IoPathSaverIterDataPipe (IterDataPipe [str ]):
146
150
0 commit comments