diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-06-27 23:53:08 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-06-27 23:53:08 -0700 |
commit | 4411dc39c1ec51bfc96c4059aa555313e825c2f7 (patch) | |
tree | f88425c9c5b407d53cc49645e13ebbb52c9fb455 /extension/examples/filesystem/virtual.py | |
parent | 55e231b4f51f47757ab5840363fbc097d6ebf6e5 (diff) | |
download | sncontinue-4411dc39c1ec51bfc96c4059aa555313e825c2f7.tar.gz sncontinue-4411dc39c1ec51bfc96c4059aa555313e825c2f7.tar.bz2 sncontinue-4411dc39c1ec51bfc96c4059aa555313e825c2f7.zip |
v73 was too large, removing examples, .vscignore
Diffstat (limited to 'extension/examples/filesystem/virtual.py')
-rw-r--r-- | extension/examples/filesystem/virtual.py | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/extension/examples/filesystem/virtual.py b/extension/examples/filesystem/virtual.py deleted file mode 100644 index 91a10e7d..00000000 --- a/extension/examples/filesystem/virtual.py +++ /dev/null @@ -1,39 +0,0 @@ -from typing import Dict, List -from filesystem.filesystem import FileSystem - - -class VirtualFileSystem(FileSystem): - """A simulated filesystem from a mapping of filepath to file contents.""" - files: Dict[str, str] - - def __init__(self, files: Dict[str, str]): - self.files = files - - def read(self, path) -> str: - return self.files[path] - - def readlines(self, path) -> List[str]: - return self.files[path].splitlines() - - def write(self, path, content): - self.files[path] = content - - def exists(self, path) -> bool: - return path in self.files - - def rename_file(self, filepath: str, new_filepath: str): - self.files[new_filepath] = self.files[filepath] - del self.files[filepath] - - def rename_directory(self, path: str, new_path: str): - for filepath in self.files: - if filepath.startswith(path): - new_filepath = new_path + filepath[len(path):] - self.files[new_filepath] = self.files[filepath] - del self.files[filepath] - - def delete_file(self, filepath: str): - del self.files[filepath] - - def add_directory(self, path: str): - pass |