Skip to content

Commit

Permalink
refactor: Remove unnecessary DiffSyncModel.diffsync field handling fr…
Browse files Browse the repository at this point in the history
…om storage engines
  • Loading branch information
James Harr committed Nov 20, 2023
1 parent 095e8ed commit 2c7d924
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 9 deletions.
3 changes: 0 additions & 3 deletions diffsync/store/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ def remove(self, *, obj: "DiffSyncModel", remove_children: bool = False) -> None

self.remove_item(modelname, uid)

if obj.diffsync:
obj.diffsync = None

if remove_children:
for child_type, child_fieldname in obj.get_children_mapping().items():
for child_id in getattr(obj, child_fieldname):
Expand Down
3 changes: 0 additions & 3 deletions diffsync/store/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ def add(self, *, obj: "DiffSyncModel") -> None:
# Return so we don't have to change anything on the existing object and underlying data
return

if not obj.diffsync:
obj.diffsync = self.diffsync

self._data[modelname][uid] = obj

def update(self, *, obj: "DiffSyncModel") -> None:
Expand Down
3 changes: 0 additions & 3 deletions diffsync/store/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def _get_object_from_redis_key(self, key: str) -> "DiffSyncModel":
pickled_object = self._store.get(key)
if pickled_object:
obj_result = loads(pickled_object) # nosec
obj_result.diffsync = self.diffsync
return obj_result
raise ObjectNotFound(f"{key} not present in Cache")

Expand Down Expand Up @@ -178,7 +177,6 @@ def add(self, *, obj: "DiffSyncModel") -> None:

# Remove the diffsync object before sending to Redis
obj_copy = copy.copy(obj)
obj_copy.diffsync = None

self._store.set(object_key, dumps(obj_copy))

Expand All @@ -193,7 +191,6 @@ def update(self, *, obj: "DiffSyncModel") -> None:

object_key = self._get_key_for_object(modelname, uid)
obj_copy = copy.copy(obj)
obj_copy.diffsync = None

self._store.set(object_key, dumps(obj_copy))

Expand Down

0 comments on commit 2c7d924

Please sign in to comment.