Skip to content

Commit

Permalink
Use keyword argument instead of kwargs.pop(...)
Browse files Browse the repository at this point in the history
  • Loading branch information
millerdev committed Sep 17, 2023
1 parent cb97de9 commit 56f507e
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions corehq/ex-submodules/dimagi/utils/couch/migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,7 @@ def _migration_do_sync(self):
self._migration_sync_to_sql(sql_object)
return sql_object

def save(self, *args, **kwargs):
sync_to_sql = kwargs.pop('sync_to_sql', True)
def save(self, *args, sync_to_sql=True, **kwargs):
super(SyncCouchToSQLMixin, self).save(*args, **kwargs)
if sync_to_sql:
try:
Expand All @@ -185,8 +184,7 @@ def save(self, *args, **kwargs):
message='Could not sync %s SQL object from %s %s' % (sql_class_name,
couch_class_name, self._id))

def delete(self, *args, **kwargs):
sync_to_sql = kwargs.pop('sync_to_sql', True)
def delete(self, sync_to_sql=True, *args, **kwargs):
if sync_to_sql:
sql_object = self._migration_get_sql_object()
if sql_object is not None:
Expand Down Expand Up @@ -288,8 +286,7 @@ def _migration_do_sync(self):
couch_object = self._migration_get_or_create_couch_object()
self._migration_sync_to_couch(couch_object)

def save(self, *args, **kwargs):
sync_to_couch = kwargs.pop('sync_to_couch', True)
def save(self, *args, sync_to_couch=True, **kwargs):
super(SyncSQLToCouchMixin, self).save(*args, **kwargs)
if sync_to_couch and sync_to_couch_enabled(self.__class__):
try:
Expand All @@ -303,8 +300,7 @@ def save(self, *args, **kwargs):
message='Could not sync %s Couch object from %s %s' % (couch_class_name,
sql_class_name, self.pk))

def delete(self, *args, **kwargs):
sync_to_couch = kwargs.pop('sync_to_couch', True)
def delete(self, *args, sync_to_couch=True, **kwargs):
if sync_to_couch and sync_to_couch_enabled(self.__class__):
couch_object = self._migration_get_couch_object()
if couch_object is not None:
Expand Down

0 comments on commit 56f507e

Please sign in to comment.