def _list_split()

in pyspark_huggingface/huggingface_sink.py [0:0]


    def _list_split(self, api: "HfApi") -> Iterator[Union["RepoFile", "RepoFolder"]]:
        """
        Get all existing files of the current split.
        """
        from huggingface_hub.utils import EntryNotFoundError

        try:
            objects = api.list_repo_tree(
                path_in_repo=self.path_in_repo,
                repo_id=self.repo_id,
                repo_type=self.repo_type,
                revision=self.revision,
                expand=False,
                recursive=False,
            )
            for obj in objects:
                if obj.path.startswith(self.prefix):
                    yield obj
        except EntryNotFoundError:
            pass