MCPcopy
hub / github.com/huggingface/datasets / DummyTestFS

Class DummyTestFS

tests/test_data_files.py:547–563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

545 ]
546
547 class DummyTestFS(AbstractFileSystem):
548 protocol = ("mock", "dummy")
549 _fs_contents = fs_contents
550
551 def ls(self, path, detail=True, refresh=True, **kwargs):
552 if kwargs.pop("strip_proto", True):
553 path = self._strip_protocol(path)
554
555 files = not refresh and self._ls_from_cache(path)
556 if not files:
557 files = [file for file in self._fs_contents if path == self._parent(file["name"])]
558 files.sort(key=lambda file: file["name"])
559 self.dircache[path.rstrip("/")] = files
560
561 if detail:
562 return files
563 return [file["name"] for file in files]
564
565 return DummyTestFS
566

Callers 1

Calls

no outgoing calls

Tested by 1