1616""" 
1717
1818from  functools  import  total_ordering 
19- from  typing  import  Any , Iterator , Iterable , Mapping , Optional , Text 
19+ from  typing  import  Any , Iterator , Iterable , Mapping , Optional , Text ,  Type 
2020
2121from  .exceptions  import  ObjectAlreadyExists 
2222from  .utils  import  intersection , OrderedDefaultDict 
@@ -126,7 +126,13 @@ class DiffElement:  # pylint: disable=too-many-instance-attributes
126126    """DiffElement object, designed to represent a single item/object that may or may not have any diffs.""" 
127127
128128    def  __init__ (
129-         self , obj_type : Text , name : Text , keys : Mapping , source_name : Text  =  "source" , dest_name : Text  =  "dest" 
129+         self ,
130+         obj_type : Text ,
131+         name : Text ,
132+         keys : Mapping ,
133+         source_name : Text  =  "source" ,
134+         dest_name : Text  =  "dest" ,
135+         diff_class : Type [Diff ] =  Diff ,
130136    ):  # pylint: disable=too-many-arguments 
131137        """Instantiate a DiffElement. 
132138
@@ -137,6 +143,7 @@ def __init__(
137143            keys: Primary keys and values uniquely describing this object, as in DSyncModel.get_identifiers(). 
138144            source_name: Name of the source DSync object 
139145            dest_name: Name of the destination DSync object 
146+             diff_class: Diff or subclass thereof to use to calculate the diffs to use for synchronization 
140147        """ 
141148        if  not  isinstance (obj_type , str ):
142149            raise  ValueError (f"obj_type must be a string (not { type (obj_type )}  )
@@ -152,7 +159,7 @@ def __init__(
152159        # Note: *_attrs == None if no target object exists; it'll be an empty dict if it exists but has no _attributes 
153160        self .source_attrs : Optional [Mapping ] =  None 
154161        self .dest_attrs : Optional [Mapping ] =  None 
155-         self .child_diff  =  Diff ()
162+         self .child_diff  =  diff_class ()
156163
157164    def  __lt__ (self , other ):
158165        """Logical ordering of DiffElements. 
0 commit comments