diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-05-23 23:45:12 -0400 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-05-23 23:45:12 -0400 |
commit | f53768612b1e2268697b5444e502032ef9f3fb3c (patch) | |
tree | 4ed49b73e6bd3c2f8fceffa9643973033f87af95 /extension/examples/filesystem/filesystem.py | |
download | sncontinue-f53768612b1e2268697b5444e502032ef9f3fb3c.tar.gz sncontinue-f53768612b1e2268697b5444e502032ef9f3fb3c.tar.bz2 sncontinue-f53768612b1e2268697b5444e502032ef9f3fb3c.zip |
copying from old repo
Diffstat (limited to 'extension/examples/filesystem/filesystem.py')
-rw-r--r-- | extension/examples/filesystem/filesystem.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/extension/examples/filesystem/filesystem.py b/extension/examples/filesystem/filesystem.py new file mode 100644 index 00000000..eb5c2043 --- /dev/null +++ b/extension/examples/filesystem/filesystem.py @@ -0,0 +1,45 @@ +from abc import ABC, abstractmethod +from typing import List + + +class FileSystem(ABC): + """An abstract filesystem that can read/write from a set of files.""" + @abstractmethod + def read(self, path) -> str: + raise NotImplementedError + + @abstractmethod + def readlines(self, path) -> List[str]: + raise NotImplementedError + + @abstractmethod + def write(self, path, content): + raise NotImplementedError + + @abstractmethod + def exists(self, path) -> bool: + raise NotImplementedError + + @abstractmethod + def rename_file(self, filepath: str, new_filepath: str): + raise NotImplementedError + + @abstractmethod + def walk(self, path: str) -> List[str]: + raise NotImplementedError + + @abstractmethod + def rename_directory(self, path: str, new_path: str): + raise NotImplementedError + + @abstractmethod + def delete_file(self, filepath: str): + raise NotImplementedError + + @abstractmethod + def delete_directory(self, path: str): + raise NotImplementedError + + @abstractmethod + def add_directory(self, path: str): + raise NotImplementedError |