
    
3j             	          S SK r S SKrS SKrS SKrS SKrS SKJr  S SKJr  S SK	J
r  S SKJrJrJrJrJrJrJrJrJrJrJrJrJrJr  S SKJrJrJr  S SKJ r   S SK!J"r"  S S	K#J$r$  S S
K%J&r&  S SK'J(r(J)r)J*r*J+r+J,r,J-r-J.r.J/r/J0r0J1r1J2r2J3r3J4r4J5r5J6r6J7r7J8r8J9r9J:r:J;r;J<r<J=r=J>r>J?r?J@r@JArAJBrBJCrCJDrDJErEJFrFJGrGJHrHJIrIJJrJJKrKJLrLJMrMJNrNJOrOJPrPJQrQ  S SKRJSrS  S SKTJUrUJVrV  S SKWJXrXJYrYJZrZJ[r[J\r\J]r]J^r^J_r_J`r`JaraJbrbJcrcJdrdJereJfrf  S SKgJhrhJiri  S SKjJkrk  S SKlJmrmJnrn  S SKoJprp  S SKqJrrrJsrsJtrtJuru  \(       a  S SKvJwrw  \R                  " \y5      rzSr{Sr|\/" S /\-S9r}\8" S5      r~SrS\\\4   S\\/S4   S\SS4S jrSrS rS!rS"rS#rS$rS%rS&rS'rS(rS)rS*rS+rS,rS-rS.rS/rS0r\" S1/5      rS2rS3rS4r " S5 S6\5      r " S7 S8\Y\S\U\\k5      r\yS9:X  a  S SKr\GR:                  " 5         gg):    N)Enum)deepcopy)isclose)ListDictCallableUnionAnyPatternTupleOptionalSet	FrozenSetTYPE_CHECKINGProtocolLiteralcast)MappingIterableSequence)defaultdict)
getmembers)zip_longest)	lru_cache)*strings
bytes_typenumbersuuidsListItemRemovedOrAdded
notpresent	not_foundIndexedHashunprocessedadd_to_frozen_setbasic_types(convert_item_or_items_into_set_else_noneget_type5convert_item_or_items_into_compiled_regexes_else_nonetype_is_subclass_of_type_grouptype_in_type_groupget_docnumber_to_stringdatetime_normalizeKEY_TO_VAL_STRbooleans
np_ndarraynp_floatingget_numpy_ndarray_rowsRepeatedTimer	TEXT_VIEW	TREE_VIEW
DELTA_VIEWCOLORED_VIEWCOLORED_COMPACT_VIEWdetailed__dict__add_root_to_pathsnpget_truncate_datetimedict_CannotCompareENUM_INCLUDE_KEYSPydanticBaseModelOpcode
SetOrderedipranges!separate_wildcard_and_exact_paths)SerializationMixin)DistanceMixinlogarithmic_similarity)	RemapDict
ResultDict
TextResult
TreeResult	DiffLevelDictRelationshipAttributeRelationshipREPORT_KEYS!SubscriptableIterableRelationship$NonSubscriptableIterableRelationshipSetRelationshipNumpyArrayRelationshipCUSTOM_FIELDFORCE_DEFAULTChildRelationship)DeepHashcombine_hashes_lists)Base)LFUCacheDummyLFU)ColoredView)normalize_mp_configcompute_distances_parallelcompute_hashes_parallelcompute_subtree_diffs_parallel)
BaseTzInfozDeepDiff has reached the max number of passes of {}. You can possibly get more accurate results by increasing the max_passes parameter.zDeepDiff has reached the max number of diffs of {}. You can possibly get more accurate results by increasing the max_diffs parameter.indexesitemzdiff_doc.rstz3DeepDiff {} seconds in progress. Pass #{}, Diff #{}_statsprogress_loggerdurationreturnc                 X    U" [         R                  X [           U [           5      5        g)z(
Report the progress every few seconds.
N)PROGRESS_MSGformatPASSES_COUNT
DIFF_COUNT)re   rf   rg   s      G/home/wildlama/miniconda3/lib/python3.13/site-packages/deepdiff/diff.py_report_progressro   K   s#     L''2FzHZ[\    DISTANCE CACHE HIT COUNT
DIFF COUNTPASSES COUNTzMAX PASS LIMIT REACHEDzMAX DIFF LIMIT REACHEDzDISTANCE CACHE ENABLEDzPREVIOUS DIFF COUNTz!PREVIOUS DISTANCE CACHE HIT COUNTzWORKER DIFF COUNTzWORKER PASSES COUNTzWORKER DISTANCE CACHE HIT COUNTzWORKER BATCH COUNTzWUnable to import numpy. This must be a bug in DeepDiff since a numpy array is detected.ziview parameter must be one of 'text', 'tree', 'delta', 'colored' or 'colored_compact'. But {} was passed.z=cutoff_distance_for_pairs needs to be a positive float max 1.z#verbose_level should be 0, 1, or 2.z'cache_purge_level should be 0, 1, or 2._ENABLE_CACHE_EVERY_X_DIFFmodel_fields_setg333333?gffffff?)exclude_typesexclude_pathsexclude_glob_pathsinclude_pathsinclude_glob_pathsexclude_regex_pathshashersignificant_digitsnumber_format_notationignore_string_type_changesignore_numeric_type_changesignore_uuid_typesuse_enum_valueignore_type_in_groupsignore_type_subclassesignore_string_caseexclude_obj_callbackignore_private_variables	encodingsignore_encoding_errorsdefault_timezonecustom_operatorsc                   b    \ rS rSr% \\S'   \\S'   \\S'   \\S'   \\S'   \\S'   \	\   \S'   S	r
g
)DeepDiffProtocol   t1t2cutoff_distance_for_pairsuse_log_scalelog_scale_similarity_thresholdviewmath_epsilon N)__name__
__module____qualname____firstlineno__r
   __annotations__floatboolstrr   __static_attributes__r   rp   rn   r   r      s-    GG$$$))
