| 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 |
no outgoing calls