
    :Qg                        d dl Z d dlmZ d dlmZ d dlmZmZmZmZm	Z	m
Z
mZmZmZmZ d dlmZ  e j"                  e      ZdZddd	Zh d
ZdZ G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d d      Z G d d      Z G d de      Z  G d de      Z! G d de       Z" G d  d!e      Z# G d" d#e#      Z$ G d$ d%e#      Z% G d& d'e      Z&y)(    N)Mapping)copy)
	RemapDictstrings
short_repr
notpresentget_typenumpy_numbersnpliteral_eval_extendeddict_
SetOrdered)stringify_elementfakedownup)r   r   >   unprocessedtype_changesset_item_addedvalues_changedattribute_addedset_item_removedattribute_removedrepetition_changeiterable_item_addediterable_item_moveddictionary_item_addediterable_item_removeddictionary_item_removedz__internal:custom:extra_infoc                       e Zd Zy)DoesNotExistN__name__
__module____qualname__     K/var/www/html/answerous/venv/lib/python3.12/site-packages/deepdiff/model.pyr!   r!   !       r'   r!   c                       e Zd Zd Zy)
ResultDictc                 n    | j                         D cg c]
  \  }}|r	| }}}|D ]  }| |=  yc c}}w )zy
        Remove empty keys from this object. Should always be called after the result is final.
        :return:
        N)items)selfkv
empty_keyss       r(   remove_empty_keyszResultDict.remove_empty_keys'   s>    
 %)JJL:DAqa:
