Skip to content

Commit

Permalink
fix deprecation warning for datapipes (#324)
Browse files Browse the repository at this point in the history
Summary:
Sister PR to pytorch/pytorch#74685. Fixes #322. CI will fail until the change is merged upstream.

Pull Request resolved: #324

Reviewed By: ejguan

Differential Revision: D35549848

Pulled By: NivekT

fbshipit-source-id: 143f0fd9e656bd93ea540c985105b8c0d014c50f
  • Loading branch information
pmeier authored and facebook-github-bot committed Apr 11, 2022
1 parent 9ad73d8 commit fd942ee
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
9 changes: 8 additions & 1 deletion torchdata/datapipes/iter/util/tararchiveloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,12 @@ class TarArchiveReaderIterDataPipe(IterDataPipe[Tuple[str, BufferedIOBase]]):
"""

def __new__(cls, datapipe: Iterable[Tuple[str, BufferedIOBase]], mode: str = "r:*", length: int = -1):
deprecation_warning(type(cls).__name__, new_name="TarArchiveLoader")
deprecation_warning(
cls.__name__,
deprecation_version="0.4",
removal_version="0.6",
old_functional_name="read_from_tar",
new_class_name="TarArchiveLoader",
new_functional_name="load_from_tar",
)
return TarArchiveLoaderIterDataPipe(datapipe, mode, length)
9 changes: 8 additions & 1 deletion torchdata/datapipes/iter/util/xzfileloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,12 @@ class XzFileReaderIterDataPipe(IterDataPipe[Tuple[str, BufferedIOBase]]):
"""

def __new__(cls, datapipe: Iterable[Tuple[str, BufferedIOBase]], length: int = -1):
deprecation_warning(type(cls).__name__, new_name="XzFileLoader")
deprecation_warning(
cls.__name__,
deprecation_version="0.4",
removal_version="0.6",
old_functional_name="read_from_xz",
new_class_name="XzFileLoader",
new_functional_name="load_from_xz",
)
return XzFileLoaderIterDataPipe(datapipe, length)
9 changes: 8 additions & 1 deletion torchdata/datapipes/iter/util/ziparchiveloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,12 @@ class ZipArchiveReaderIterDataPipe(IterDataPipe[Tuple[str, BufferedIOBase]]):
"""

def __new__(cls, datapipe: Iterable[Tuple[str, BufferedIOBase]], length: int = -1):
deprecation_warning(type(cls).__name__, new_name="ZipArchiveLoader")
deprecation_warning(
cls.__name__,
deprecation_version="0.4",
removal_version="0.6",
old_functional_name="read_from_zip",
new_class_name="ZipArchiveLoader",
new_functional_name="load_from_zip",
)
return ZipArchiveLoaderIterDataPipe(datapipe, length)

0 comments on commit fd942ee

Please sign in to comment.