
    :Qg'              '       <   d dl Z d dlZd dlmZ d dlmZ d dlmZmZmZm	Z	 d dl
mZmZmZ d dlmZmZ 	 d dlZ e j(                         d        Zej-                          e j.                  d e j0                  d	d	
             e j.                  d e j0                  d	d	
             e j2                  ddeed	       e j2                  ddeed	       e j2                  ddd ed	       e j2                  ddd ed	       e j2                  ddd e j8                  d d      d	       e j2                  dd	d	       e j2                  ddedd	       e j2                  ddedd	       e j2                  dded       e j2                  dd	d	       e j2                  ddedd       e j2                  dd	d	       e j2                  d d	d	       e j2                  d!d	d	       e j2                  d"d	d	       e j2                  d#d	d	       e j2                  d$d	d	       e j2                  d%d	d	       e j2                  d&dd ed	       e j2                  d'dd(ed	       e j2                  d)dded	       e j2                  d*dd+ed       e j2                  d,d e j<                  d-d.gd	/      d	d-0       e j2                  d1d e j<                  d2d3gd	/      d	d20       e j2                  d4d	d	       e j2                  d5dded	       e j2                  d6d e j<                  g d7d	/      d	d0       e j2                  d8dd e j8                  d d      d	       e j2                  d9d	d      d:                                                                                                                                                                                                                                 Zej-                          e j.                  d; e j0                  d	d	
             e j.                  d< e j0                  d	d	
             e j2                  d=d>d	d	       e j2                  d?d	d	       e j2                  d9d	d      d@                                           Z ej-                          e j.                  dAd	eB       e j.                  d; e j0                  d	d	
             e j2                  dCdDd	d	       e j2                  dEd	d	       e j2                  ddedd	       e j2                  ddedd	       e j2                  d8dd e j8                  d d      d	       e j2                  d9d	d      dF                                                                Z!ej-                          e j.                  dGd	eB       e j.                  d; e j0                  d	d	
             e j2                  d9d	d      dH                             Zy# e$ r dZY w xY w)I    N)Decimal)pprint)DeepDiff!CUTOFF_DISTANCE_FOR_PAIRS_DEFAULT%CUTOFF_INTERSECTION_FOR_PAIRS_DEFAULTlogger)Delta
DeepSearchextract)load_path_contentsave_content_to_pathc                       y)zA simple command line tool.N r       N/var/www/html/answerous/venv/lib/python3.12/site-packages/deepdiff/commands.pyclir      s     	r   t1T)existsresolve_path)typet2z--cutoff-distance-for-pairsF)requireddefaultr   show_defaultz--cutoff-intersection-for-pairsz--cache-sizez--cache-tuning-sample-sizez--cache-purge-level      z--create-patch)is_flagr   z--exclude-paths)r   r   r   multiplez--exclude-regex-pathsz--math-epsilon)r   r   r   z--get-deep-distancez
--group-byz--ignore-orderz--ignore-string-type-changesz--ignore-numeric-type-changesz--ignore-type-subclassesz--ignore-string-casez--ignore-nan-inequalityz--include-private-variablesz--log-frequency-in-secz--max-passesi z--max_diffsz--threshold-to-diff-deepergQ?z--number-format-notationfe)case_sensitive)r   r   r   r   z--progress-loggerinfoerrorz--report-repetitionz--significant-digitsz--truncate-datetime)secondminutehourdayz--verbose-levelz--debugc            
         |j                  d      }|j                  d       |d<   |d   dk(  rt        j                  nt        j                  |d<   |j                  d      }|j                  d      }|j                  d      }|j	                  d	      d
   }|j	                  d	      d
   }d||fd||ffD ]  \  }}	}
	 t        |	|
      ||<    |dv r|d   D cg c]  }t        |       c}|d<   |dv r|d   D cg c]  }t        |       c}|d<   |rd|d<   	 t        di |}|rD	 t              }t        j                  j                  j                  j!                                y	 t"        r*t%        j'                  t"        j(                               yt%        j'                  d             y# t        $ r2}|r t        j                  t        d| d|              Y d}~<d}~ww xY wc c}w c c}w # t        $ r)}t        j                  t        |             Y d}~d}~ww xY w# t        $ r&}|r t        j                  d|        Y d}~,d}~ww xY w# t        $ r t+        d       Y yw xY w)z
    Deep Diff Commandline

    Deep Difference of content in files.
    It can read csv, tsv, json, yaml, and toml files.

    T1 and T2 are the path to the files to be compared with each other.
    debuginclude_private_variablesignore_private_variablesprogress_loggerr"   create_patchr   r   .	file_typeError when loading : N>   csvtsvr   log_frequency_in_secz*Error when loading the patch (aka delta): )optionr   indentr   )popr   r"   r#   splitr   	Exceptionsysexitstrdictr   r	   stdoutbufferwritedumpsorjsonprintto_jsonOPT_INDENT_2r   )argskwargsr)   r-   t1_patht2_patht1_extensiont2_extensionnamet_patht_extensionr    idiffdeltas                  r   rS   rS      sg   V JJwE-3ZZ8S-T)TF%&/56G/HF/RX^XdXdF::n-LjjGjjG==%b)L==%b)L'+Wl&CdGUaEb%c A!fk	A,V{KF4LA ~%)/6AQ6t~%)/6AQ6t)*%&!&! 	K$KE 	

.	#dll&*=*=l>?dll!l,-K  	A24&1#>?@@		A 76  Q  	KEaSIJJ		K  	#4"	#sl   ?F=G;?H H -H: 1/I, !I, =	G8'G33G8	H7H22H7:	I)I$$I),JJpath
delta_pathz--backupz-bz--raise-errorsc           	         	 t        ||      }| j                  d      d   }	 t        | |      }z   }		 t        |	| ||	       y# t        $ r1}|r t        j                  t	        d| d|              Y d}~md}~ww xY w# t        $ r.}t        j                  t	        d|  d|              Y d}~d}~ww xY w# t        $ r1}|r t        j                  t	        d
|  d|              Y d}~yd}~ww xY w)ak  
    Deep Patch Commandline

    Patches a file based on the information in a delta file.
    The delta file can be created by the deep diff command and
    passing the --create-patch argument.

    Deep Patch is similar to Linux's patch command.
    The difference is that it is made for patching data.
    It can read csv, tsv, json, yaml, and toml files.

    )rV   raise_errorsz)Error when loading the patch (aka delta) r3   Nr.   r/   r0   r2   )r1   keep_backupzError when saving )r	   r<   r=   r>   r?   r;   r   r   )
