From 5cba0a7517dd93bb338063f43bb24b78765f8b5e Mon Sep 17 00:00:00 2001 From: Scoder12 <34356756+Scoder12@users.noreply.github.com> Date: Tue, 28 Jul 2020 17:38:35 -0700 Subject: [PATCH] Delete FileCache in favor of simple dict --- src/replit/maqpy/files.py | 45 +-------------------------------------- 1 file changed, 1 insertion(+), 44 deletions(-) diff --git a/src/replit/maqpy/files.py b/src/replit/maqpy/files.py index da554c2..259aa42 100644 --- a/src/replit/maqpy/files.py +++ b/src/replit/maqpy/files.py @@ -2,50 +2,7 @@ import flask -class FileCache: - """A simple cache for files.""" - - def __init__(self) -> None: - """Initialize the class.""" - self.data = {} - - def add_to_cache(self, filename: str, content: str) -> None: - """Add a filename to the cache. - - Args: - filename (str): The filename to add. - content (str): The content to add to the cache. - """ - self.data[filename] = content - - def has(self, filename: str) -> bool: - """Whether the cache has a certain filename. - - Args: - filename (str): The filename to check for. - - Returns: - bool: Whether the cache has filename. - """ - return filename in self.data - - def invalidate(self, filename: str) -> None: - """Remove a filename from the cache. - - Args: - filename (str): The filename to remove. - """ - try: - self.data.pop(filename) - except KeyError: - pass - - def flush(self) -> None: - """Remove all values from the cache.""" - self.data = {} - - -cache = FileCache() +cache = {} class File(flask.Response):