prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Functional API for FileLister
  ### 🚀 The feature, motivation and pitch
  
  Similar to https://github.com/pytorch/data/issues/387
  
  This allows for 
  ```python
  IterableWrapper([...]).list_file()
  ```
  
  ### Alternatives
  
  _No response_
  
  ### Additional context
  
  _No response_
  
  cc @VitalyFedyunin @ejguan @NivekT
  
  </issue>
  <code>
  [start of torch/utils/data/datapipes/iter/filelister.py]
  1 from typing import Iterator, List, Sequence, Union
  2 
  3 from torch.utils.data.datapipes.datapipe import IterDataPipe
  4 from torch.utils.data.datapipes.iter import IterableWrapper
  5 from torch.utils.data.datapipes.utils.common import get_file_pathnames_from_root
  6 
  7 __all__ = ["FileListerIterDataPipe", ]
  8 
  9 
  10 class FileListerIterDataPipe(IterDataPipe[str]):
  11     r"""
  12     Given path(s) to the root directory, yields file pathname(s) (path + filename) of files within the root directory.
  13     Multiple root directories can be provided.
  14 
  15     Args:
  16         root: Root directory or a sequence of root directories
  17         masks: Unix style filter string or string list for filtering file name(s)
  18         recursive: Whether to return pathname from nested directories or not
  19         abspath: Whether to return relative pathname or absolute pathname
  20         non_deterministic: Whether to return pathname in sorted order or not.
  21             If ``False``, the results yielded from each root directory will be sorted
  22         length: Nominal length of the datapipe
  23 
  24     Example:
  25         >>> from torchdata.datapipes.iter import FileLister
  26         >>> dp = FileLister(root=".", recursive=True)
  27         >>> list(dp)
  28         ['example.py', './data/data.tar']
  29     """
  30 
  31     def __init__(
  32         self,
  33         root: Union[str, Sequence[str], IterDataPipe] = '.',
  34         masks: Union[str, List[str]] = '',
  35         *,
  36         recursive: bool = False,
  37         abspath: bool = False,
  38         non_deterministic: bool = False,
  39         length: int = -1
  40     ) -> None:
  41         super().__init__()
  42         if isinstance(root, str):
  43             root = [root, ]
  44         if not isinstance(root, IterDataPipe):
  45             root = IterableWrapper(root)
  46         self.datapipe: IterDataPipe = root
  47         self.masks: Union[str, List[str]] = masks
  48         self.recursive: bool = recursive
  49         self.abspath: bool = abspath
  50         self.non_deterministic: bool = non_deterministic
  51         self.length: int = length
  52 
  53     def __iter__(self) -> Iterator[str] :
  54         for path in self.datapipe:
  55             yield from get_file_pathnames_from_root(path, self.masks, self.recursive, self.abspath, self.non_deterministic)
  56 
  57     def __len__(self):
  58         if self.length == -1:
  59             raise TypeError("{} instance doesn't have valid length".format(type(self).__name__))
  60         return self.length
  61
  [end of torch/utils/data/datapipes/iter/filelister.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/torch/utils/data/datapipes/iter/filelister.py b/torch/utils/data/datapipes/iter/filelister.py
  --- a/torch/utils/data/datapipes/iter/filelister.py
  +++ b/torch/utils/data/datapipes/iter/filelister.py
  @@ -1,5 +1,8 @@
   from typing import Iterator, List, Sequence, Union
   
  +
  +from torch.utils.data.datapipes._decorator import functional_datapipe
  +
   from torch.utils.data.datapipes.datapipe import IterDataPipe
   from torch.utils.data.datapipes.iter import IterableWrapper
   from torch.utils.data.datapipes.utils.common import get_file_pathnames_from_root
  @@ -7,6 +10,7 @@
   __all__ = ["FileListerIterDataPipe", ]
   
   
  +@functional_datapipe("list_files")
   class FileListerIterDataPipe(IterDataPipe[str]):
       r"""
       Given path(s) to the root directory, yields file pathname(s) (path + filename) of files within the root directory.
  
verification_info: {"golden_diff": "diff --git a/torch/utils/data/datapipes/iter/filelister.py b/torch/utils/data/datapipes/iter/filelister.py\n--- a/torch/utils/data/datapipes/iter/filelister.py\n+++ b/torch/utils/data/datapipes/iter/filelister.py\n@@ -1,5 +1,8 @@\n from typing import Iterator, List, Sequence, Union\n \n+\n+from torch.utils.data.datapipes._decorator import functional_datapipe\n+\n from torch.utils.data.datapipes.datapipe import IterDataPipe\n from torch.utils.data.datapipes.iter import IterableWrapper\n from torch.utils.data.datapipes.utils.common import get_file_pathnames_from_root\n@@ -7,6 +10,7 @@\n __all__ = [\"FileListerIterDataPipe\", ]\n \n \n+@functional_datapipe(\"list_files\")\n class FileListerIterDataPipe(IterDataPipe[str]):\n     r\"\"\"\n     Given path(s) to the root directory, yields file pathname(s) (path + filename) of files within the root directory.\n", "issue": "Functional API for FileLister\n### \ud83d\ude80 The feature, motivation and pitch\n\nSimilar to https://github.com/pytorch/data/issues/387\r\n\r\nThis allows for \r\n```python\r\nIterableWrapper([...]).list_file()\r\n```\n\n### Alternatives\n\n_No response_\n\n### Additional context\n\n_No response_\n\ncc @VitalyFedyunin @ejguan @NivekT\n", "before_files": [{"content": "from typing import Iterator, List, Sequence, Union\n\nfrom torch.utils.data.datapipes.datapipe import IterDataPipe\nfrom torch.utils.data.datapipes.iter import IterableWrapper\nfrom torch.utils.data.datapipes.utils.common import get_file_pathnames_from_root\n\n__all__ = [\"FileListerIterDataPipe\", ]\n\n\nclass FileListerIterDataPipe(IterDataPipe[str]):\n    r\"\"\"\n    Given path(s) to the root directory, yields file pathname(s) (path + filename) of files within the root directory.\n    Multiple root directories can be provided.\n\n    Args:\n        root: Root directory or a sequence of root directories\n        masks: Unix style filter string or string list for filtering file name(s)\n        recursive: Whether to return pathname from nested directories or not\n        abspath: Whether to return relative pathname or absolute pathname\n        non_deterministic: Whether to return pathname in sorted order or not.\n            If ``False``, the results yielded from each root directory will be sorted\n        length: Nominal length of the datapipe\n\n    Example:\n        >>> from torchdata.datapipes.iter import FileLister\n        >>> dp = FileLister(root=\".\", recursive=True)\n        >>> list(dp)\n        ['example.py', './data/data.tar']\n    \"\"\"\n\n    def __init__(\n        self,\n        root: Union[str, Sequence[str], IterDataPipe] = '.',\n        masks: Union[str, List[str]] = '',\n        *,\n        recursive: bool = False,\n        abspath: bool = False,\n        non_deterministic: bool = False,\n        length: int = -1\n    ) -> None:\n        super().__init__()\n        if isinstance(root, str):\n            root = [root, ]\n        if not isinstance(root, IterDataPipe):\n            root = IterableWrapper(root)\n        self.datapipe: IterDataPipe = root\n        self.masks: Union[str, List[str]] = masks\n        self.recursive: bool = recursive\n        self.abspath: bool = abspath\n        self.non_deterministic: bool = non_deterministic\n        self.length: int = length\n\n    def __iter__(self) -> Iterator[str] :\n        for path in self.datapipe:\n            yield from get_file_pathnames_from_root(path, self.masks, self.recursive, self.abspath, self.non_deterministic)\n\n    def __len__(self):\n        if self.length == -1:\n            raise TypeError(\"{} instance doesn't have valid length\".format(type(self).__name__))\n        return self.length\n", "path": "torch/utils/data/datapipes/iter/filelister.py"}]}