rU   rV   backuprX   r)   rT   r    	extensioncontentresults
             r   patchr^   {   s   *Y,G 

3#I9#DI> W_F<VTYFS!  YHHSDZLPRSTRUVWXX	Y  9*4&1#67889  <HHS-dV2aS9:;;	<sE   A B B> 	B'A<<B	B;$B66B;>	C8'C33C8item)r   r   z--ignore-casez-iz--exact-matchc           	         |j                  d       |d<   |j                  d      |d<   	 t        |      }	 t        | fi |}t        d	
       y# t        $ r1}|r t        j                  t        d| d|              Y d}~Qd}~ww xY w# t        $ r1}|r t        j                  t        d| d|              Y d}~d}~ww xY w)z
    Deep Grep Commandline

    Grep through the contents of a file and find the path to the item.
    It can read csv, tsv, json, yaml, and toml files.

    ignore_caser!   exact_matchmatch_stringr2   r3   N"Error when running deep search on r   r8   )r:   r   r<   r=   r>   r?   r
   r   )r_   rU   r)   rJ   r\   r    r]   s          r   grepre      s    " $*::m#<<F#ZZ6F>=#D)LGT4V4 6!  =HHS.tfBqc:;<<	=  LHHS=dV2aSIJKK	Ls.   A B 	B'BB	C	'CC	path_insidec           	      D   	 t        |      }	 t        |       }t        d       y# t        $ r1}|r t        j                  t	        d| d|              Y d}~Pd}~ww xY w# t        $ r1}|r t        j                  t	        d| d|              Y d}~d}~ww xY w)z
    Deep Extract Commandline

    Extract an item from a file based on the path that is passed.
    It can read csv, tsv, json, yaml, and toml files.

    r2   r3   Nrd   r   r8   )r   r<   r=   r>   r?   deep_extractr   )rf   rU   r)   r\   r    r]   s         r   r   r      s    =#D)Lg{3 6!  =HHS.tfBqc:;<<	=  LHHS=dV2aSIJKK	Ls+   ( A% 	A"'AA"%	B.'BB)"clickr=   decimalr   r   deepdiff.diffr   r   r   r   deepdiffr	   r
   r   rh   deepdiff.serializationr   r   rE   ImportErrorgroupr   commandargumentPathr7   floatintIntRanger?   ChoicerS   r^   re   r   r   r   <module>rw      s    
    @ ? J
 	 	
 :5::TEF:5::TEF+eEfmr  BF  G/%Inuz  JN  OnuacPTU*UAC^bc#eQ^U^^TUWXEYhlm4@%cX\]%Ce^bcW5Q#TElU5SXY4@,dN-t$O($TJ$dF'DI+TM&Z^_nuhSW[\meTRVW*UDuchi(5|u||SRUJgk?l{  JM  N!EfgEVgk8l{  JP  Q#TE$ud[_`#e,%,,Gj{  ;A  PT  ^b  c%PQSTAUdhiiE:># ; j c a F Q N j X ] ` N J G K P O A Z F R d ^ A n d V O G G G @>#B ZUZZt$GH:5::T#MNj$4@4@iE:&< ; A A O I &<R C0ZUZZt$GHotTEot$?%cX\]%Ce^bc%PQSTAUdhiiE: ; j d ^ @ F I 1 : 37ZUZZt$GHiE: ; I 8 I  Fs   X XX