@@ -526,14 +526,14 @@ def load_from_dict(self, data: Dict):
526
526
# Synchronization between DiffSync instances
527
527
# ------------------------------------------------------------------------------
528
528
529
- def sync_from (
529
+ def sync_from ( # pylint: disable=too-many-arguments
530
530
self ,
531
531
source : "DiffSync" ,
532
532
diff_class : Type [Diff ] = Diff ,
533
533
flags : DiffSyncFlags = DiffSyncFlags .NONE ,
534
534
callback : Optional [Callable [[Text , int , int ], None ]] = None ,
535
535
diff : Optional [Diff ] = None ,
536
- ): # pylint: disable=too-many-arguments :
536
+ ) -> Diff :
537
537
"""Synchronize data from the given source DiffSync object into the current DiffSync object.
538
538
539
539
Args:
@@ -543,6 +543,10 @@ def sync_from(
543
543
callback (function): Function with parameters (stage, current, total), to be called at intervals as the
544
544
calculation of the diff and subsequent sync proceed.
545
545
diff (Diff): An existing diff to be used rather than generating a completely new diff.
546
+ Returns:
547
+ Diff: Diff between origin object and source
548
+ Raises:
549
+ DiffClassMismatch: The provided diff's class does not match the diff_class
546
550
"""
547
551
if diff_class and diff :
548
552
if not isinstance (diff , diff_class ):
@@ -558,14 +562,16 @@ def sync_from(
558
562
if result :
559
563
self .sync_complete (source , diff , flags , syncer .base_logger )
560
564
561
- def sync_to (
565
+ return diff
566
+
567
+ def sync_to ( # pylint: disable=too-many-arguments
562
568
self ,
563
569
target : "DiffSync" ,
564
570
diff_class : Type [Diff ] = Diff ,
565
571
flags : DiffSyncFlags = DiffSyncFlags .NONE ,
566
572
callback : Optional [Callable [[Text , int , int ], None ]] = None ,
567
573
diff : Optional [Diff ] = None ,
568
- ): # pylint: disable=too-many-arguments
574
+ ) -> Diff :
569
575
"""Synchronize data from the current DiffSync object into the given target DiffSync object.
570
576
571
577
Args:
@@ -575,8 +581,12 @@ def sync_to(
575
581
callback (function): Function with parameters (stage, current, total), to be called at intervals as the
576
582
calculation of the diff and subsequent sync proceed.
577
583
diff (Diff): An existing diff that will be used when determining what needs to be synced.
584
+ Returns:
585
+ Diff: Diff between origin object and target
586
+ Raises:
587
+ DiffClassMismatch: The provided diff's class does not match the diff_class
578
588
"""
579
- target .sync_from (self , diff_class = diff_class , flags = flags , callback = callback , diff = diff )
589
+ return target .sync_from (self , diff_class = diff_class , flags = flags , callback = callback , diff = diff )
580
590
581
591
def sync_complete (
582
592
self ,
0 commit comments