Skip to content

Commit 792618d

Browse files
minor code de-dupe in utils
1 parent 61242a4 commit 792618d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/planet_auth/storage_utils.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -364,14 +364,17 @@ def update_data(self, sparse_update_data):
364364
new_data = sparse_update_data
365365
self.set_data(new_data)
366366

367-
def set_data(self, data):
367+
def set_data(self, data, copy_data: bool = True):
368368
"""
369369
Set the current in memory data. The data will be checked for validity
370370
before in memory values are set. Invalid data will result in an exception
371371
being thrown and no change being made to the in memory object.
372372
"""
373373
self.check_data(data)
374-
self._data = data.copy()
374+
if copy_data:
375+
self._data = data.copy()
376+
else:
377+
self._data = data
375378
self._load_time = int(time.time())
376379

377380
def check_data(self, data):
@@ -459,9 +462,7 @@ def load(self):
459462
return # we now allow in memory operation. Should we raise an error if the current data is invalid?
460463

461464
new_data = self._object_storage_provider.load_obj(self._file_path)
462-
self.check_data(new_data)
463-
self._data = new_data
464-
self._load_time = int(time.time())
465+
self.set_data(new_data, copy_data=False)
465466

466467
def lazy_load(self):
467468
"""

0 commit comments

Comments
 (0)