: 	AQ	 ;s   
11N)r#   r$   r%   r2   r&   r'   r(   r+   r+   %   s    r'   r+   c                   $    e Zd Zd Zd Zd Zd Zy)
TreeResultc                 4    t         D ]  }t               | |<    y N)REPORT_KEYSr   )r.   keys     r(   __init__zTreeResult.__init__3   s     	%C"DI	%r'   c                 2   | j                  d      r| j                  d      r| d   D ci c]  }|j                         | }}| d   D ci c]  }|j                         | }}t        |      t        |      z  }|rd| vrt               | d<   |D ]`  }||   }| d   j	                  |       ||   }| d   j	                  |       |j
                  |_        | d   j                  |       d|_        b d| v r| d   s| d= d| v r
| d   s| d= yyyc c}w c c}w )ap  
        There might be the same paths reported in the results as removed and added.
        In such cases they should be reported as value_changes.

        Note that this function mutates the tree in ways that causes issues when report_repetition=True
        and should be avoided in that case.

        This function should only be run on the Tree Result.
        r   r   r   N)getpathsetr   removet2addreport_type)r.   iadded_pathsremoved_pathsmutual_pathsr<   level_beforelevel_afters           r(   *mutual_add_removes_to_become_value_changesz5TreeResult.mutual_add_removes_to_become_value_changes7   sG    88)*txx8O/P045J0KL11668Q;LKL267N2OPQQVVXq[PMP{+c-.@@L 0 <)3%&$ <,T2,-44\B)$/*+22;?"-..%&**<8+;(< #d*48O3P,- D(6K1L*+ 2M(! MPs   DDc                 F    || vrt               | |<   | j                  |      S r6   )r   r;   )r.   items     r(   __getitem__zTreeResult.__getitem__U   s#    t#DJxx~r'   c           	          t        | j                         D cg c]  }t        |t              st	        |        c}      S c c}w r6   )sumvalues
isinstancer   len)r.   rB   s     r(   __len__zTreeResult.__len__Z   s.    DKKMOqZ:5NCFOPPOs
   AAN)r#   r$   r%   r9   rH   rK   rQ   r&   r'   r(   r4   r4   2   s    %,<
Qr'   r4   c                   h    e Zd ZdZddZd Zd ZddZd Zd Z	d	 Z
d
 Zd Zd Zd Zd Zd Zd Zy)
TextResultTNc                 h   || _         | j                  t               | j                         | j                         t               g t               t               t               | j                         | j                         t	               t	               t               d       |r| j                  |       y y )N)r   r   r   r   r   r   r   r   r   r   r   r   r   )verbose_levelupdater   _TextResult__set_or_dictr   _from_tree_results)r.   tree_resultsrU   s      r(   r9   zTextResult.__init__a   s    *!G%)%7%7%9'+'9'9';#g#(7%*W#(7#113!%!3!3!5 *(l!&
 	  ##L1 r'   c                 8    | j                   dk\  ri S t               S )N   )rU   r   r.   s    r(   __set_or_dictzTextResult.__set_or_dictw   s    ''1,r>*,>r'   c                    | j                  |       | j                  |d       | j                  |d       | j                  |       | j                  |       | j                  |d       | j                  |d       | j	                  |       | j                  |d       | j                  |d       | j                  |       | j                  |       | j                  |       | j                  |       | j                  |       y)
        Populate this object by parsing an existing reference-style result dictionary.
        :param tree: A TreeResult
        :return:
        r   r   r   r   r   r   N)
_from_tree_type_changes_from_tree_default_from_tree_value_changed_from_tree_unprocessed_from_tree_iterable_item_moved_from_tree_set_item_removed_from_tree_set_item_added_from_tree_repetition_change_from_tree_deep_distance_from_tree_custom_resultsr.   trees     r(   rX   zTextResult._from_tree_resultsz   s     	$$T*&=>&?@%%d+##D)&;<&=>++D1&78&9:((.&&t,))$/%%d+&&t,r'   c                 <   ||v r||   D ]  }|r*|dv r&|j                   j                  t              | d   v r0|j                  t        ur|j                  }n|j
                  }| |   }t        |t              r&|j                  |j                  t                     t        |t              r|||j                  t              <   t        |t              r&|j                  |j                  t                     t        dj                  |             y y )N>   r   r   force_iterable_opcodesz'Cannot handle {} report container type.)r   r<   FORCE_DEFAULTr?   r   t1rO   r   r@   dictlistappend	TypeErrorformat)r.   rk   rA   ignore_if_in_iterable_opcodeschangerJ   reports          r(   ra   zTextResult._from_tree_default   s    ${+ 4 2#'WW		];tDW?XX 99J.!99D!99D k*fj1JJv{{{?@-?CF6;;];;<-MM&++M+"BC $$M$*F6N4 474 r'   c                    d|v r |d   D ]  }|j                  t              }t        |j                        t        u rd}|j                  }|j                  }n,d}t        |j                        }t        |j                        }t        ||d      }| j                  dkD  r!|j                  dt              }||k7  r||d<   || d   |<   | j                  s|s|j                  |j                  |j                  	        y y )
Nr   rm   FTold_typenew_type   use_t2rn   new_path	old_value	new_value)	r<   rp   typerq   r?   r	   r   rU   rV   )	r.   rk   rx   r<   include_valuesr|   r}   
remap_dictr   s	            r(   r`   z"TextResult._from_tree_type_changes   s    T!~. P{{{7		?d*%*N%yyH%yyH%)N'		2H'		2H& ( (( 
 %%)%{{$m{LHx'19
:.-7^$T*%%.%%		VYY%O)P "r'   c                 n   d|v r| j                   dkD  r|d   D ]  }|j                  t              }|j                  |j                  d}| j                   dkD  r!|j                  dt              }||k7  r||d<   || d   |<   d	|j
                  v sy|j                  d	|j
                  d	   i        y y y )
Nr   r   rm   r   r   r~   Tr   r   diff)rU   r<   rp   r?   rq   
additionalrV   )r.   rk   rx   r<   the_changedr   s         r(   rb   z#TextResult._from_tree_value_changed   s    t#(:(:Q(>/0 	L{{{7,2IIFIIN%%)%{{$m{LHx'2:J//:%&t,V...&&0A0A&0I'JK	L )?#r'   c                     d|v rV| j                   dkD  rF|d   D ]=  }|j                  d      |j                  d}|| d   |j                  t              <   ? y y y )Nr   r~   Tr   r   valuerm   )rU   r<   r?   rp   r.   rk   rx   r   s       r(   rd   z)TextResult._from_tree_iterable_item_moved   st     D(T-?-?!-C45 8+1;;d;+CfiiX,7 *+FKK' -8 -) *8 .D(r'   c                     d|v rX|d   D ]O  }| d   j                  dj                  |j                  t              |j                  |j
                               Q y y )Nr   z{}: {} and {}rm   )rt   rv   r<   rp   rq   r?   )r.   rk   rx   s      r(   rc   z!TextResult._from_tree_unprocessed   sj    D }- A]#**?+A+A&++' CN C)*0))VYY,@ AA !r'   c           	         ||v r| |   }t        |t              }||   D ]  }|j                  j                         }|dk(  r|j                  n|j
                  }| j                  rt        |t              rd|z  }|r&||vrt               ||<   ||   j                  |       |j                  dj                  |t        |                    y y )Nr   z'%s'z{}[{}])rO   r   r   r<   r?   rq   ADD_QUOTES_TO_STRINGSr   r=   r@   rv   str)r.   rk   r8   set_item_infois_dictrx   r<   rJ   s           r(   $_from_tree_set_item_added_or_removedz/TextResult._from_tree_set_item_added_or_removed   s    $; IM 8Gs) Hyy~~ $'+;$;vyy--*T72K!D=D=0.1ed+!$'++D1!%%hoodCI&FGH r'   c                 *    | j                  |d       y )Nr   r8   r   rj   s     r(   rf   z$TextResult._from_tree_set_item_added   s    11$<L1Mr'   c                 *    | j                  |d       y )Nr   r   r   rj   s     r(   re   z&TextResult._from_tree_set_item_removed   s    11$<N1Or'   c                     d|v rT|d   D ]K  }|j                  t              }t        |j                  d         | d   |<   |j                  | d   |   d<   M y y )Nr   rm   
repetitionr   )r<   rp   r   r   rq   )r.   rk   rx   r<   s       r(   rg   z'TextResult._from_tree_repetition_change   su    $&23 E{{{72;%%l33()$/ <B99()$/8E 'r'   c                     d|v r	|d   | d<   y y )Ndeep_distancer&   rj   s     r(   rh   z#TextResult._from_tree_deep_distance  s    d"$($9D! #r'   c                     |j                         D ]d  \  }}|t        vst        |t              s i }|D ]9  }|j                  j                  t        i       ||j                  t              <   ; || |<   f y )Nrm   )	r-   r7   rO   r   r   r;   CUSTOM_FIELDr<   rp   )r.   rk   r/   _level_list_custom_dict_levels         r(   ri   z$TextResult._from_tree_custom_results  s    "jjl 	'NA{#!+z:  ") XF060A0A0E0ElTV0W !+ "- "- .X 'Q!	'r'   )Nr~   F)r#   r$   r%   r   r9   rW   rX   ra   r`   rb   rd   rc   r   rf   re   rg   rh   ri   r&   r'   r(   rS   rS   ^   sV     2,?-,4BP0L8AH$NPE:'r'   rS   c                   <    e Zd ZdZd
dZd Zd Zd Zd Zd Z	d	 Z
y)DeltaResultFNc                 `   || _         || _        | j                  t               t               t               t               t               t               t               t               t               t               t               t               t               |xs i d       |r| j	                  |       y y )N)r   r   r   r   r   r   r   r   r   r   r   iterable_items_added_at_indexes!iterable_items_removed_at_indexesro   )ignore_orderalways_include_valuesrV   r   rX   )r.   rY   r   r   ro   s        r(   r9   zDeltaResult.__init__  s    (%:"!G%*W',w#g#(7%*W#(7$w!& %#g/4w16!2!8b
 	" ##L1 r'   c                    | j                  |       | j                  |d       | j                  |d       | j                  |       | j                  r)| j	                  |dd       | j	                  |dd       n9| j                  |dd	       | j                  |dd	       | j                  |       | j                  |d
       | j                  |d       | j                  |       | j                  |       | j                  |       y)r_   r   r   r   r   )delta_report_keyr   r   T)rw   r   r   N)	r`   ra   rb   r   )_from_tree_iterable_item_added_or_removedrd   re   rf   rg   rj   s     r(   rX   zDeltaResult._from_tree_results7  s    	$$T*&=>&?@%%d+::+>_ ; a::-@c ; e ##D*?_c#d##D*Aae#f//5&78&9:((.&&t,))$/r'   c                    ||v r_||   D ]V  }|j                   t        ur|j                   }n|j                  }|j                  t        d      \  }}}	 | |   |   }	||	|<   X y y # t
        $ r t               x}	| |   |<   Y &w xY w)NT)rn   get_parent_too)r?   r   rq   r<   rp   KeyErrorr   )
r.   rk   rA   r   rx   rJ   r<   param_r   s
             r(   r   z5DeltaResult._from_tree_iterable_item_added_or_removedP  s    ${+ > 99J.!99D!99D "(=QU!VeQ]6:;K6LT6R3 :>/6>    ]UZU\\3d;K6LT6R]s   A%%BBc                    d|v r\|d   D ]R  }d }t        |j                        t         u rd}|j                  }|j                  }nt        |j                        }t        |j                        }d}	 |t        v r=|j                  j                  |      }t        j                  ||j                         }n! ||j                        }||j                  k7  }|j                  t              }|j                  dt              }t        ||d      }	||k7  r||	d<   |	| d   |<   |s| j                  s,|	j                  |j                  |j                         U y y # t        $ r Y w xY w)	Nr   FTrm   r   r{   r   r   )r   rq   r?   r	   r
   astyper   array_equal	Exceptionr<   rp   r   r   rV   )
r.   rk   rx   r   r|   r}   new_t1r<   r   r   s
             r(   r`   z#DeltaResult._from_tree_type_changesc  s_   T!~.  P!%		?d*%*N%yyH%yyH'		2H'		2H%)N
#}4%+YY%5%5h%?F13		1R-RN%-fii%8F .4vyy-@N {{{7!;;d-;H& ( (( 
 8#-5Jz*-7^$T*!T%?%?%%		VYY%OA P "( % s   4A&E##	E/.E/c                     d|v rc|d   D ]Z  }|j                  t              }|j                  dt              }|j                  |j                  d}||k7  r||d<   || d   |<   \ y y )Nr   rm   Tr   r   r   )r<   rp   r?   rq   )r.   rk   rx   r<   r   r   s         r(   rb   z$DeltaResult._from_tree_value_changed  sz    t#/0 ;{{{7!;;d-;H,2IIFIIN8#.6K
+/:%&t,; $r'   c                    d|v r]|d   D ]T  }|j                  d      \  }}}t        |j                  d         }|j                  }	 | d   |   }|d   D ]  }|||<   	 V y y # t        $ r t               x}| d   |<   Y 0w xY w)Nr   T)r   r   r   new_indexes)r<   r   r   rq   r   r   )	r.   rk   rx   r<   r   r   r   r   indexs	            r(   rg   z(DeltaResult._from_tree_repetition_change  s    $&23 	C#[[[=
a&v'8'8'FG
		n6:;\6]^b6c3 (6 CE=B3E:C	C '   nfkfmm3d;\6]^b6cns   A##B Bc                     d|v rl|d   D ]c  }|j                   j                  t              | d   vs)|j                  d      |j                  d}|| d   |j                  t              <   e y y )Nr   rm   ro   Tr   r   )r   r<   rp   r?   r   s       r(   rd   z*DeltaResult._from_tree_iterable_item_moved  s     D(45 <IINNN7tDW?XX/5{{${/GRXR[R["\K0; ./+ 1< 1- .< )r'   )NNFN)r#   r$   r%   r   r9   rX   r   r`   rb   rg   rd   r&   r'   r(   r   r     s.    !2002>&"PH;C<r'   r   c                       e Zd ZdZ	 	 	 	 	 	 	 ddZd Zd Zd Zed        Z	ddZ
ed	        Zed
        Zed        ZddZddZ	 	 	 ddZ	 	 	 ddZd Zy)	DiffLeveluP  
    An object of this class represents a single object-tree-level in a reported change.
    A double-linked list of these object describes a single change on all of its levels.
    Looking at the tree of all changes, a list of those objects represents a single path through the tree
    (which is just fancy for "a change").
    This is the result object class for object reference style reports.

    Example:

    >>> t1 = {2: 2, 4: 44}
    >>> t2 = {2: "b", 5: 55}
    >>> ddiff = DeepDiff(t1, t2, view='tree')
    >>> ddiff
    {'dictionary_item_added': {<DiffLevel id:4560126096, t1:None, t2:55>},
     'dictionary_item_removed': {<DiffLevel id:4560126416, t1:44, t2:None>},
     'type_changes': {<DiffLevel id:4560126608, t1:2, t2:b>}}

    Graph:

    <DiffLevel id:123, original t1,t2>          <DiffLevel id:200, original t1,t2>
                    ↑up                                         ↑up
                    |                                           |
                    | ChildRelationship                         | ChildRelationship
                    |                                           |
                    ↓down                                       ↓down
    <DiffLevel id:13, t1:None, t2:55>            <DiffLevel id:421, t1:44, t2:None>
    .path() = 'root[5]'                         .path() = 'root[4]'

    Note that the 2 top level DiffLevel objects are 2 different objects even though
    they are essentially talking about the same diff operation.


    A ChildRelationship object describing the relationship between t1 and it's child object,
    where t1's child object equals down.t1.

    Think about it like a graph:

    +---------------------------------------------------------------+
    |                                                               |
    |    parent                 difflevel                 parent    |
    |      +                          ^                     +       |
    +------|--------------------------|---------------------|-------+
           |                      |   | up                  |
           | Child                |   |                     | ChildRelationship
           | Relationship         |   |                     |
           |                 down |   |                     |
    +------|----------------------|-------------------------|-------+
    |      v                      v                         v       |
    |    child                  difflevel                 child     |
    |                                                               |
    +---------------------------------------------------------------+


    The child_rel example:

    # dictionary_item_removed is a set so in order to get an item from it:
    >>> (difflevel,) = ddiff['dictionary_item_removed'])
    >>> difflevel.up.t1_child_rel
    <DictRelationship id:456, parent:{2: 2, 4: 44}, child:44, param:4>

    >>> (difflevel,) = ddiff['dictionary_item_added'])
    >>> difflevel
    <DiffLevel id:4560126096, t1:None, t2:55>

    >>> difflevel.up
    >>> <DiffLevel id:4560154512, t1:{2: 2, 4: 44}, t2:{2: 'b', 5: 55}>

    >>> difflevel.up
    <DiffLevel id:4560154512, t1:{2: 2, 4: 44}, t2:{2: 'b', 5: 55}>

    # t1 didn't exist
    >>> difflevel.up.t1_child_rel

    # t2 is added
    >>> difflevel.up.t2_child_rel
    <DictRelationship id:4560154384, parent:{2: 'b', 5: 55}, child:55, param:5>

    Nc
                     || _         || _        || _        || _        || _        |
t               n|| _        || _        || _        t               | _	        |	| _
        y)a  
        :param child_rel1: Either:
                            - An existing ChildRelationship object describing the "down" relationship for t1; or
                            - A ChildRelationship subclass. In this case, we will create the ChildRelationship objects
                              for both t1 and t2.
                            Alternatives for child_rel1 and child_rel2 must be used consistently.
        :param child_rel2: Either:
                            - An existing ChildRelationship object describing the "down" relationship for t2; or
                            - The param argument for a ChildRelationship class we shall create.
                           Alternatives for child_rel1 and child_rel2 must be used consistently.
        N)rq   r?   r   r   rA   r   r   t1_child_relt2_child_rel_pathrU   )
r.   rq   r?   r   r   rA   
child_rel1
child_rel2r   rU   s
             r(   r9   zDiffLevel.__init__  sg    .   	 & &0%7%'Z ' ' W
*r'   c                    | j                   r| j                  r9t        | j                  d      }dj                  | j	                         |      }|S t        | j
                        }t        | j                        }dj                  | j	                         ||      }|S dj                  | j	                               }|S )N#   )
max_lengthz<{} {}>z<{} t1:{}, t2:{}>z<{}>)rU   r   r   rv   r<   rq   r?   )r.   additional_reprresultt1_reprt2_reprs        r(   __repr__zDiffLevel.__repr__?  s    ",T__"L"))$))+G  %TWW-$TWW-,33DIIK'R  ]]499;/Fr'   c                     |t         v r*|(|| j                  |<   t         |   }| |j                  |<   y || j                  |<   y r6   )UP_DOWN__dict__)r.   r8   r   opposite_keys       r(   __setattr__zDiffLevel.__setattr__L  sA    '>e/!&DMM#"3<L+/ENN<(!&DMM#r'   c              #   D   K   | j                    | j                   y wr6   )rq   r?   r\   s    r(   __iter__zDiffLevel.__iter__U  s     ggggs    c                      | j                   d   S )Nr   )r   r\   s    r(   r   zDiffLevel.repetitionY  s    |,,r'   c                 n   | j                   j                  t        ur<t        j	                  || j                  | j                   j                  |      | _        | j                   j                  t        urAt        j	                  || j                  | j                   j                  ||n|      | _        yy)a  
        Auto-populate self.child_rel1 and self.child_rel2.
        This requires self.down to be another valid DiffLevel object.
        :param klass: A ChildRelationship subclass describing the kind of parent-child relationship,
                      e.g. DictRelationship.
        :param param: A ChildRelationship subclass-dependent parameter describing how to get from parent to child,
                      e.g. the key in a dict
        klassparentchildr   N)r   rq   r   ChildRelationshipcreater   r?   r   )r.   r   r   param2s       r(   auto_generate_child_relz!DiffLevel.auto_generate_child_rel]  s     99<<z) 1 8 8DGG499<<u !9 !ND99<<z) 1 8 8DGG499<<PVP^udj !9 !lD *r'   c                 T    | }|j                   r|j                   }|j                   r|S )z
        Get the root object of this comparison.
        (This is a convenient wrapper for following the up attribute as often as you can.)
        :rtype: DiffLevel
        )r   r.   levels     r(   all_upzDiffLevel.all_upm  s'     hhHHE hhr'   c                 T    | }|j                   r|j                   }|j                   r|S )z
        Get the leaf object of this comparison.
        (This is a convenient wrapper for following the down attribute as often as you can.)
        :rtype: DiffLevel
        )r   r   s     r(   all_downzDiffLevel.all_downy  s'     jjJJE jjr'   c                 .    |d S dj                  | |      S )Nz{}{})rv   )rootr   s     r(   _format_resultzDiffLevel._format_result  s    ~tF6==v+FFr'   c                     | j                   }|r|j                  }|j                  S |j                  xs |j                  }|j                  S )z
        Get the path's root key value for this change

        For example if the path to the element that is reported to have a change in value is root['X'][0]
        then get_root_key should return 'X'
        )r   r   r   r   )r.   r   
root_levelnext_rels       r(   get_root_keyzDiffLevel.get_root_key  sI     [[
!..H ~~ "..I*2I2IH~~r'   c                 (   dj                  ||||      }|| j                  v rN| j                  |   }|r+|\  }}	}
| j                  ||      |	| j                  ||
      fS | j                  ||      S |dk(  rdx}
x}}	ng }
| j                  }|r|| ur|r|j                  xs |j
                  }n|j
                  xs |j                  }|nb|dk(  r*|j                  |      }|r|
}|j                  }	|
|z  }
n#d}
n3|dk(  r|
j                  |j                         |j                  }|r|| ur|dk(  r^|r9	|
f| j                  |<   | j                  ||      |	| j                  ||
      f}|S |
| j                  |<   | j                  ||
      }|S |
}|S )a  
        A python syntax string describing how to descend to this level, assuming the top level object is called root.
        Returns None if the path is not representable as a string.
        This might be the case for example if there are sets involved (because then there's not path at all) or because
        custom objects used as dictionary keys (then there is a path but it's not representable).
        Example: root['ingredients'][0]
        Note: We will follow the left side of the comparison branch, i.e. using the t1's to build the path.
        Using t1 or t2 should make no difference at all, except for the last step of a child-added/removed relationship.
        If it does in any other case, your comparison path is corrupt.

        **Parameters**

        :param root: The result string shall start with this var name
        :param force: Bends the meaning of "no string representation".
                      If None:
                        Will strictly return Python-parsable expressions. The result those yield will compare
                        equal to the objects in question.
                      If 'yes':
                        Will return a path including '(unrepresentable)' in place of non string-representable parts.
                      If 'fake':
                        Will try to produce an output optimized for readability.
                        This will pretend all iterables are subscriptable, for example.
        :param output_format: The format of the output. The options are 'str' which is the default and produces a
                              string representation of the path or 'list' to produce a list of keys and attributes
                              that produce the path.
        z{}{}{}{}r    Nrs   )
rv   r   r   r   r   r   get_param_reprr   rt   r   )r.   r   rn   r   r   output_format	cache_keycachedr   r   r   r   r   rJ   outputs                  r(   r<   zDiffLevel.path  s   8 %%e^V]S	

"ZZ	*F(.%v++D&95$BUBUVZ\bBcdd**488E!&((F(VeF T) --C1C1C --C1C1C  %..u5#F$NNEdNF "F&(hnn- JJE5 T)8 E!)/(?

9%--dF;UDDWDWX\^dDef 	 )/

9%,,T6:  Fr'   c                     | j                   }t        ||d||| j                        }||_        |j	                  |||       |S )z
        Start a new comparison level and correctly link it to this one.
        :rtype: DiffLevel
        :return: New level
        N)r   r   rA   rU   )r   r   r   )r   r   rU   r   r   )	r.   r   new_t2child_relationship_classchild_relationship_paramchild_relationship_param2rA   r   r   s	            r(   create_deeperzDiffLevel.create_deeper  sU     F%[X\XjXjl
%%*2JSl 	& 	nr'   c                 N    | j                         }|j                  ||||||      S )z
        Branch this comparison: Do not touch this comparison line, but create a new one with exactly the same content,
        just one level deeper.
        :rtype: DiffLevel
        :return: New level in new comparison line
        )r   r   )r.   r   r   r   r   r   rA   branchs           r(   branch_deeperzDiffLevel.branch_deeper   s4     ##FF4L$<>WYdf 	fr'   c                    | j                   }t        |      }|Ht        |j                        |_        |j                  t        |j                        |_        |j                  dt
        j                  |j                  j                  |j                  |j                  j                  |j                  j                        |_        |j                  dt
        j                  |j                  j                  |j                  |j                  j                  |j                  j                        |_
        |j                  }|j                  |j                  }|H|S )zv
        Get a deep copy of this comparision line.
        :return: The leaf ("downmost") object of the copy.
        r   )r   r   r   r   r   r   r   	__class__rq   r   r   r?   )r.   origr   s      r(   r   zDiffLevel.copy  s   
 {{d $T__ 5Fyy$"499o$$0*;*B*B"//99%yy$kknn"//55	 +C +7F'
 $$0*;*B*B"//99%yy$kknn"//55	 +C +7F' 99D{{&/ 0 r'   )NNNNNNr~   r6   r   )r   NFFr   )NNN)r#   r$   r%   __doc__r9   r   r   r   propertyr   r   r   r   staticmethodr   r   r<   r   r   r   r&   r'   r(   r   r     s    Md !    ?+B' - -l  	 	 	 	 G GRp 0404"&0 0404"&f" r'   r   c                   H    e Zd ZdZdZdZedd       ZddZd Z	ddZ
ddZy)	r   zt
    Describes the relationship between a container object (the "parent") and the contained
    "child" object.
    Nc                 B    t        | t              st         | |||      S r6   )
issubclassr   ru   r   s       r(   r   zChildRelationship.createC  s!    %!23OVUE**r'   c                 .    || _         || _        || _        y r6   )r   r   r   )r.   r   r   r   s       r(   r9   zChildRelationship.__init__I  s     
 
r'   c                     d}t        | j                        }t        | j                        }t        | j                        }|j	                  | j
                  j                  |||      S )Nz"<{} parent:{}, child:{}, param:{}>)r   r   r   r   rv   r   r#   )r.   namer   r   r   s        r(   r   zChildRelationship.__repr__S  sP    3DKK(4::&4::&{{4>>22FE5IIr'   c                 $    | j                  |      S )a  
        Returns a formatted param python parsable string describing this relationship,
        or None if the relationship is not representable as a string.
        This string can be appended to the parent Name.
        Subclasses representing a relationship that cannot be expressed as a string override this method to return None.
        Examples: "[2]", ".attribute", "['mykey']"
        :param force: Bends the meaning of "no string representation".
              If None:
                Will strictly return partials of Python-parsable expressions. The result those yield will compare
                equal to the objects in question.
              If 'yes':
                Will return a formatted param including '(unrepresentable)' instead of the non string-representable part.

        )stringify_param)r.   rn   s     r(   r   z ChildRelationship.get_param_reprZ  s     ##E**r'   c                    | j                   }t        |t              rt        || j                        }nt        |t
              r dj                  t        t        |            }nt        |d      ri|j                  D cg c]  }|t        ||      f c}D cg c]  \  }}| d|  }}}|j                  j                   ddj                  |       d}n t        |      }	 t        |      }	|	|k(  r|nd}|r)| j&                  dn| j&                  j)                  |      }|S c c}w c c}}w # t        t         f$ r'}
t"        j%                  d	| d
|
        d}Y d}
~
id}
~
ww xY w)a  
        Convert param to a string. Return None if there is no string representation.
        This is called by get_param_repr()
        :param force: Bends the meaning of "no string representation".
                      If None:
                        Will strictly return Python-parsable expressions. The result those yield will compare
                        equal to the objects in question.
                      If 'yes':
                        Will return '(unrepresentable)' instead of None if there is no string representation

        TODO: stringify_param has issues with params that when converted to string via repr,
        it is not straight forward to turn them back into the original object.
        Although repr is meant to be able to reconstruct the original object but for complex objects, repr
        often does not recreate the original object.
        Perhaps we should log that the repr reconstruction failed so the user is aware.
        )	quote_strz][__dataclass_fields__=(,)Nz7stringify_param was not able to get a proper repr for "z". This object will be reported as None. Add instructions for this object to DeepDiff's helper.literal_eval_extended to make it work properly: :)r   rO   r   r   r  tuplejoinmapreprhasattrr  getattrr   r#   r   SyntaxError
ValueErrorloggererrorparam_repr_formatrv   )r.   rn   r   r   rB   r8   r   attrs_to_values	candidateresurrectederrs              r(   r  z!ChildRelationship.stringify_paramk  s\   " 

eW%&uGFu%YYs4/0FU23chc}c}B~^_AwuVWGXCYB~JC#aw/O001388O3L2MQOFUIE3I> '2U&: 22:S@V@V@]@]^d@eF) C  , MeW UNNQUTU s$   ?D'D,&D2 2E(E##E(r6   )r#   r$   r%   r  r  r  r  r   r9   r   r   r  r&   r'   r(   r   r   4  s=     
 I+ +
J+"+r'   r   c                       e Zd ZdZdZy)DictRelationship[{}]z'{}'Nr#   r$   r%   r  r  r&   r'   r(   r$  r$    s    Ir'   r$  c                       e Zd ZdZdZy)NumpyArrayRelationshipr%  Nr&  r&   r'   r(   r(  r(    s    Ir'   r(  c                       e Zd Zy)!SubscriptableIterableRelationshipNr"   r&   r'   r(   r*  r*    r)   r'   r*  c                       e Zd Zy)InaccessibleRelationshipNr"   r&   r'   r(   r,  r,    r)   r'   r,  c                       e Zd Zy)SetRelationshipNr"   r&   r'   r(   r.  r.    r)   r'   r.  c                       e Zd ZdZddZy)$NonSubscriptableIterableRelationshipr%  Nc                 b    |dk(  rd}|S |dk(  r| j                   r| j                         }|S d }|S )Nyesz(unrepresentable)r   )r   r  )r.   rn   r   s      r(   r   z3NonSubscriptableIterableRelationship.get_param_repr  sE    E>(F  f_))+F  Fr'   r6   )r#   r$   r%   r  r   r&   r'   r(   r0  r0    s    r'   r0  c                       e Zd ZdZy)AttributeRelationshipz.{}N)r#   r$   r%   r  r&   r'   r(   r4  r4    s    r'   r4  )'loggingcollections.abcr   r   deepdiff.helperr   r   r   r   r	   r
   r   r   r   r   deepdiff.pathr   	getLoggerr#   r  rp   r   r7   r   r   r!   r+   r4   rS   r   r   r   r$  r(  r*  r,  r.  r0  r4  r&   r'   r(   <module>r:     s    #    ,			8	$
&  .	9 	
 
)Q )QX{' {'|O<* O<dC CLb bJ( 
. 
	(8 		0 	
	. 	+C - r'   