I5/!rp   r   c            z         ^  \ rS rSr\rSrSSSSS\\\	R                  R                  SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS	SSSS
S\R                  SSSSSSS\SSS49S\S\S\\   S\S\S\S\\\      S\S\S\\	R                  S4   S\\\      S\\   S\\   S\\\\   \\   \\   S4   S\\\\   \\   \\\      S4   S\\\      S\S\\\\\4   \S4   S\\\S4   S \\   S!\\\\4      S"\S#\S$\S%\S&\\   S'\S(\S)\S*\\\\S+4         S,\S-\S.\\   S/\\   S0\\\\   S4   S1\\   S2\S3\S4\S5\\   S6\\   S7\S8\S9\\   S:\\   S;\S<   S=\\   S>\\/S4   S?\S@\\   SA\SB\\   SC\SD\SE\SF\SG\SH\\\\4      SI\\\\4      4vU 4SJ jjjrSK r SSL jr!SSM jr"SN r#\$SO\SP\\\4   4SQ j5       r%\&" 5       S4SR\SS\\   ST\\   SPS4SU jjr'\&" 5       SSS4SR\SS\\   SV\ST\\   SW\SPS4SX jjr(SR\SP\4SY jr)SR\SZ\SP\4S[ jr*S\\SR\SP\\\4   4S] jr+\&" / 5      SSSSS4SR\SS\\   S^\S_\S`\Sa\ST\\   SPS4Sb jjr,SSR\ST\\   SPS4Sc jjr-\$S\S\SP\4Sd j5       r.\&" 5       SS4SR\SS\\   S\\   ST\\   SPS4
Se jjr/  SSf\\   Sg\\   Sh\\   Si\\   SP\\\\\4   \\\4   4      4
Sj jjr0  SSP\\\\\4   \\\4   4      4Sk jjr1\&" 5       SS4Sl jr2Sm\3\   SP\4Sn jr4\&" 5       SSSSSS4So jr5\&" 5       SS4Sp jr6SSq jr7SSr jr8Ss r9St r:Su r;\$\<" SvSw9Sx 5       5       r= SSy jr>Sz r?S{ r@S| rAS} rBS~ rCS rDSS jrESS jrFSS jrGSS jrHSS jrISS jrJSS jrK\&" 5       S4S jrLSS jrMS rNS rOS rPS rQ\&" 5       SS4S jrRSS jrS\$S 5       rTS rUS rV\WS 5       rX\WS 5       rYU 4S jrZSr[U =r\$ )DeepDiff   g      ?N   r   FTg?i fgQ?r   r   _original_typecache_purge_level
cache_sizecache_tuning_sample_sizer   r   cutoff_intersection_for_pairsr   ra   r   r   exclude_obj_callback_strictrw   r{   rv   get_deep_distancegroup_bygroup_by_sort_keyr|   hashesr   ignore_nan_inequalityr   ignore_orderignore_order_funcr   r   r   r   .r   r   include_obj_callbackinclude_obj_callback_strictry   iterable_compare_funclog_frequency_in_secr   log_stacktracer   	max_diffs
max_passesmultiprocessingmultiprocessing_workersmultiprocessing_thresholdr~   )r   enumber_to_string_funcrf   report_repetitionr}   threshold_to_diff_deepertruncate_datetimer   r   verbose_levelr   zip_ordered_iterables_parameters_shared_parametersc<                 B  >^ [         TIU ]  5         S U l        S U l        U<(       a+  [	        SSR                  U<R                  5       5      -  5      eU:(       a  U R                  R                  U:5        GOU=(       d    / U l	        UU l
        UU l        U=(       d    / n[        U:X  d
  [        U;   a  SnUU l        [        U:X  d
  [        U;   a  Sn[        S   [         4n=U=U:X  d  U=U;   a  Sn U U l        U5U l        U&U l        U6U l        Xl        U'U l        U3U l        UU l        U R3                  UUUUU S9U l        U1U l        [9        U5      n>[;        U>5      u  n?U l        [=        U?5      U l        [9        U#5      n@[;        U@5      u  nAU l        [=        UA5      U l         [C        U5      U l"        U(       a  [G        U5      OS U l$        U(       a  [K        U5      OS U l&        UU l'        U(       a  [P        O[R        U l*        UU l+        Xl,        Xl-        U!U l.        U"U l/        U/=(       d    [`        U l0        U$U l1        U9U l2        UU l3        UU l4        UU l5        X`l6        UU l7        [q        T5      (       a  TU l9        OT(       a  U4S jnBUBU l9        OS U l9        Xl:        UU l;        U Ry                  U2U5      U l=        U(U l>        U R|                  b&  U R                  (       a  [~        R                  S5        [        U45      U lB        U.U lC        U7S;   a  U7U lD        O[	        [        5      eUS;  a  [	        [        5      eU8U lG        U*U lH        U)U lI        [        U5      U lK        [        U	5      U lL        U R                  S:  d  U R                  S	:  a  [	        [        5      eU0U lN        XPlO        [        U+U,U-5      U lQ        U R                  R                  5       n:S U:S
'   U'(       a  [~        R                  U lT        O[~        R                  U lT        U;(       a-  SU lV        U;U lW        U R                  R                  U;5        S nCGO.SU lV        U(       a  [        U5      O	[        5       U lZ        [        S[        S[        S[        S[        S[        S[        S[        [        U5      [        S[        S[        S[        S0U lh        Uc
  [        5       OUU lj        [        5       U lk        [G        5       U ll        SU R                  SU R                  SU R                  SU R                  SU R                  [        U Rl                  S-  0U lW        U%(       a  [        U%[        U R                  U05      nCOS nCU:U lp        U R                  5       U lr        [        5       U lt        0 U lu        U(       a7  U R                  (       a&   UnDU R                  UUSS9n U R                  UUSS9nXlx        X ly         [        XU R                  S9nEU R                  UE[        [        U5      15      US9  U(       a.  U8[        [        1;   a  U GR                  5       U R                  S'   U R                  GR                  5         U GR                  U R                  5      nFG[        UFG[        5      (       a#  U R                  WFR                  5        UFU l        OU R                  WF5        U R                  (       a  U(       a  U ?ZU ?jU ?WU ?p[        [        [        4 H  nGU R                  UG	 M     WC(       aU  WCGR                  5       nHUHU R                  S'   [~        GR                  SGR                  U GR                  5       5      5        US:X  a  U R                  GR                  5         g g g ! [        [        4 a    WDn GNf = f! [        [        4 a     GNf = f! U R                  (       a  U(       a  U ?ZU ?jU ?WU ?p[        [        [        4 H  nGU R                  UG	 M     WC(       aU  WCGR                  5       nHUHU R                  S'   [~        GR                  SGR                  U GR                  5       5      5        US:X  a  U R                  GR                  5         f f f = f)Na  The following parameter(s) are not valid: %s
The valid parameters are ignore_order, report_repetition, significant_digits, number_format_notation, exclude_paths, include_paths, exclude_types, exclude_regex_paths, ignore_type_in_groups, ignore_string_type_changes, ignore_numeric_type_changes, ignore_type_subclasses, ignore_uuid_types, truncate_datetime, ignore_private_variables, ignore_nan_inequality, number_to_string_func, verbose_level, view, hasher, hashes, max_passes, max_diffs, zip_ordered_iterables, cutoff_distance_for_pairs, cutoff_intersection_for_pairs, log_frequency_in_sec, cache_size, cache_tuning_sample_size, get_deep_distance, group_by, group_by_sort_key, cache_purge_level, log_stacktrace,math_epsilon, iterable_compare_func, use_enum_value, _original_type, threshold_to_diff_deeper, default_timezone ignore_order_func, custom_operators, encodings, ignore_encoding_errors, use_log_scale, log_scale_similarity_threshold multiprocessing, multiprocessing_workers, multiprocessing_threshold, _parameters and _shared_parameters.z, Tr   )r   r   r   r   r   c                    > U T   $ Nr   )xr   s    rn   _group_by_sort_key-DeepDiff.__init__.<locals>._group_by_sort_key&  s    .//rp   zmath_epsilon in conjunction with ignore_order=True is only used for flat object comparisons. Custom math_epsilon will not have an effect when comparing nested objects.>   r   r      r   r   Fr   re   _distance_cachegroup_by_keys_numpy_paths
   r   )	item_namer   )r   )parents_idsr   deep_distancezDURATION SECzstats {}r   )super__init__rx   rz   
ValueErrorjoinkeys__dict__updater   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   get_ignore_types_in_groupsr   r   r&   rD   r:   rw   ry   r(   r{   setrv   tupleexclude_types_tupler   r*   r)   type_check_funcr   r   r   r   r   r,   r   r   r   r   r|   r   r   callabler   r   r   get_significant_digitsr}   r   loggerwarningr<   r   r~   r   VERBOSE_LEVEL_RANGE_MSGPURGE_LEVEL_RANGE_MSGr   r   r   r   r   r   CUTOFF_RANGE_ERROR_MSGrf   r   r]   
_mp_configcopy	exceptionlog_errerroris_rootr   rZ   r[   r   rl   rm   DISTANCE_CACHE_HIT_COUNTPREVIOUS_DIFF_COUNT!PREVIOUS_DISTANCE_CACHE_HIT_COUNTMAX_PASS_LIMIT_REACHEDMAX_DIFF_LIMIT_REACHEDDISTANCE_CACHE_ENABLEDr   WORKER_DIFF_COUNTWORKER_PASSES_COUNTWORKER_DISTANCE_CACHE_HIT_COUNTWORKER_BATCH_COUNTre   r=   r   r   r   rt   r3   ro   r   _get_deephash_paramsdeephash_parametersrK   tree_iterable_opcodes_group_iterable_to_dictKeyErrorr   r   rL   _diff	frozensetidr4   r5   _get_rough_distanceremove_empty_keys_get_view_results
isinstancer\   _colored_viewstopinfork   	get_statsclear)Jselfr   r   r   r   r   r   r   r   r   r   r   r   r   rw   r{   rv   r   r   r   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   ry   r   r   r   r   r   r   r   r   r   r   r~   r   rf   r   r}   r   r   r   r   r   r   r   r   r   kwargsuuid_str_group_exclude_set_exclude_exact_include_set_include_exactr   progress_timeroriginal_t1rootview_resultskeyrg   	__class__sJ                      `                                                     rn   r   DeepDiff.__init__   s   z 	 #'"&6 :>6;;=9QR S S MM  -$4$:D! ,D%6D"$9$?R!//7>S3S.2+/JD,//7>S3S-1*#Ah_N!66.La:a$(!%6D""0D2PD/!.D$4!"0D,DD).HD+)-)H)H&;+E,G'="3 *I *5D& &7D"CMRL6WXd6e3ND3!2>!BDCMRL6WXd6e3ND3!2>!BD'\]p'qD$7D]!3$D?Lu]';RVD$*@D'9O#5UsD &8D#(<%/J,(<D%/JD,$9$M=MD!)>D&)>D&,DD))>D& DK,D)$DM)**):&"0);&)-&&N*@D'&*&A&ABTVq&rD# ,D  ,1B1B   I  J%:;L%MD"*@D'	)%2" !899 	1 !677DI(DO&DN-23L-MD*167T1UD.--1T5S5SVW5W !788
 $3D (O1!8:SUDO--,,.K&*K
#%//%||  DL&8D#MM  !34!N  DL;E8J#78:D aA(!#Q11&&&Z(8 "1#Q/"ADK" &,^%'DK %D!$D$++$++!4#7#7!3!3 1 1*D,I,IB,N'D# $!./CEUW[WbWbds!t!%&#'#<#<#> L	!#	% 11"h$1O%55b(d5SB  	*R43E3EFD JJtBrF8)<^J\ Ti-C%C-1-E-E-G		/*II'')11$))<L,44L--.%1"L)||$,+$/1R24CC(4 "-224H2:DKK/KK
 1 1$..2B CD$)MM'') * 1 !*- %$B% j) : ||$,+$/1R24CC(4 "-224H2:DKK/KK
 1 1$..2B CD$)MM'') * s2   _ ^( 4C/_ (^>=^>__Cbc                     [          Vs0 s H  oU R                  R                  U5      _M      nnU R                  (       + US'   U R                  US'   U$ s  snf )Nignore_repetitionr   )DEEPHASH_PARAM_KEYSr   getr   r,   )r  r  results      rn   r   DeepDiff._get_deephash_params  s\    <OP<OSt''++C00<OP*.*@*@&@"#*.*?*?&' Qs   %Ac                     U R                  U5      (       dB  U R                  U5      (       a  gXl        Uc  U R                  OUnXA   R	                  U5        gg)a  
Add a detected change to the reference-style result dictionary.
report_type will be added to level.
(We'll create the text-style report from there later.)
:param report_type: A well defined string key describing the type of change.
                    Examples: "set_item_added", "values_changed"
:param change_level: A DiffLevel object describing the objects in question in their
               before-change and after-change object structure.

:local_tree: None
N)
_skip_this_skip_report_for_include_globreport_typer   add)r  r  change_level
local_treer   s        rn   _report_resultDeepDiff._report_result  sS     |,,11,??'2$ * 2499
D!!,/ -rp   c                     U R                  U5      (       dN  U R                  U5      (       a  gXl        X2R                  [        '   U R
                  U   R                  U5        gg)a  
Add a detected change to the reference-style result dictionary.
report_type will be added to level.
(We'll create the text-style report from there later.)

:param report_type: A well defined string key describing the type of change.
    Examples: "set_item_added", "values_changed"
:param parent: A DiffLevel object describing the objects in question in their
    before-change and after-change object structure.
:param extra_info: A dict that describe this result
:rtype: None
N)r  r  r  
additionalrT   r   r   )r  r  level
extra_infos       rn   custom_report_resultDeepDiff.custom_report_result  sW     u%%11%88 +-7\*IIk"&&u- &rp   c                    U R                   (       d  gUR                  5       nU R                  (       a*  X R                  ;   a  gU R                   H
  nX2;   d  M
    g   U R                    H  nUR                  U5      (       d  M    g   g)a  When include_glob_paths is set, _skip_this allows ancestors through for traversal.
This method does a stricter check at report time: only report if the path
actually matches a glob pattern or is a descendant of a matching path,
or if it already matches an exact include_path.FT)rz   pathry   match_or_is_descendant)r  r'  
level_pathprefixgps        rn   r  &DeepDiff._skip_report_for_include_glob  sw    
 &&ZZ\
///,,'  - ))B((44 * rp   objectrh   c           	        ^  S[         S[         4U 4S jjn/ n[        T [        5      (       a  T R                  nOT R                  R                  nU HR  n[        USS 5      nU(       d  M  [        U[        5      (       a  UR                  U5        MA  UR                  U5        MT     U Vs0 s H+  n[        T U" U5      =n5      (       d  M  U[        T U5      _M-     sn$ s  snf )N	attributerh   c                    > U R                  S5      (       a)  U S:w  a#  SR                  [        T5      R                  U S9$ U $ )N____weakref__z_{type}{attribute})typer4  )
startswithrk   r8  r   )r4  r2  s    rn   unmangle+DeepDiff._dict_from_slots.<locals>.unmangle  sK    ##D))i=.H+22f..' 3   rp   	__slots__)
r   r  r8  __mro__r  getattrr   appendextendhasattr)r2  r:  	all_slotsmrotype_in_mroslotsir  s   `       rn   _dict_from_slotsDeepDiff._dict_from_slots  s    	 	 	 	fd##..C""**CKKd;EueW--$$U+$$U+  2;bAgfU]^_U`N`c>a'763''bbbs   ,C!C!r'  r   r"  c           
          [        UR                  [        S9n[        UR                  [        S9nU R	                  UUSSUUUS9  g )N)include_keysTprint_as_attributeoverrideoverride_t1override_t2r"  )r9   r   r?   r   
_diff_dict)r  r'  r   r"  r   r   s         rn   
_diff_enumDeepDiff._diff_enum  sJ    ehh5FGehh5FG#! 	 	
rp   is_namedtupleis_pydantic_objectc           
         SnSnSn U(       a6  UR                   R                  5       nUR                  R                  5       nGOhU(       aH  [        UR                   U R                  [
        S9n[        UR                  U R                  [
        S9nGO[        S U 5       5      (       a=  [        UR                   U R                  S9n[        UR                  U R                  S9nO[        S U 5       5      (       a7  U R                  UR                   5      nU R                  UR                  5      nOw[        UR                   5       V	V
s0 s H  u  p[        U
5      (       a  M  X_M     nn	n
[        UR                  5       V	V
s0 s H  u  p[        U
5      (       a  M  X_M     nn	n
 USL d  Ub  Uc  U R                  SXS	9  gU R                  UUSSUUUS
9  gs  sn
n	f s  sn
n	f ! [         a    Sn NLf = f)zDifference of 2 objectsFN)r   ignore_keysc              3   >   #    U  H  nS [        U5      ;   v   M     g7f)r   Ndir.0ts     rn   	<genexpr>%DeepDiff._diff_obj.<locals>.<genexpr>-  s     95aZ3q6)5   )r   c              3   >   #    U  H  nS [        U5      ;   v   M     g7f)r<  NrX  rZ  s     rn   r]  r^  0  s     :Eq[CF*Er_  Tr#   r"  rK  )r   _asdictr   r9   r   ru   allrG  r   r   AttributeErrorr#  rP  )r  r'  r   rS  r"  rT  processing_errorr   r   kvs              rn   	_diff_objDeepDiff._diff_obj!  s    '+'+	$XX%%'XX%%'#%ehhIfIf  uE  F%ehhIfIf  uE  F95999%ehhIfIfg%ehhIfIfg:E:::**5884**5884'1%((';O';tq8A;dad';O'1%((';O';tq8A;dad';O t#rzRZuL#! 	 	
 PO 	$#	$sV   ;G+ AG+ AG+ (AG+ 6G+ G(G.G+ 	G%#G%)G+ G+ +G:9G:c                   ^ UR                  5       mSnU R                  (       a  TU R                  ;   a  SnO7U R                  (       a&  [        U4S jU R                   5       5      (       a  SnU(       d  U R                  (       d  U R
                  (       a  TS:w  a  SnU R                  (       a6  TU R                  ;   a  SnO#U R                   H  nUT;   d  TU;   d  M  Sn  O   U(       a?  U R
                  (       a.  U R
                   H  nUR                  T5      (       d  M  Sn  U$    U$ U R                  (       a=  [        U R                   Vs/ s H  oUR                  T5      PM     sn5      (       a  SnU$ U R                  (       aN  [        UR                  U R                  5      (       d%  [        UR                  U R                  5      (       a  SnU$ U R                  (       aF  U R                  UR                  T5      (       d!  U R                  UR                  T5      (       a  SnU$ U R                  (       aF  U R                  UR                  T5      (       a%  U R                  UR                  T5      (       a  SnU$ U R                  (       aN  TS:w  aH  SnU R                  UR                  T5      (       d!  U R                  UR                  T5      (       a  SnU$ U R                   (       aL  TS:w  aF  SnU R!                  UR                  T5      (       a#  U R!                  UR                  T5      (       a  SnU$ s  snf )z~
Check whether this comparison should be skipped because one of the objects to compare meets exclusion criteria.
:rtype: bool
FTc              3   D   >#    U  H  oR                  T5      v   M     g 7fr   match)r[  r0  r.  s     rn   r]  &DeepDiff._skip_this.<locals>.<genexpr>O  s     ,dLcbXXj-A-ALc    r  )r,  rw   rx   anyry   rz   match_or_is_ancestorr{   searchr   r  r   r   r   r   r   r   )r  r'  skipr/  r0  exclude_regex_pathr.  s         @rn   r  DeepDiff._skip_thisF  s   
 ZZ\
*0B0B"BD$$,dDLcLc,d)d)dD++t/F/FJZ`L`D!!!3!33 D"&"4"4!Z/:3G#(D! #5 //11B..z::$0 7 26 / %%#QUQiQijQi;M**:6Qij+l +lD* ) %%EHHd&>&>??:ehhX\XpXpCqCqD$ # &&**588Z@@DD]D]^c^f^fhrDsDsD  --11%((JGG11%((JGGD  &&:+?D))%((J??4C\C\]b]e]egqCrCr  --*2FD00:FF44UXXzJJ- ks   Mr  c                 $   U R                   c  U R                  c  gSR                  UR                  5       U5      nU R                   (       a  X0R                   ;   a  gUR                  5       U R                   ;   a  gU R                    H
  nX4;   d  M
    g   UR                  nUb0  UR                  5       U R                   ;   a  gUR                  nUb  M0  U R                  (       a+  U R                   H  nUR                  U5      (       d  M    g   g)NFz{}['{}']T)ry   rz   rk   r,  uprq  )r  r'  r  key_pathr/  rw  r0  s          rn   _skip_this_keyDeepDiff._skip_this_keyy  s    %$*A*A*I$$UZZ\37---zz|t111,,%
 ! - B.779 2 22 UU . ""--**844  . rp   r   c           	      F   [        5       nU GH  nU R                  (       a(  [        U[        5      (       a  UR	                  S5      nGOZU R                  (       a6  [        U[
        5      (       a!  UR                  5       R	                  S5      nGOU R                  (       a"  [        U[        5      (       a  UR                  nO[        U[        5      (       a  [        U S5      (       aD  X@R                  ;   a5  U R                  c  UnOU R                  X@R                  U R                  S9nOvU R                   (       a  SOUR"                  R$                  nU R                  c  UnO$U R                  X@R                  U R                  S9n[&        R(                  " Xe5      nOUnU R*                  (       a%  [        U[,        5      (       a  UR/                  5       nXS;   a9  [0        R3                  SR)                  XCU   UR5                  5       5      5        GM  XCU'   GM     U$ )a  
Get a dictionary of cleaned value of keys to the keys themselves.
This is mainly used to transform the keys when the type changes of keys should be ignored.

TODO: needs also some key conversion for groups of types other than the built-in strings and numbers.
utf-8r   r}   r~   numberzv{} and {} in {} become the same key when ignore_numeric_type_changesor ignore_numeric_type_changes are set to be true.)r=   r   r  bytesdecode
memoryviewtobytesr   r   valuer   rA  r   r}   r,   r~   r   r  r   r.   rk   r   r   lowerr   r   r,  )r  r   r'  r  r  	clean_keytype_s          rn   _get_clean_to_keys_mapping#DeepDiff._get_clean_to_keys_mapping  s    C..:c53I3IJJw/	00ZZ5P5PKKM009	$$C)>)>II	C))411c=O=O6O..6$'	$($9$9#RiRiQUQlQl %: %n	 )-(H(HHcmmNdNdE..6$'	$($9$9#RiRiQUQlQl %: %n	 . 5 5e GI	&&:i+E+E%OO-	" !UV\V\$'	):EJJLWJK %(y!A B rp   rL  rM  rN  rO  c           	       	  ^ U(       a  UnUn	OUR                   nUR                  n	U(       a  Sn
Sn[        nO
Sn
Sn[        nU R                  (       a  [        U Vs/ s HJ  n[        U[        5      (       a  UR                  S5      (       a  M0  U R                  X5      (       a  MH  UPML     sn5      n[        U	 Vs/ s HJ  n[        U[        5      (       a  UR                  S5      (       a  M0  U R                  X5      (       a  MH  UPML     sn5      nOf[        U Vs/ s H  oR                  X5      (       a  M  UPM     sn5      n[        U	 Vs/ s H  oR                  X5      (       a  M  UPM     sn5      nU R                  (       d"  U R                  (       d  U R                  (       aQ  U R                  XS9nU R                  XS9n[        UR                  5       5      n[        UR                  5       5      nOS=nnX-  nUU-
  nUU-
  nU R                  (       Ga  U R                   (       d  U R"                  (       a  X-   Vs1 s H!  oR%                  5        S['        U5       S	3iM#     nnU R                   (       a  UU R                   -  nU R"                  (       a9  U V^s1 s H+  m[)        U4S
 jU R"                   5       5      (       a  M)  TiM-     nn[+        U5      nO[+        X-  5      nUS:  a-  [+        U5      U-  U R                  :  a  U R-                  SXS9  gU HT  nU R/                  5       [0        L a    gU(       a  UU   OUnUR3                  [4        X   UUUS9nU R-                  U
UUS9  MV     U HT  nU R/                  5       [0        L a    gU(       a  UU   OUnUR3                  X   [4        UUUS9nU R-                  UUUS9  MV     U H  nU R/                  5       [0        L a    gU(       a  UU   OUnU(       a  UU   OUn[7        UU   5      nU(       a  UU;   a  MU  [9        UU5      nUR3                  UU   U	U   UUUS9nU R;                  UUUS9  M     gs  snf s  snf s  snf s  snf s  snf s  snf )zDifference of 2 dictionariesattribute_addedattribute_removeddictionary_item_addeddictionary_item_removedr6  )r   r'  N[]c              3   D   >#    U  H  oR                  T5      v   M     g 7fr   rl  )r[  r0  rf  s     rn   r]  &DeepDiff._diff_dict.<locals>.<genexpr>  s     .]E\rxx{{E\ro  r   values_changedra  child_relationship_classchild_relationship_paramchild_relationship_param2)r   r   rN   rM   r   rB   r  r   r9  ry  r   r   r   r  r   r   rw   rx   r,  reprrp  lenr#  _count_diffStopIterationbranch_deeperr    r   r$   r   )r  r'  r   rL  rM  rN  rO  r"  r   r   item_added_keyitem_removed_key	rel_classr  t1_keyst2_keyst1_clean_to_keyst2_clean_to_keyst_keys_intersectt_keys_addedt_keys_removedt_keys_unionrf  t_keys_union_lenr!  key1key2item_idparents_ids_added
next_levels                         `       rn   rP  DeepDiff._diff_dict  sy     BBBB.N2-I4N8(I((   "S#:c3;O;OTWTbTbcgTh#rv  sF  sF  GL  sR#  "S  TG   "S#:c3;O;OTWTbTbcgTh#rv  sF  sF  GL  sR#  "S  TG ![#;N;Nu;Z#![\G ![#;N;Nu;Z#![\G**d.N.NRVRiRi#>>G>Y#>>G>Y !1!6!6!89G !1!6!6!89G266/",!11 #33(((!!T%<%<KRK\^K\3::<.$s)A >K\^%% D$6$66L**/; $_|!+..]TE\E\.]+] %&|L $_#&|#4 #&w'8#9 !#,<(=@P(PSWSpSp(p##$4e#SC!]2+;"3'C ..)2),*- / L T   "C!]2+;"3'C ..)2),*- / L  0,:V " $C!]2,<#C(#D,<#C(#DDlGw+5 1+w G ,,44)2),*- - J JJz#4JL' $y "S "S![![  _$_sN   /Q2Q2'Q2=/Q70Q7Q7Q<<Q<R/R(R,(RRc                 x   U R                  US5      nU R                  US5      n[        UR                  5       5      n[        UR                  5       5      nXe-
  nXV-
  nU V	s/ s H  oU	   R                  PM     n
n	U V	s/ s H  oU	   R                  PM     nn	U
 HE  nU R	                  5       [
        L a    gUR                  [        U[        S9nU R                  SXS9  MG     U HE  nU R	                  5       [
        L a    gUR                  U[        [        S9nU R                  SXS9  MG     gs  sn	f s  sn	f )zDifference of setsr   r   N)r  set_item_addedra  set_item_removed)
_create_hashtabler   r   rd   r  r  r  r    rR   r#  )r  r'  r"  t1_hashtablet2_hashtable	t1_hashes	t2_hasheshashes_addedhashes_removedrF  items_addeditems_removedrd   r!  s                 rn   	_diff_setDeepDiff._diff_set3  s=   --eT:--eT:))+,	))+,	 ,".5AB\A++\B7EF~!a--~FD!]2 ..D? / LL 0,V   "D!]2 ..j? / LL 2LX " CFs   #D2D7c                 l     [        U S5      (       a  [        US5      (       a  gg! [         a     gf = f)N__getitem__TF)r>  rd  )r   r   s     rn   _iterables_subscriptable!DeepDiff._iterables_subscriptableQ  s8    	r=))gb-.H.H 		s   "& 
33c                     U R                   (       a  U R                  U5      (       d  U R                  (       a  U R                  XX4S9  gU R                  XX4S9  g)zDifference of iterablesr   r"  N)r   r   _diff_iterable_with_deephash_diff_iterable_in_order)r  r'  r   r   r"  s        rn   _diff_iterableDeepDiff._diff_iterable[  sJ    ""t'='=e'D'DIZIZ--eQ_-w((N(rrp   t1_from_indext1_to_indext2_from_indext2_to_indexc                 j   Ub  UcJ  [        [        UR                  UR                  [        S95       VVVs/ s H  u  nu  pxXf4Xx44PM     snnn$ UR                  X# n	UR                  XE n
[        [        X[        S95       VVVs/ s H  u  nu  pxXb-   Xd-   4Xx44PM     snnn$ s  snnnf s  snnnf )zb
Default compare if `iterable_compare_func` is not provided.
This will compare in sequence order.
)	fillvalue)	enumerater   r   r   r   )r  r'  r  r  r  r  rF  r   yt1_chunkt2_chunks              rn   _compare_in_orderDeepDiff._compare_in_orderb  s      M$96?HHehh2HJ7K L 7KFQaVaV$ 7K L L xx:Hxx:HV_2HJWK L WKFQa'):;aVD WK L LLLs   B'B.c           	      >   U R                   c  U R                  UX#XES9$  / n[        5       n[        5       n[        UR                  5       H  u  pSn[        UR
                  5       H  u  pX;   a  M  U R                  XU5      (       d  M%  [        U4U R                  SS.U R                  D6nUR                  U5        UR                  X   5        UR                  X4X445        Sn  O   U(       a  M  UR                  U	S4U
[        445        M     [        UR
                  5       HM  u  p[        U4U R                  SS.U R                  D6nX   U;  d  M2  UR                  SU4[        U445        MO     U$ ! [         a    U R                  UX#XES9s $ f = f)z
Given a level get matching pairs. This returns list of two tuples in the form:
[
  (t1 index, t2 index), (t1 item, t2 item)
]

This will compare using the passed in `iterable_compare_func` if available.
Default it to compare in order
r  r  r  r  FT)r   
apply_hash)r   r  r   r  r   r   rW   r   r   r   r?  r   r>   )r  r'  r  r  r  r  matches	y_matchedy_index_matchedrF  r   x_foundjr  	deep_hashs                  rn   _get_matching_pairsDeepDiff._get_matching_pairsv  s    %%-))++ *  
+	GI!eO!%((+%ehh/DA+ !11!>>$,Q %/48KK8<%/ 04/G/G%/	
 (++A.!il3'78"&% 0( wNNQGa1G-H#IJ/ ,0 "%((+$Q ',0KK04' (,'?'?'	
 <y0NNRG.Da-H#IJ , N 	))++ *  	s&   A(E> A'E> 7A"E>  E> >FFc                 V   U R                  UR                  UR                  5      nU(       a  [        nO[        nU R
                  (       GdJ  [        UR                  [        5      (       Ga*  [        UR                  [        5      (       Ga
  U R                  UR                  5      (       a  U R                  UR                  5      (       a  U R                  c  [        5       nU R                  UUUUUS9n[        U5      S:  aW  [        5       n	U R                  UUUUU	S9  [        U5      [        U	5      :  a  U	nOXR                  UR                  [         S9'   UR#                  5        H%  u  pU(       d  M  U R$                  U
==   U-  ss'   M'     g U R                  UUUUUS9  g )N)r   r   r  r"  r   )force)r  r   r   rP   rQ   r   r  r   _all_values_basic_hashabler   rK   !_diff_ordered_iterable_by_difflibr  /_diff_by_forming_pairs_and_comparing_one_by_oner   r,  rU   itemsr   )r  r'  r   r   r"  subscriptabler  local_tree_passopcodes_with_valueslocal_tree_pass2r  levelss               rn   r   DeepDiff._diff_iterable_in_order  s   55ehhI'H$'K$ ***588X..588X..//99//99**2(lO"&"H"H'-)A* #I # ?#a'#-< DD +#1-E/ E  '3/?+@@&6ONa**5::M:+JK'6'<'<'>#6IIk*f4* (? @@'-)A% A rp   iterablec                     [        U[        R                  5      (       a  gU H  n[        U[        5      (       a  M    g   g)zD
Are all items basic hashable types?
Or there are custom types too?
FT)r  typesGeneratorTyper%   )r  r  rd   s      rn   r  #DeepDiff._all_values_basic_hashable  s9     h 3 344DdK00  rp   c
           	         U R                  UXgXS9 GH;  u  u  pu  pU R                  5       [        L a    g U
nUnU[        L a*  UR	                  U[
        UUUS9nU R                  SUUS9  M[  U[        L a*  UR	                  [
        UUUUS9nU R                  SUUS9  M  X:w  a]  X:X  d  U R                  (       aG  UR	                  UUUUUS9nU R                  SUUS9  U R                  (       a  SUR                  S'   OM  [        U5      nU(       a	  UU;   a  GM  [        UU5      nUR	                  UUUUUS9nU R                  UUUS9  GM>     g )	Nr  r  iterable_item_removedra  iterable_item_addediterable_item_movedTmoved)r  r  r  r   r  r    r#  r   r&  r   r$   r   )r  r'  r"  r   r   r  r  r  r  r  rF  r  r   r  reference_param1reference_param2r!  r  r  r  s                       rn   r  8DeepDiff._diff_by_forming_pairs_and_comparing_one_by_one  s    #66'' 7 
NFQFQ
 !]2  **$22-E-=.>  3   ##$;\V`#a,,$22-E-=.>  3   ##$9<T^#_ FD,F,F#(#6#61I1A2B $7 $L ''(=|Xb'c11 59((1 !Q%7k#9$5k7$K! #00-E-=.> 1 
 

:'8Z
P
rp   c                    [         R                  " S UR                  UR                  SS9nUR	                  5       n/ nU GH$  u  ppnU	S:X  a  UR                  [        XXU5      5        M,  UR                  [        XXUUR                  X UR                  X S95        U	S:X  a  U R                  XUXEXXS9	  M{  U	S:X  aN  [        UR                  X 5       H1  u  pUR                  U[        UX-   X-   S9nU R                  S	UUS
9  M3     M  U	S:X  d  M  [        UR                  X 5       H2  u  nnUR                  [        UUX-   X-   S9nU R                  SUUS
9  M4     GM'     U$ )NF)isjunkabautojunkequal)
old_values
new_valuesreplace)r"  r   r   r  r  r  r  r  deleter  r  ra  insertr  )difflibSequenceMatcherr   r   get_opcodesr?  rA   r  r  r  r    r#  )r  r'  r"  r   r   r  seqopcodesr  tagr  r  r  r  indexr   r!  r  s                     rn   r  *DeepDiff._diff_ordered_iterable_by_difflib@  s    %%TUXXTYZ//# 
 LSGCKg~#**6K,    &&vK"XXmA"XXmA(  iDDk#1"/"/	 E   )%((=*M NHE#(#6#6"1I161F272G $7 $L ''(?Zd'e !O  )%((=*M NHE1#(#6#6"1I161F272G $7 $L ''(=|Xb'c !OC LST #"rp   c                 $   U R                   (       a>  UR                  R                  5       Ul        UR                  R                  5       Ul        [	        UR                  5      [	        UR                  5      :X  a  UR                  UR                  :X  a  gSnUR                  nUR                  n[        UR                  [        5      (       a+   UR                  R                  5       R                  S5      nO;[        UR                  [        5      (       a   UR                  R                  S5      n[        UR                  [        5      (       a+   UR                  R                  5       R                  S5      nO;[        UR                  [        5      (       a   UR                  R                  S5      n[        UR                  [        5      (       a  UR                  R                  n[        UR                  [        5      (       a  UR                  R                  nXE:X  a  gU(       a  SU;   d  [        U[        5      (       ah  SU;   ab  [        R                  " UR!                  5       UR!                  5       SS9n[#        U5      nU(       a  SR%                  U5      UR&                  S'   U R)                  S	XS
9  g! [         a    Sn GNf = f! [         a    Sn GNf = f! [         a    Sn GN@f = f! [         a    Sn GNSf = f)zCompare stringsNTasciiF
 )linetermdiffr  ra  )r   r   r  r   r8  r  r  r  r  UnicodeDecodeErrorr   r   r  r   r  unified_diff
splitlineslistr   r&  r#  )r  r'  r"  do_difft1_strt2_strr  s          rn   	_diff_strDeepDiff._diff_stry  sI   ""xx~~'EHxx~~'EH>T%((^+EHH0D ehh
++ ))+227; *-- 1 ehh
++ ))+227; *-- 1 ehh%%XX^^Fehh%%XX^^Fv~FC!8!8TV^++%%'):):)<rKDz/3yyE$$V,,eKI &   
 &    &   
 &   sH   )K K )K,  K? KKK)(K),K<;K<?LLc                      UR                   R                    U R                  XSUS9  g ! [         a    U R	                  XUS9   g f = f)NT)rS  r"  ra  )r   rb  rh  rd  r  )r  r'  r   r"  s       rn   _diff_tupleDeepDiff._diff_tuple  sO    	ZHH NN5TjNY	  	KzJ	Ks   * AAc                 d    X!;   a  X   R                   R                  U5        g [        U/US9X'   g )Nrb   )rc   r?  r"   )r  r   	item_hashrd   rF  s        rn   	_add_hashDeepDiff._add_hash  s0    %%,,Q/ +QCd CFrp   c           	         [        U SS5      nUb  UR                  (       d  g [        U5      nUR	                  U5      (       d  g[        U5      nUR                  5       n[        U5       VVs/ s H  u  pxUSR                  Xg5      4PM     n	nn[        U	U R                  US9n
U
c  gX4$ ! [         a     gf = fs  snnf )a  Optionally hash iterable items in worker processes.

Returns a list of per-index ``item_hash`` values (or ``None`` for
items the worker could not process), aligned to ``enumerate(obj)``
order. Returns ``None`` when the section ran serially (no
``_mp_config``, below threshold, generator without ``__len__``,
unsafe inputs).

Iteration order is captured here once via ``list(obj)`` so the
parent loop and the worker job list see the same items even for
order-sensitive iterables like sets.
r   NNN{}[{}])jobsr   config)r>  enabledr  	TypeErrorshould_parallelizer  r,  r  rk   r_   r   )r  r'  obj	mp_confignr  parent_baserF  rd   r#  r   s              rn   _maybe_compute_hashes_parallel'DeepDiff._maybe_compute_hashes_parallel  s     D,5	I$5$5	CA
 ++A..S	jjl %U+
+ 8??;23+ 	 
 ) $ 8 8

 >})  	 	
s   B- /B=-
B:9B:c                 8   [        X5      nU R                  X5      u  pEUb  [        U5      O
[        U5      n[        5       nU H  u  p SR	                  UR                  5       U5      n
Ub=  XH   nUc$  U R                  SUR                  5       -  5        MT  U R                  X{XS9  Mf  [        U	4U R                  U
SS.U R                  D6n X   nU[        L a$  U R                  SUR                  5       -  5        M  U R                  X{XS9  M     [        U4U R                  UR                  5       SS.U R                  D6  U$ ! [         a     GM  f = f! [         a+  nSUR                  5        SUR                   3Ul        e SnAf[         a    e f = f)	z0Create hashtable of {item_hash: (indexes, item)}Nr"  zFItem %s was not processed while hashing thus not counting this object.)r   r  rd   rF  T)r   parentr  zCan not produce a hash for z: )r>  r,  r  r=   rk   r,  r   r  rW   r   r   r#   r   r  reasonNotImplementedError)r  r'  r\  r(  parallel_hashesmaterialized_itemsiteratorlocal_hashesrF  rd   r/  r  r  errs                 rn   r  DeepDiff._create_hashtable  s   e /3.Q.QRW.]+4F4R9/0XabeXfw!IQ.a!q9". / 2I (  &F%*ZZ\&2 3 !NN,RVN\ %;;!#	
 ..	"
a )I !K/ &H',zz|&4 5 lVZ`_ "j 		
;;::<		

 &&	
 +    & :5::<.3::,W
& s7   
AEE*$EE
EE
F$&F

Fi  )maxsizec                 4   X:  a  X4OX4u  p#[        U[        5      (       a5  [        U5      R                  S5      n[        U5      R                  S5      nO7[        U[        5      (       a"  UR                  S5      nUR                  S5      nUS-   U-   S-   $ )Nr|  s   --s   dc)r  inthexencoder   )
added_hashremoved_hashr  r  s       rn   _get_distance_cache_key DeepDiff._get_distance_cache_key6  s     4>3Lj/S_Rl
dC   t9##G,Dt9##G,Dc"";;w'D;;w'De|d"U**rp   c           
      "   S =pgU R                   [           (       ac  U R                  X5      nU R                  R	                  U5      nU[
        L a  S nO+U R                   [        ==   S-  ss'   [        [        U5      nUc  [        UR                  UR                  U R                  U R                  [        UU R                  S9n	U	R                  5       nU(       a1  U R                   [           (       a  U R                  R!                  XvS9  U$ )Nr   )r   r   r   r   r   r  )re   r   r?  r   r  r!   r   r   r   r   rd   r   r   r6   r   r   r   )
r  r=  r>  added_hash_objremoved_hash_objr   	_distance	cache_keycached_distancer  s
             rn   "_get_rough_distance_of_hashed_objs+DeepDiff._get_rough_distance_of_hashed_objsD  s     !%$	;;-.44ZNI"2266yAO)+ 	45:5 8	  %%~':': ,,#'#:#:-&*&@&@D 002IT[[)?@$$(((Drp   c                    [        U SS5      nUb  UR                  (       d  g/ n	U R                  [           n
U H  nU H  nXK   nX<   n[	        UR
                  5      U;   a  M&  U(       a$  UR                  SR                  X5      5       b  MQ  U
(       a5  U R                  X5      nU R                  R                  U5      [        La  M  U	R                  XUR
                  UR
                  45        M     M     UR                  [        U	5      5      (       d  g[        U	U R                  UU R                   US9nUc  gUu  nnU R#                  U5        U$ )a  Optionally run distance computation for non-cached pairs in workers.

Returns a dict ``{(added_hash, removed_hash): distance}`` for pairs
whose distance was computed in parallel, or ``None`` if the section
ran serially (below threshold, unsafe inputs, no _mp_config, etc.).

The job list is built in the exact order of the serial nested loop
so the parent merge order is identical regardless of how many workers
run or which one finishes first.
r   N{}--{})r#  
parametersoriginal_typer   r$  )r>  r%  re   r   r   rd   r  rk   r?  r   r!   r?  r'  r  r^   r   r   _merge_worker_stats)r  r  r  r  r  r   r   pre_calced_distancesr)  r#  cache_enabledr=  r>  rC  rD  rF  r  	distancesworker_statss                      rn   &_maybe_compute_pair_distances_parallel/DeepDiff._maybe_compute_pair_distances_parallela  sW    D,5	I$5$5
 $:;&J .!-!9#/#= &++,;',@,D,D 
A-CJN-O  $ < <Z VI++//	:)K !Z~7J7JL\LaLabc !/ '$ ++CI66+''("&"<"<
 >"(	<  .rp   c           	      n   U(       d  gU R                   [        ==   [        UR                  SS5      =(       d    S5      -  ss'   U R                   [        ==   [        UR                  SS5      =(       d    S5      -  ss'   U R                   [
        ==   [        UR                  SS5      =(       d    S5      -  ss'   U R                   [        ==   S-  ss'   UR                  [        5      (       a  SU R                   [        '   UR                  [        5      (       a  SU R                   [        '   gg)aO  Aggregate one parallel-batch's worker ``_stats`` delta into self._stats.

Counters (DIFF / PASSES / DISTANCE CACHE HIT) sum into the matching
``WORKER_*`` keys; limit flags OR-merge into the parent's existing
MAX_*_LIMIT_REACHED flags so any worker hitting a guard surfaces the
same warning state on the public ``get_stats()`` output.
Nrr   r   rs   rq   r   T)	re   r   r:  r  r   r   r   r   r   )r  rR  s     rn   rN  DeepDiff._merge_worker_stats  s     %&#l.>.>|Q.O.TST*UU&'(C0@0@QR0S0XWX,YY(347;@q9B 	B4&'1,'23326DKK./23326DKK./ 4rp   c           	         SnU R                   [           (       aP  [        X/SS9nU R                  R	                  U5      nU[
        L a  SnO[        [        U5      R                  5       $ S n	[        U	5      n
[        5       nSnU(       aC  U(       a<  [        (       a1  [        U5      S:  a"  [        U5      S:  a  U R                  XX4U5      nU(       aI  U(       aB  U R                  (       a1  [        U5      S:  a"  [        U5      S:  a  U R                  XX4U5      nU R!                  XX4XVU5      nU H  nU H  nXN   nX?   n[#        UR$                  5      U;   a  M&  SnU(       a   UR	                  SR'                  X5      5      nUc  Ub  UR	                  X45      nUc  U R)                  XUUU5      n[        [*        U5      nUU R,                  :  a  M  X   nUU   R/                  U5        M     M     [1        5       n[        [2        5      nU
R5                  5        H#  u  nnU H  nUU   R/                  U5        M     M%     [7        UR9                  5       5       H  nUU   nU(       d  M  UR;                  5       nUU;  aU  U
U   U   nU(       aF  UR;                  5       nUU;  a'  UR/                  U5        UR/                  U5        UUU'   U(       a  MF  U(       a  Mt  M     UR5                  5        VVs0 s H	  u  nnUU_M     nnnUR=                  U5        U(       a1  U R                   [           (       a  U R                  R1                  X{S9  UR                  5       $ s  snnf )	a  
Get the closest pairs between items that are removed and items that are added.

returns a dictionary of hashes that are closest to each other.
The dictionary is going to be symmetrical so any key will be a value too and otherwise.

Note that due to the current reporting structure in DeepDiff, we don't compare an item that
was added to an item that is in both t1 and t2.

For example

[{1, 2}, {4, 5, 6}]
[{1, 2}, {1, 2, 3}]

is only compared between {4, 5, 6} and {1, 2, 3} even though technically {1, 2, 3} is
just one item different than {1, 2}

Perhaps in future we can have a report key that is item duplicated and modified instead of just added.
Npairs_cache)r  r/  c                       [        [        5      $ r   )r   rB   r   rp   rn   defaultdict_orderedsetODeepDiff._get_most_in_common_pairs_in_iterables.<locals>.defaultdict_orderedset  s    z**rp   r   r   rK  rB  )re   r   rX   r   r  r!   r   dictr   r   r=   r;   r  #_precalculate_numpy_arrays_distancer   -_precalculate_distance_by_custom_compare_funcrS  r   rd   rk   rH  r   r   r   r   rB   r  sortedr   popr   )r  r  r  r  r  r   r   rF  cached_pairsrZ  most_in_common_pairspairsrO  parallel_distancesr=  r>  rC  rD  rE  pairs_of_itemused_to_hashesdistances_to_from_hashes	from_hashdistances_to_to_hashesdistfrom_hashes	to_hashesto_hashrf  rg  inverse_pairss                                  rn   &_get_most_in_common_pairs_in_iterables/DeepDiff._get_most_in_common_pairs_in_iterables  sC   * 	;;-.,L3QZghI//33I>Ly(#D,/4466	+*+AB#Nrrc,6G!6KPSTbPcfgPg $(#K#Kl.$Z  N..%)c..AA.E#'#U#Ul.$Z  "HH,)=? 'J .!-!9#/#=  &++,; 	' 4 8 89b cI$);)G 2 6 6
7Q RI$ $ G G".BRTb!dI 	2	  > >> 4 @i(,,\:/ !/ '2 #.z#: 1E1K1K1M-I-.(.229= / 2N
 388:;D248K+'OO-	N2 4Y ? EI#"+--/".8*..y9*..w7 07E), $)	 + < +0++-8-$!QA-8]#%;<  $$Y$<zz|	 9s   ?M+c                     U R                   (       a  gU R                  (       d  U R                  (       a  gU R                  (       d  U R                  (       a  gU R
                  (       a  gg)aN  Return True if paired-subtree diffs in this run can be sent to workers.

Excluded features are ones whose semantics depend on the *parent's*
absolute path or on parent-process state, neither of which is visible
in a worker:

- ``custom_operators`` (per docs/multi_processing.md) can call
  ``custom_report_result`` and mutate the parent diff instance.
- ``exclude_obj_callback`` / ``include_obj_callback`` (and their
  ``_strict`` variants) receive the level path; in a worker that path
  is rooted at the subtree, not the original tree, so they would fire
  on the wrong paths.
- ``ignore_order_func`` is also called with the level and would see
  worker-local paths.

Path-only filters (``exclude_paths`` / ``include_paths`` /
``exclude_regex_paths``) are handled by re-applying ``_skip_this``
after rebasing rather than disabling parallelism.
FT)r   r   r   r   r   r   r  s    rn   _subtree_parallel_safeDeepDiff._subtree_parallel_safe!  sG    (   $$(H(H$$(H(H!!rp   c                    UnUR                   b  UR                   nUR                   b  M  UR                  5       nX1L aI  UR                  Ul        UR                  Ul        UnUb   [	        5       Ul        UR                   nUb  M   U$ UR                  nXdl        UR                  bX  [        R                  " UR                  R                  UR                  UR                  UR                  R                  S9Ul        UR                  bX  [        R                  " UR                  R                  UR                  UR                  UR                  R                  S9Ul        UnUb   [	        5       Ul        UR                   nUb  M   U$ )u*  Splice a worker-built leaf chain onto the parent's ``change_level``.

The worker constructed ``leaf`` inside a fresh ``DeepDiff`` whose root
DiffLevel holds the paired items themselves; that root is irrelevant
once we're back in the parent. We replace it with a *fresh copy* of
``change_level`` (so each leaf gets its own up-chain — DiffLevel.up
is shared by reference, and reusing one chain across leaves would
scramble paths).

Returns the rebased leaf. Path caches along the chain are cleared so
``leaf.path()`` recomputes against the new up-chain.
)klassr/  childparam)rw  r   r  r&  r=   _pathdownt1_child_relrV   creater  r   rx  t2_child_relr   )r  leafr!  worker_rootnew_clcurfirst_under_roots          rn   _rebase_subtree_leafDeepDiff._rebase_subtree_leaf?  s_    nn(%..K nn( ""$
 "&!1!1F $FC/!G	ff / M&++ '##/"3":":!..88yy(8(;(;!..44#F
 ##/"3":":!..88yy(8(;(;!..44#F oCI&&C o rp   c           	      l   U(       d  g[        U SS5      nSnUbx  UR                  (       ag  UR                  [        U5      5      (       aH  U VVVs/ s H	  u  pgpXx4PM     n	nnn[	        U	U R
                  UUS9n
U
b  U
u  p[U R                  U5        Uc  U H  u  ppU R                  XUS9  M     gUc  U R                  OUn[        X5       H[  u  u  pnnnU HK  u  nnU R                  UU5      nU R                  U5      (       a  M0  UUl        UU   R                  U5        MM     M]     gs  snnnf )av  Run deferred paired-subtree diffs (parallel when allowed, else serial).

``pending_jobs`` is the list of ``(change_level, t1_item, t2_item,
parents_ids_added)`` tuples in the exact order the inline serial code
would have visited them. Parallel results are merged in that same
order regardless of worker completion order, so output is identical
to the equivalent serial run.
Nr   )r#  rL  rM  r$  ra  )r>  r%  r'  r  r`   r   rN  r   r   zipr  r  r  r   )r  pending_jobsr   r"  r)  parallel_results_t1_itemt2_itemjobs_payloadoutcomerR  r!  _t1_item_t2_itemr  target_tree_parents_ids_addedentriesr  r~  rebased_leafs                         rn   _dispatch_subtree_jobsDeepDiff._dispatch_subtree_jobsx  sN    D,5	!i&7&700\1BCCO[\|3KAW.|L\4!++, 	G "18. ((6# HTC

<z
R HT#-#5dii:ORP0KB\X/AG%,!T#88|L ??<00+6(K(,,\: &-P0) ]s   D/c           
        ^^ ^!^"^# U R                  US5      nU R                  US5      n[        UR                  5       5      n[        UR                  5       5      nX-
  mXx-
  m [        T5      [        T 5      -   [        U5      [        U5      -   S-   -  U R                  :  a  Sn	OSn	U R
                  (       a  Um"Um#OZUR                  5        V
Vs0 s H  u  pU
T ;   d  M  X_M     snn
m"UR                  5        V
Vs0 s H  u  pU
T;   d  M  X_M     snn
m#U R                  [           U R                  :  a8  U	(       a1  U R                  [        ==   S-  ss'   U R                  TT T"T#X#5      m!OyU	(       ah  U R                  [           (       dE  SU R                  [        '   [        R                  [        R                  U R                  5      5        [!        5       m!O
[!        5       m!SUU U!U"U#4S jjn[#        U SS5      nUSL=(       a#    UR$                  =(       a    U R'                  5       nU(       a  / OSnU R
                  (       GaC  T GHD  nU R)                  5       [*        L a    gU" U5      n[-        UR.                  5      nUR.                  [0        L a  T#U   R2                  OUR2                  n[        T#U   R2                  5      S:X  a  T#U   R2                  S	   nOSnU H  nUR5                  UR.                  T#U   R.                  [6        UUS
9nUR.                  [0        L a  U R9                  SUUS9  MW  [;        UU5      nUc  U R=                  UUUS9  My  UR?                  UUR.                  T#U   R.                  U45        M     GMG     T  GH/  nU R)                  5       [*        L a    gU" USS9n[-        UR.                  5      nUR.                  [0        L d  [        UR2                  5      S:  a  SnOUR2                  S	   nT"U   R2                   H  nUR5                  T"U   R.                  UR.                  [6        UUS
9nUR.                  [0        L a  U R9                  SUUS9  MW  [;        UU5      nUc  U R=                  UUUS9  My  UR?                  UT"U   R.                  UR.                  U45        M     GM2     URA                  U5      nU H  nT"U   R2                  nT#U   R2                  n[        U5      n[        U5      nUU:w  d  M?  UR5                  T"U   R.                  T#U   R.                  [6        T"U   R2                  S	   S9n[C        UUUUS9URD                  S'   U R9                  SUUS9  M     GOQT GH"  nU R)                  5       [*        L a    gU" U5      n[-        UR.                  5      nUR.                  [0        L a  T#U   R2                  S	   OUR2                  S	   nT#U   R2                  S	   nUR5                  UR.                  T#U   R.                  [6        UUS
9nUR.                  [0        L a  U R9                  SUUS9  M  [;        UU5      nUc  U R=                  UUUS9  M  UR?                  UUR.                  T#U   R.                  U45        GM%     T  GH!  nU R)                  5       [*        L a    gU" USS9n[-        UR.                  5      nT"U   R2                  S	   nUR.                  [0        L a  T"U   R2                  S	   OUR2                  S	   nUR5                  T"U   R.                  UR.                  [6        UUS
9nUR.                  [0        L a  U R9                  SUUS9  M  [;        UU5      nUc  U R=                  UUUS9  M  UR?                  UT"U   R.                  UR.                  U45        GM$     U(       a  U RG                  XU5        ggs  snn
f s  snn
f )zLDiff of hashable or unhashable iterables. Only used when ignoring the order.r   r   r   FTc                    > U(       a  TnTnOT	nTnTR                  U [        5      nU[        L a  [        nU$ TU	 UR                  U5        X$   nU$ )z
Gets the other paired indexed hash item to the hash_value in the pairs dictionary
in_t1: are we looking for the other pair in t1 or t2?
)r`  r    notpresent_indexedremove)

hash_valuein_t1	hashtablethe_other_hashesotherr  r  rc  r  r  s
        rn   get_other_pair=DeepDiff._diff_iterable_with_deephash.<locals>.get_other_pair  sf    
 (	#1 (	#/ IIj*5E
"* L %L ''.!(Lrp   r   Nr   r  r  ra  )r  r  )r  r  )
old_repeat
new_repeatold_indexesnew_indexes
repetitionrepetition_change)T)$r  rB   r   r  r   r   r  re   rl   r   ro  r   r   r   MAX_PASSES_REACHED_MSGrk   r=   r>  r%  rs  r  r  r   rd   r    rc   r  rP   r#  r$   r   r?  intersectionrH   r&  r  )$r  r'  r   r   r"  full_t1_hashtablefull_t2_hashtabler  r  	get_pairsrf  rg  r  r)  use_mppending_subtree_jobsr  r  r  rc   index2rF  r!  r  items_intersect
t1_indexes
t2_indexest1_indexes_lent2_indexes_lenrepetition_change_levelr  r  r  rc  r  r  s$                                  @@@@@rn   r  %DeepDiff._diff_iterable_with_deephash  s    !225$? 225$?05578	05578	 ,". N 33<M8NQTUfQg8gjk8klos  pR  pR  RII !!,L,L->-D-D-F^-FTQ!~J]DAD-F^L->-D-D-F\-FTQ!|J[DAD-F\L;;|$t69KK%*%??nlL+gE;;566:235<<T__MNGEGE	 	8 D,5	T! .i&7&7 .++- 	 &,r!!!*
##%6&z2UZZ.>CjjJ>V,z2::\a\i\i |J/778A=)*5==a@F!F A#(#6#6

$Z0551R1228 $7 $L zzZ/++,A<\f+g,=k7,S)/7 JJ|5FS]J^077!-uzz<
;S;X;XZk ln ! +< -
##%6&z?UZZ. ::+s5==/AA/E!F"]]1-F%j199A#(#6#6$Z055

1R1228 $7 $L zzZ/++,C\^h+i
 ->k7,S)/7 JJ|5FS]J^077!-|J/G/L/LejjZk ln% : -B (44Y?O-
)*5==
)*5==
!$Z!$Z!^3.3.A.A$Z055$Z0551R1=j1I 2$	 /B /%+ HQ#1#1$.$.	H0+66|D
 ''(;(?J ( X% ., +
##%6&z2UZZ.?DzzZ?WZ088;]b]j]jkl]m%j199!<$22JJ ,11-N-2.4  3   ::+''(=|Xb'c(9+w(O%+3

<1Bz
Z,33)5::|J7O7T7TVghj+ +0 -
##%6&z?UZZ.$Z088;@E

j@Xj199!<^c^k^klm^n$22 ,11JJ-N-2.4  3   ::+''(?Zd'e ):+w(O%+3

<1Bz
Z,33)<
+C+H+H%**Vghj/ -4  ''(<jY  w _\s   _>"_>?``c                 Z    UR                   UR                  :w  a  U R                  SXS9  g g )Nr  ra  )r   r   r#  r  r'  r"  s      rn   _diff_booleansDeepDiff._diff_booleans{  s+    88uxx 0%O  rp   c                    U(       ag  U R                   (       a  SOUR                  R                  R                  nU R                   (       a  SOUR                  R                  R                  nOS=pEU R
                  (       a@  [        UR                  UR                  U R                  S9(       d  U R                  SXS9  ggU R                  b@  [        UR                  UR                  U R                  S9(       d  U R                  SXS9  ggU R                  c,  UR                  UR                  :w  a  U R                  SXS9  ggU R                  UR                  U R                  U R                  S9nU R                  UR                  U R                  U R                  S9n[        R                  " XF5      n[        R                  " XW5      nXg:w  a  U R                  SXS9  gg)	zDiff Numbersr~  r  )	thresholdr  ra  N)abs_tolr}  )r   r   r  r   r   r   rG   r   r#  r   is_closer}   r,   r~   r.   rk   )r  r'  r"  report_type_changet1_typet2_typet1_st2_ss           rn   _diff_numbersDeepDiff._diff_numbers  s   "&"B"BhHZHZHcHcG"&"B"BhHZHZHcHcG ""G)%((EHHHkHkl##$4e#S m*EHHehh8I8IJ##$4e#S K$$,xx588###$4e#S $ ((<@<S<S@D@[@[ ) ]D ((<@<S<S@D@[@[ ) ]D "((7D!((7D|##$4e#S rp   c                 ~    [        UR                  5      [        UR                  5      :w  a  U R                  SXS9  gg)zDiff IP rangesr  ra  N)r   r   r   r#  r  s      rn   _diff_iprangesDeepDiff._diff_ipranges  s3    uxx=CM) 0%O *rp   c                    [        U R                  UR                  U R                  S9Ul        [        U R                  UR                  U R                  S9Ul        UR                  UR                  :w  a  U R                  SXS9  ggzDiff DateTimes)r   r  ra  N)r-   r   r   r   r   r#  r  s      rn   _diff_datetimeDeepDiff._diff_datetime  sm    %d&<&<ehhY]YnYno%d&<&<ehhY]YnYno88uxx 0%O  rp   c                 4   U R                   (       a\  [        U R                   UR                  U R                  S9Ul        [        U R                   UR                  U R                  S9Ul        UR                  UR                  :w  a  U R                  SXS9  ggr  )r   r-   r   r   r   r#  r  s      rn   
_diff_timeDeepDiff._diff_time  sv    !!)$*@*@%((]a]r]rsEH)$*@*@%((]a]r]rsEH88uxx 0%O  rp   c                     UR                   R                  UR                  R                  :w  a  U R                  SXS9  gg)z
Diff UUIDsr  ra  N)r   r:  r   r#  r  s      rn   _diff_uuidsDeepDiff._diff_uuids  s3    88<<588<<' 0%O (rp   c           	      v   UR                  5       U R                  ;  a:  [        UR                  5      R                  U R                  UR                  5       '   [
        c  [        [        5      eU R                  (       a  U R                  U5      (       a  U R                  (       d  U R                  c;  [
        R                  " UR                  UR                  U R                  S9(       a  gO? [
        R                  R                  UR                  UR                  U R                  S9  gUR                  R$                  nUR                  R&                  UR                  R&                  :w  aO  UR                  R)                  5       Ul        UR                  R)                  5       Ul        U R+                  XXCS9  gUR                  R&                  n[-        U5      nUS:X  a  U R+                  XXCS9  gU R                  (       a  U R                  U5      (       d  U R                  (       aO  UR                  R)                  5       Ul        UR                  R)                  5       Ul        U R/                  XXCS9  g[1        [3        UR                  U5      [3        UR                  U5      5       H1  u  u  pxu  pUR5                  UU
[6        UU	S9nU R9                  XXCS9  M3     g! [          a8    [
        R                  " UR                  UR                  U R                  S9   GN["         a     GN	f = f)zDiff numpy arraysN)	equal_nan)decimalr  r   r  )r,  r   r'   r   r   r;   ImportErrorCANT_FIND_NUMPY_MSGr   r   r}   array_equalr   r   testingassert_almost_equalr&  AssertionErrordtypeshapetolistr  r  r  r  r2   r  rS   r  )r  r'  r   r"  r   r  
dimensionst1_patht1_rowt2_patht2_row	new_levels               rn   _diff_numpy_arrayDeepDiff._diff_numpy_array  sp   ::<t000.6uxx.@.I.IDejjl+: 122""4+A+A%+H+HQUQbQb&&.>>%((EHH@Z@Z[ \JJ22588UXXtOfOf2g  88>>UXX^^+ xx(EHxx(EH>i HHNNEUJQ##E~#m((T-C-CE-J-JtO`O` !88??, 88??,11%Uc1{<?.uxx?.uxx?=A8%W'8 !& 3 31G1829 !4 !I 00Xf0~=A9 ! ]NN588UXXA[A[\% s   0=K* *>L8+	L87L8c                 2    SUl         U R                  SXS9  g)z
Diff typestype_changesra  N)r  r#  r  s      rn   _diff_typesDeepDiff._diff_types  s    *NEIrp   c                    U R                   b  U R                  [           U R                   :  ac  U R                  [           (       dE  SU R                  [        '   [        R                  [        R                  U R                   5      5        [        $ U R                  [        ==   S-  ss'   U R                  (       a#  U R                  (       a  U R                  5         g g g )NTr   )r   re   rm   r   r   r   MAX_DIFFS_REACHED_MSGrk   r  r   r   _auto_tune_cacherr  s    rn   r  DeepDiff._count_diff   s    NN&4;;z+BT^^+S;;566:234;;DNNKL  J1$??t<<!!#  =?rp   c                    U R                   [           U R                  -  S:H  nU R                  (       a  U R                   [           (       a  U(       a  U R	                  5         OjU R                   [           U R
                  [           -  S:X  a?  U R                  S5        U R
                  [        ==   S-  ss'   SU R                   [        '   U(       a3  [        [        4 H"  nU R                   USS     U R                   U'   M$     g g )Nr   z*Re-enabling the distance and level caches.r   T	   )
re   rm   r   r   _auto_off_cacher   rt   rf   r   r   )r  take_sampler  s      rn   r  DeepDiff._auto_tune_cache
  s    {{:.1N1NNRSS(({{12((*Z(4+B+BC]+^^bcc$$%QR''(BCrIC6:23+-NO#';;s12w#7C  P rp   c                 x   U R                   [           (       a  U R                   [           U R                   SR                  [        5         -
  U R                   [           U R                   [
           -
  -  nXR                  :  a4  SU R                   [        '   U R                  SR                  S5      5        ggg)z*
Auto adjust the cache based on the usage
zPREVIOUS {}Fz*Due to minimal cache hits, {} is disabled.zdistance cacheN)re   r   r   rk   rm   r   CACHE_AUTO_ADJUST_THRESHOLDrf   )r  angles     rn   r  DeepDiff._auto_off_cache  s     ;;-.[[!9:T[[I]I]^vIw=xx  ~B  ~I  ~I  JT  ~U  X\  Xc  Xc  dw  Xx  ~x  yE7776;23$$%Q%X%XYi%jk 8 /rp   c                     U R                    H3  nUR                  U5      (       d  M  UR                  XS9nU(       d  M3    g   g)a  
For each level we check all custom operators.
If any one of them was a match for the level, we run the diff of the operator.
If the operator returned True, the operator must have decided these objects should not
be compared anymore. It might have already reported their results.
In that case the report will appear in the final results of this diff.
Otherwise basically the 2 objects in the level are being omitted from the results.
)r'  diff_instanceTF)r   rm  give_up_diffing)r  r'  operatorprevent_defaults       rn   _use_custom_operatorDeepDiff._use_custom_operator$  sC     --H~~e$$"*":":":"["?	 . rp   c                     U R                  5       [        L a  gU R                  U5      (       a  gUR                  UR                  L a  gU R                  U5      (       a  gSn[        UR                  5      [        UR                  5      :w  Ga7  U R                   HK  nU R                  UR                  U5      (       d  M&  U R                  UR                  U5      (       d  MI  Sn  O   U R                  (       a<  [        UR                  [        5      (       a  UR                  R                  Ul        SnU R                  (       a<  [        UR                  [        5      (       a  UR                  R                  Ul        SnU(       a  U R                  XS9  gUR                  b  UR                  c  U R                  SXS9  gU R                  (       a[  [        UR                  [         ["        45      (       a6  [%        UR                  5      [%        UR                  5      s=:X  a  S:X  a   g  [        UR                  [&        5      (       a  U R)                  XS9  g[        UR                  [*        5      (       a  U R,                  (       a  [        UR                  [.        5      (       a`   [0        R2                  " [%        UR                  5      5      nUR4                  UR                  R4                  :w  a  U R                  SXS9  ggU R;                  XS9  g[        UR                  [<        R<                  5      (       a  U R?                  XS9  g[        UR                  [@        5      (       a  U RC                  XS9  g[        UR                  [<        RD                  [<        RF                  [<        RH                  45      (       a  U RK                  XS9  g[        UR                  [.        5      (       a  U R,                  (       av  [        UR                  [$        5      (       aW   [0        R2                  " UR                  5      nUR                  R4                  UR4                  :w  a  U R                  SXS9  ggU RM                  XS9  g[        UR                  [N        5      (       a  U RQ                  XUS9  g[        UR                  [R        5      (       a  U RU                  XUS9  g[        UR                  [V        5      (       a  U RY                  XUS9  g[        UR                  [Z        [\        [^        45      (       a  U Ra                  XS9  g[        UR                  [b        5      (       a  U Re                  XUS9  g[        UR                  [f        5      (       a  U Ri                  XUSS9  g[        UR                  [j        5      (       a  U Rm                  XX4S	9  g[        UR                  [        5      (       a  U Ro                  XUS9  gU Ri                  X5        g! [6        [8        4 a    U R                  SXS9   gf = f! [6        [8        4 a    U R                  SXS9   gf = f)
a  
The main diff method

**parameters**

level: the tree level or tree node
parents_ids: the ids of all the parent objects in the tree from the current node.
_original_type: If the objects had an original type that was different than what currently exists in the level.t1 and t2
NTFra  r  nan)r"  r  )r"  rT  r  )8r  r  r  r   r   r  r'   r   r   r   r  r   r  r  r#  r   r   r1   r   r/   r  r   r   r   uuidUUIDr:  r   rd  r  datetimer  rC   r  date	timedeltatimer  r  r   r  r   rP  r   r  r   r   rB   r  r0   r  r@   rh  r   r  rQ  )	r  r'  r   r   r"  r  
type_groupt1_uuidt2_uuids	            rn   r   DeepDiff._diff6  s    .$$U++88uxx??5!!!EHH%((!33"88
''*==$BVBVW\W_W_akBlBl).& 9 ""z%((D'A'A 88>>%*"""z%((D'A'A 88>>%*"!   >xx588#3##$4e#S%%*UXX{?S*T*TY\]b]e]eYfjmnsnvnvjw  ZA  |A  ZA ZA ehh))='**%%*UXXu*E*EX"iiEHH6G{{ehhll2++,<e+[ 3 u<("3"344=(++=8==(2D2Dhmm"TUUOOEO9%((%%*UXXs*C*CX"ii1Gxx||w{{2++,<e+[ 3    >'**uPbc'**OOE:OF%((UJG3	:">??NN5N8*--""5*"M"344NN5*Y]N^(++>i$''OOE:OF NN5.m #N3 X''(8%'WX. #N3 X''(8%'WXs&   2AX4 1AY 4 YY Y=<Y=c                    U R                   nU R                  (       d  UR                  5         U[        :X  a   U$ U[        :X  a7  Ub  UOU R
                  n[        U R                   US9nUR                  5         U$ U[        :X  a  U R                  SS9nU$ U[        :X  a!  [        U R                  U R                   SS9nU$ U[        :X  a!  [        U R                  U R                   SS9nU$ [        [        R!                  U5      5      e)z#
Get the results based on the view
)tree_resultsr   F)report_repetition_required)r   tree_resultcompactT)r   r   *mutual_add_removes_to_become_value_changesr5   r4   r   rJ   r   r6   _to_delta_dictr7   r\   r   r8   r   INVALID_VIEW_MSGrk   )r  r   r   r  effective_verbose_levels        rn   r  DeepDiff._get_view_results  s    %%==?9  Y7D7PmVZVhVh#TYYF]^F$$&  Z((E(JF  \! DGGERF
 	 )) DGGDQF  -44T:;;rp   c                      [        U5      (       a  U" U 5      $ U R                  U5      $ ! [         a'    [        R	                  SR                  X!U 5      5        e f = f)aJ  
Get the key value to group a row by, using the specified group_by parameter.

Example
    >>> row = {'first': 'John', 'middle': 'Joe', 'last': 'Smith'}
    >>> DeepDiff._get_key_for_group_by(row, 'first', 't1')
    'John'
    >>> nested_row = {'id': 123, 'demographics': {'names': {'first': 'John', 'middle': 'Joe', 'last': 'Smith'}}}
    >>> group_by = lambda x: x['demographics']['names']['first']
    >>> DeepDiff._get_key_for_group_by(nested_row, group_by, 't1')
    'John'

Args:
    row (dict): The dictionary (row) to extract the group by key from.
    group_by (str or callable): The key name or function to call to get to the key value to group by.
    item_name (str): The name of the item, used for error messages.

Returns:
    str: The key value to group by.

Raises:
    KeyError: If the specified key is not found in the row.
z2Unable to group {} by {}. The key is missing in {})r   r`  r   r   r   rk   )rowr   r   s      rn   _get_key_for_group_byDeepDiff._get_key_for_group_by  sY    2	!!}$778$$ 	LLMTTU^jmno	s   + + 1Ac                 J   Sn[        U[        [        45      (       a  US   n[        U5      S:  a  US   nOUn[        U[        5      (       Ga$  [        U[
        5      (       Gd  0 n[        U5      nU GHa  n[        U[
        5      (       Ga  U R                  XU5      n	[        U S5      (       a  U R                  R                  U	5        U(       a  U R                  XU5      n
[        U S5      (       a  U R                  R                  U
5        X;  a  0 Xi'   U R                  (       a0  XU	   ;  a  / Xi   U
'   Xi   U
   nX;  a  UR                  U5        M  M  XU	   U
'   M  U R                  (       a*  X;  a  / Xi'   XU	   ;  a  Xi   R                  U5        GM(  GM+  XU	'   GM2  SR                  X5U5      n[        R                  U5        [!        U5      e   U R                  (       a  U(       aM  UR#                  5        H7  u  pUR#                  5        H  u  pUR%                  U R                  S9  M      M9     U$ UR#                  5        H  u  pUR%                  U R                  S9  M      U$ SR                  X25      n[        R                  U5        [!        U5      e)z
Convert a list of dictionaries into a dictionary of dictionaries
where the key is the value of the group_by key in each dictionary.
Nr   r   r   z?Unable to group {} by {} since the item {} is not a dictionary.)r  zUnable to group {} by {})r  r  r   r  r   r   r   r  rA  r   r   r   r?  rk   r   r   r   r  sort)r  rd   r   r   group_by_level2group_by_level1r  	item_copyr  r  r  result_key1_key2msgrow1r  s                  rn   r    DeepDiff._group_iterable_to_dict  sW   
 hu..&qkO8}q "*1+&OdH%%jw.G.GF I c7++55cIVDt_55**..t4&#99#PYZ"499 ..2248-+-FL11#$<757T 2/5|D/A,": 0 7 7 <  ; 254L.11#1/1",6 & 3 3C 8  7 ,/4L[bbcl  @C  DCLL%$S/)A !B %%"&,lln
)-IDHH)?)?H@ *6 '5 M %+LLNT%;%;< %3M(//	DSorp   c                     U R                   $ )z2
Get some stats on internals of the DeepDiff run.
)re   rr  s    rn   r  DeepDiff.get_stats	  s     {{rp   c                     [        5       n[         HT  nU R                  U5      nU(       d  M  [        U[         5      (       a  X-  nM8  U[        UR	                  5       5      -  nMV     U$ )a  
Get the list of paths that were affected.
Whether a value was changed or they were added or removed.

Example
    >>> from pprint import pprint
    >>> t1 = {1: 1, 2: 2, 3: [3], 4: 4}
    >>> t2 = {1: 1, 2: 4, 3: [3, 4], 5: 5, 6: 6}
    >>> ddiff = DeepDiff(t1, t2)
    >>> pprint(ddiff, indent=4)
    {   'dictionary_item_added': ['root[5]', 'root[6]'],
        'dictionary_item_removed': ['root[4]'],
        'iterable_item_added': {'root[3][1]': 4},
        'values_changed': {'root[2]': {'new_value': 4, 'old_value': 2}}}
    >>> sorted(ddiff.affected_paths)
    ['root[2]', 'root[3][1]', 'root[4]', 'root[5]', 'root[6]']
    >>> sorted(ddiff.affected_root_keys)
    [2, 3, 4, 5, 6]

)rB   rO   r  r  r   )r  r  r  r  s       rn   affected_pathsDeepDiff.affected_paths!	  sW    , CHHSMEueZ00OFj66F  rp   c                 6   [        5       n[         H  nU R                  R                  U5      nU(       d  M'  [	        U[         5      (       a  UnOUR                  5       nU H/  nUR                  5       nU[        Ld  M  UR                  U5        M1     M     U$ )a  
Get the list of root keys that were affected.
Whether a value was changed or they were added or removed.

Example
    >>> from pprint import pprint
    >>> t1 = {1: 1, 2: 2, 3: [3], 4: 4}
    >>> t2 = {1: 1, 2: 4, 3: [3, 4], 5: 5, 6: 6}
    >>> ddiff = DeepDiff(t1, t2)
    >>> pprint(ddiff, indent=4)
    {   'dictionary_item_added': ['root[5]', 'root[6]'],
        'dictionary_item_removed': ['root[4]'],
        'iterable_item_added': {'root[3][1]': 4},
        'values_changed': {'root[2]': {'new_value': 4, 'old_value': 2}}}
    >>> sorted(ddiff.affected_paths)
    ['root[2]', 'root[3][1]', 'root[4]', 'root[5]', 'root[6]']
    >>> sorted(ddiff.affected_root_keys)
    [2, 3, 4, 5, 6]
)	rB   rO   r   r  r  r   get_root_keyr    r   )r  r  r  r  values_listrd   root_keys          rn   affected_root_keysDeepDiff.affected_root_keysA	  s|    * CIIMM#&EueZ00"'K"'**,K'D#002Hz1

8, (  rp   c                    > [        U S5      (       a/  U R                  [        [        1;   a  [	        U R
                  5      $ [        TU ]  5       $ )Nr  )rA  r   r7   r8   r   r  r   __str__)r  r  s    rn   r-  DeepDiff.__str__d	  s?    4))diiLJ^;_._t))**w  rp   )Cr  r   r   r   r   r   r   re   r   r   r   r   r   r   r   r   rx   r   r   rw   r{   rv   r   r   r   r   r|   r   r   r   r   r   r   r   r   r   r   r   r   rz   r   r   ry   r   r   r   r   r   r   r   r   r~   r,   rf   r   r}   r   r   r   r   r   r   r   r   r   r   r   r   )NNNNr!  )NT)]r   r   r   r   doc__doc__r  !CUTOFF_DISTANCE_FOR_PAIRS_DEFAULT%CUTOFF_INTERSECTION_FOR_PAIRS_DEFAULTr  timezoneutcr   r  r4   r
   r   r:  r   r   r	   r   r   r   r   r   r8  r   r   r   r   r   r   r#  r)  r  staticmethodrG  r   rQ  rh  r  ry  r  rP  r  r  r  r  r  r  r   r  r  r  r  r  r  r,  r  r   r?  rH  rS  rN  ro  rs  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r   r  propertyr$  r*  r-  r   __classcell__)r  s   @rn   r   r      sd	   G"&
 04()!"/08<2S6[IQIZIZI^I^04:>AEVZdh59).GK?C,026.3-238$)7;04*/27HL.3).:>AE<@;?+,7:&+/3*.!)',8<:>;>;?8>).373726&+%*$%$-27;>BwY*Y*Y* "*#Y* %(	Y*
 !Y* ,/Y* $,DI#6Y* -2Y* 16Y* #((9(9<(G"HY* %T#Y/Y* (0'9Y* /7x.@Y* !&c49c#h	#PT&T UY* ',CcGCL$wWZ|J\^b,b&cY*  !)d 4!Y*" %)#Y*$ !eCHox!EF%Y*& %*#x*=$>'Y*( "(+)Y** "$sCx.1+Y*, *.-Y*. )-/Y*0 /31Y*2  $3Y*4 %-X$65Y*6 ,07Y*8 &*9Y*: .2;Y*< )1eCHo1F(G=Y*> *.?Y*@ %)AY*B (0'9CY*D /7x.@EY*F !&c49d&: ;GY*H )1(:IY*J (+KY*L 27MY*N "&OY*P  (QY*R %SMSY*T !UY*V #'WY*X +33-YY*Z -5SM[Y*\ *1):]Y*^ )1(:_Y*` #+C5$;"7aY*b %)cY*d &.c]eY*f ,1gY*h %-SMiY*j "&kY*l !%mY*n !$oY*p qY*r )-sY*t 'tCH~6uY*v &.d38n%=wY* Y*v0(.** c cc3h c c4 BKhl 
 
)C. 
ZbcfZg 
qu 
 AJaf  CG  bg #
s #
3 #
\` #
t|  ~A  uB #
  ]a #
  lp #
J1 1 1fC c d @)s )3 )4S> )\ %.bM!&"&mMmM s^mM !	mM
 mM mM mM SMmM 
mM^Ys Y Yt Y< S c d   FO[qu  RV sC sin sbjkobp s  DL  MP  DQ s  [_ s GKFJL}L8@L  }L 9AL 
eE#s(OU38_45	6	L, )-(,A 
eE#s(OU38_45	6	AF :CUYfj 0d8C= T  .7[d	EQP .7[hl6#r5Ln
ZD&PJX t
+  
+ ^b:6p7(rh<7r.;`QZfP$TLP
PPP
 4=;4 9vJ
$8 l$ (1{4TX n/`.  @;z  >    D! !rp   r   __main__)r  loggingr  r  r   enumr   r   r   mathr   r  typingr   r   r   r	   r
   r   r   r   r   r   r   r   r   r   collections.abcr   r   r   collectionsr   inspectr   	itertoolsr   	functoolsr   deepdiff.helperr   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   deepdiff.serializationrE   deepdiff.distancerF   rG   deepdiff.modelrH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   deepdiff.deephashrW   rX   deepdiff.baserY   deepdiff.lfucacherZ   r[   deepdiff.colored_viewr\   deepdiff._multiprocessingr]   r^   r_   r`   pytz.tzinfora   	getLoggerr   r   r  r  r  r/  rj   r   r   ro   r   rm   rl   r   r   r   r   r   r   r   r   r   r  r  r   r   r   rt   r   ru   r1  r2  r  r   r   doctesttestmodr   rp   rn   <module>rO     s(          $ F  F  F  F 7 7 #  ! @ @ @ @ @ @ @ @ @ @ @ 6 C     =  0 - 
 & 
		8	$Y 
X 
 !!:> n E]T#s(^ ]hud{>S ]_d ]im ] 6 
1 1 1 + $G !' + "C ) o ~ X ? A 9 012  %( ! ), % 4"x "S#!z-}>NPT S#!lF zOO rp   