From c237851ce18440342a05719873442f68274e67d4 Mon Sep 17 00:00:00 2001 From: cloveranon Date: Tue, 17 Dec 2019 03:37:00 -0500 Subject: [PATCH] removed more botnet --- other/__init__.py | 0 other/cacher.py | 44 -------------------------------------------- 2 files changed, 44 deletions(-) delete mode 100644 other/__init__.py delete mode 100644 other/cacher.py diff --git a/other/__init__.py b/other/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/other/cacher.py b/other/cacher.py deleted file mode 100644 index 3f17a7b..0000000 --- a/other/cacher.py +++ /dev/null @@ -1,44 +0,0 @@ -import os - -from google.cloud import storage - - -class Cacher: - def __init__(self, credentials_file, bucket_name="dungeon-cache"): - # Model/Cache Info - os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = credentials_file - self.storage_client = storage.Client() - self.bucket = self.storage_client.get_bucket(bucket_name) - pass - - def cache_file(self, seed, choices, response, tag, print_result=False): - prompt_num = 0 - blob_file_name = "prompt" + str(prompt_num) + "/seed" + str(seed) + "/" + tag - for action in choices: - blob_file_name = blob_file_name + str(action) - blob = self.bucket.blob(blob_file_name) - - blob.upload_from_string(response) - - if print_result: - print("File ", blob_file_name, " cached") - - def retrieve_from_cache(self, seed, choices, tag, print_result=False): - prompt_num = 0 - blob_file_name = "prompt" + str(prompt_num) + "/seed" + str(seed) + "/" + tag - - for action in choices: - blob_file_name = blob_file_name + str(action) - - blob = self.bucket.blob(blob_file_name) - - if blob.exists(self.storage_client): - result = blob.download_as_string().decode("utf-8") - if print_result: - print(blob_file_name, " found in cache") - else: - result = None - if print_result: - print(blob_file_name, " not found in cache") - - return result