diff --git a/pyAmakCore/classes/scheduler_tool/savable.py b/pyAmakCore/classes/scheduler_tool/savable.py index fcffd31d7d9ea1f53ca2c4752f6bd7508c33036d..d7f19139cc80bac8ff9d8502f33c6911baefb3c0 100644 --- a/pyAmakCore/classes/scheduler_tool/savable.py +++ b/pyAmakCore/classes/scheduler_tool/savable.py @@ -23,19 +23,26 @@ class Savable: """ return self.amas - def save(self) -> None: + def save(self, file= None) -> None: """ Save the current state of the system """ - with open('filename.pickle', 'wb') as handle: - pickle.dump(self.amas, handle, protocol=pickle.HIGHEST_PROTOCOL) + if file == None: + with open('filename.pickle', 'wb') as handle: + pickle.dump(self.amas, handle, protocol=pickle.HIGHEST_PROTOCOL) + else: + with open('file.pickle', 'wb') as handle: + pickle.dump(self.amas, handle, protocol=pickle.HIGHEST_PROTOCOL) @classmethod - def load(cls) -> 'Savable': + def load(cls, file= None) -> 'Savable': """ Load the last save of the system """ - with open('filename.pickle', 'rb') as handle: - amas_object = pickle.load(handle) - - return cls(amas_object) \ No newline at end of file + if file == None: + with open('filename.pickle', 'rb') as handle: + amas_object = pickle.load(handle) + else: + with open('file.pickle', 'rb') as handle: + amas_object = pickle.load(handle) + return cls(amas_object)