@@ -91,9 +91,6 @@ class DiffSyncModel(BaseModel):
91
91
Can be set as a class attribute or an instance attribute as needed.
92
92
"""
93
93
94
- diffsync : Optional ["Adapter" ] = None
95
- """Optional: the DiffSync instance that owns this model instance."""
96
-
97
94
_status : DiffSyncStatus = PrivateAttr (DiffSyncStatus .SUCCESS )
98
95
"""Status of the last attempt at creating/updating/deleting this model."""
99
96
@@ -216,7 +213,7 @@ def create(cls, diffsync: "Adapter", ids: Dict, attrs: Dict) -> Optional[Self]:
216
213
"""
217
214
return cls .create_base (diffsync = diffsync , ids = ids , attrs = attrs )
218
215
219
- def update_base (self , attrs : Dict ) -> Optional [Self ]:
216
+ def update_base (self , diffsync : "Adapter" , attrs : Dict ) -> Optional [Self ]:
220
217
"""Base Update method to update the attributes of this instance, along with any platform-specific data updates.
221
218
222
219
This method is not meant to be subclassed, users should redefine update() instead.
@@ -234,7 +231,7 @@ def update_base(self, attrs: Dict) -> Optional[Self]:
234
231
self .set_status (DiffSyncStatus .SUCCESS , "Updated successfully" )
235
232
return self
236
233
237
- def update (self , attrs : Dict ) -> Optional [Self ]:
234
+ def update (self , diffsync : "Adapter" , attrs : Dict ) -> Optional [Self ]:
238
235
"""Update the attributes of this instance, along with any platform-specific data updates.
239
236
240
237
Subclasses must call `super().update()` or `self.update_base()`; they may wish to then override the default status information
@@ -250,9 +247,9 @@ def update(self, attrs: Dict) -> Optional[Self]:
250
247
Raises:
251
248
ObjectNotUpdated: if an error occurred.
252
249
"""
253
- return self .update_base (attrs = attrs )
250
+ return self .update_base (diffsync = diffsync , attrs = attrs )
254
251
255
- def delete_base (self ) -> Optional [Self ]:
252
+ def delete_base (self , diffsync : "Adapter" ) -> Optional [Self ]:
256
253
"""Base delete method Delete any platform-specific data corresponding to this instance.
257
254
258
255
This method is not meant to be subclassed, users should redefine delete() instead.
@@ -263,7 +260,7 @@ def delete_base(self) -> Optional[Self]:
263
260
self .set_status (DiffSyncStatus .SUCCESS , "Deleted successfully" )
264
261
return self
265
262
266
- def delete (self ) -> Optional [Self ]:
263
+ def delete (self , diffsync : "Adapter" ) -> Optional [Self ]:
267
264
"""Delete any platform-specific data corresponding to this instance.
268
265
269
266
Subclasses must call `super().delete()` or `self.delete_base()`; they may wish to then override the default status information
@@ -276,7 +273,7 @@ def delete(self) -> Optional[Self]:
276
273
Raises:
277
274
ObjectNotDeleted: if an error occurred.
278
275
"""
279
- return self .delete_base ()
276
+ return self .delete_base (diffsync = diffsync )
280
277
281
278
@classmethod
282
279
def get_type (cls ) -> StrType :
0 commit comments