Skip to content

Commit 522d4d0

Browse files
committed
feat: rename function to clarify purpose of finding and updating existing instances
Signed-off-by: Michal Fiedorowicz <mfiedorowicz@netboxlabs.com>
1 parent 4096612 commit 522d4d0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

netbox_diode_plugin/api/applier.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ def _is_auto_created_component(object_type: str) -> bool:
7171
return object_type in auto_created_components
7272

7373

74-
def _try_find_and_update_existing(data: dict, object_type: str, serializer_class, request):
75-
"""Try to find existing auto-created object and update it."""
74+
def _try_find_and_update_existing_instance(data: dict, object_type: str, serializer_class, request):
75+
"""Try to find existing auto-created instance and update it."""
7676
try:
7777
instance = find_existing_object(data, object_type)
7878
if instance:
@@ -107,7 +107,7 @@ def _apply_change(data: dict, model_class: models.Model, change: Change, created
107107
# This prevents duplicates when components are instantiated during Device/Module save()
108108
instance = None
109109
if _is_auto_created_component(change.object_type):
110-
instance = _try_find_and_update_existing(data, change.object_type, serializer_class, request)
110+
instance = _try_find_and_update_existing_instance(data, change.object_type, serializer_class, request)
111111

112112
if not instance:
113113
instance = _create_or_find_instance(data, change.object_type, serializer_class, request)

0 commit comments

Comments
 (0)