From 8a57a230487f4b8e87f4fa600149349f5cc7fc05 Mon Sep 17 00:00:00 2001 From: EKNr1 Date: Fri, 13 Dec 2024 16:14:16 +0100 Subject: [PATCH] Removed old, deprecated, dangerous, stupid method of saving data to a file. --- requirements.txt | 1 - setup.py | 3 --- wobbl_tools/data_file.py | 57 ---------------------------------------- 3 files changed, 61 deletions(-) delete mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 6debcc9..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -deprecated \ No newline at end of file diff --git a/setup.py b/setup.py index ffab08c..ed49d5e 100644 --- a/setup.py +++ b/setup.py @@ -18,9 +18,6 @@ setup( packages=[ "wobbl_tools" ], - install_requires=[ - "deprecated", - ], extras_require={ "pygame": ["pygame"], }, diff --git a/wobbl_tools/data_file.py b/wobbl_tools/data_file.py index 08621fc..6a5bc08 100644 --- a/wobbl_tools/data_file.py +++ b/wobbl_tools/data_file.py @@ -6,63 +6,6 @@ Using this module, you can store data in files easily. import os import json -from deprecated import deprecated - - -@deprecated(reason="This function is not safe to use!!!") -class DictFile: - """ - This class is not safe to use! - Any code in the file will be executed! - """ - def __init__(self, path: str=None): - self.path = path - - if path is None: # create empty settings dict if path is none else load settings from file - self.settings = {} - - else: - self.load_from_file(path) - - def load_from_file(self, path): - file = open(path, "r") - self.settings = eval(file.read()) - file.close() - - def save(self, path: str=None): - if path is None: - path = self.path - - file = open(path, "w") - file.write(str(self)) - file.close() - - def __str__(self): # make the dict not be just one line - new_settings_str = "{\n" - for key in self.settings: - new_settings_str += "\t" + repr(key) + ": " + repr(self.settings[key]) + ",\n" - - new_settings_str = new_settings_str[:-2] + "\n}" - - return new_settings_str - - def __repr__(self): - return repr(self.settings) - - def __getitem__(self, key): - return self.settings[key] - - def __setitem__(self, key, value): - self.settings[key] = value - - def __delitem__(self, key): - self.settings.pop(key) - - def __iter__(self): - return self.settings - - def __len__(self): - return len(self.settings) def load_dataclass_json(dataclass, file_path: str, builtin_save: bool=True):