From c8611bca6ccc2333f1f2a8f684c1e46aaca2bbf8 Mon Sep 17 00:00:00 2001
From: Wissam Benadjaoud <benadjaoud.wissam@gmail.com>
Date: Fri, 21 May 2021 09:40:14 +0200
Subject: [PATCH] save file

---
 pyAmakCore/classes/scheduler_tool/savable.py | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/pyAmakCore/classes/scheduler_tool/savable.py b/pyAmakCore/classes/scheduler_tool/savable.py
index d7f1913..ade7702 100644
--- a/pyAmakCore/classes/scheduler_tool/savable.py
+++ b/pyAmakCore/classes/scheduler_tool/savable.py
@@ -23,26 +23,19 @@ class Savable:
         """
         return self.amas
 
-    def save(self, file= None) -> None:
+    def save(self, file="filename.pickle") -> None:
         """
         Save the current state of the system
         """
-        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:
+        with open(file, 'wb') as handle:
                 pickle.dump(self.amas, handle, protocol=pickle.HIGHEST_PROTOCOL)
 
     @classmethod
-    def load(cls, file= None) -> 'Savable':
+    def load(cls, file="filename.pickle") -> 'Savable':
         """
         Load the last save of the system
         """
-        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)
+        with open(file, 'rb') as handle:
+            amas_object = pickle.load(handle)
+
         return cls(amas_object)
-- 
GitLab