remove allow-untyped-defs from torch/utils/data/datapipes/iter/filelister.py (#154624)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/154624
Approved by: https://github.com/Skylion007
This commit is contained in:
Bob Ren 2025-05-29 20:37:18 -07:00 committed by PyTorch MergeBot
parent 639f459cb6
commit dc82e911e7

View File

@ -1,4 +1,3 @@
# mypy: allow-untyped-defs
from collections.abc import Iterator, Sequence
from typing import Union
@ -63,7 +62,7 @@ class FileListerIterDataPipe(IterDataPipe[str]):
path, self.masks, self.recursive, self.abspath, self.non_deterministic
)
def __len__(self):
def __len__(self) -> int:
if self.length == -1:
raise TypeError(f"{type(self).__name__} instance doesn't have valid length")
return self.length