Skip to content

Commit

Permalink
Small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Nov 25, 2024
1 parent 8eb2956 commit 64d79c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/commons/object_saving/filesystem_saver.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def put_project_object(self, data: Any, path: str, object_name: str, using_json:
filename = unify_path_separator(os.path.join(self._base_path, path, object_name))
if folder_to_save:
os.makedirs(folder_to_save, exist_ok=True)
with open(filename, "wb") as f:
with open(filename, 'wb') as f:
if using_json:
f.write(json.dumps(data).encode('utf-8'))
else:
Expand All @@ -59,7 +59,7 @@ def get_project_object(self, path: str, object_name: str, using_json: bool = Fal
filename = unify_path_separator(os.path.join(self._base_path, path, object_name))
if not utils.validate_file(filename):
raise ValueError(f'Unable to get file: {filename}')
with open(filename, "rb") as f:
with open(filename, 'rb') as f:
return json.loads(f.read()) if using_json else pickle.load(f)

def does_object_exists(self, path: str, object_name: str) -> bool:
Expand Down

0 comments on commit 64d79c0

Please sign in to comment.