
     i#                        d dl Z 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	 d dl
mZmZmZmZmZmZmZmZ d dlmZ ddlmZ d	ed
ededeee                  deee                  dedededeeeeeeef         fdZd	ed
edeeeeef         fdZdededededeee                  deee                  deddfdZdededeee                  deee                  def
dZed	ed
edeee                  deee                  dedededeeeeeeeef                  fd            Zd	ed
edeee                  deee                  dedededeeeeeeegee         f         dee         fdZ	 	 	 	 	 	 d'd	ed
ed"edeee                  deee                  dedededee         fd#Z	 	 	 	 	 d(d$ed%ee         d	ed
edeee                  deee                  dedededee         fd&Z dS ))    N)contextmanager)unified_diff)Pool	cpu_count)AnyCallableIterableIteratorListOptionalTextTuple)TTFont   )get_file_modtime
filepath_a
filepath_b
tmpdirpathinclude_tablesexclude_tablesfont_number_afont_number_buse_multiprocessreturnc           	      *   t          | |          \  }}	}
}t          ||          }t          |	|          }t          j                            |d          }t          j                            |d          }t          |||||||           |||
|||	fS )N)
fontNumberzleft.ttxz	right.ttx)_get_pre_post_pathsr   ospathjoin_mp_save_ttx_xml)r   r   r   r   r   r   r   r   post_pathnamepostpathpre_pathnameprepathtt_lefttt_rightleft_ttxpathright_ttxpaths                   ]/srv/www/vhosts/g4struct/public_html/venv/lib/python3.11/site-packages/fontTools/diff/diff.py_get_fonts_and_save_xmlr+      s     6IJ6 62M8\7 W777Gh=999H7<<
J77LGLL[99M   g}hVV    c                     | }|}| }|}||||fS N )r   r   r%   r#   r$   r"   s         r*   r   r   2   s'     GHLM(L'99r,   r&   r'   r(   r)   c                    |rdt                      dk    rR| |||f||||fg}t          d          5 }|                    t          |           d d d            d S # 1 swxY w Y   d S t          | |||           t          ||||           d S )Nr      )	processes)r   r   starmap_ttfont_save_xml)	r&   r'   r(   r)   r   r   r   mp_args_listpools	            r*   r!   r!   =   s      RIKK!OO lNNC}nnE
 A 	9$LL)<888	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	,OOO=..QQQQQs   AA!Attffilepathc                 6    |                      |||           dS )z;Writes TTX specification formatted XML to disk on filepath.)tables
skipTablesT)saveXML)r7   r8   r   r   s       r*   r4   r4   Y   s!     KKNKKKK4r,   c              #      K   t          j                    5 }t          | |||||||          V  d d d            d S # 1 swxY w Y   d S r.   )tempfileTemporaryDirectoryr+   )r   r   r   r   r   r   r   r   s           r*   _saved_ttx_filesr@   d   s       
	$	&	& 

*%	
 	
 		
 		
 		


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

s   <A A create_differc           	   #      K   t          | ||||||          5 \  }}	}
}}} |||	|
|||          E d {V  d d d            d S # 1 swxY w Y   d S r.   )r@   )r   r   r   r   r   r   r   rA   r(   r)   r$   r%   r"   r#   s                 r*   _diff_with_saved_ttx_filesrC   {   s       

 
 

 =
 
 	
 	
 	
 	
 	
 	
 	
!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
s   AA
A   Tcontext_linesc              #      K   dt           dt           dt           dt           dt           dt           dt          t                    ffd}t          | |||||||          E d	{V  d	S )
a  Performs a unified diff on a TTX serialized data format dump of font binary data using
    a modified version of the Python standard libary difflib module.

    filepath_a: (string) pre-file local file path
    filepath_b: (string) post-file local file path
    context_lines: (int) number of context lines to include in the diff (default=3)
    include_tables: (list of str) Python list of OpenType tables to include in the diff
    exclude_tables: (list of str) Python list of OpentType tables to exclude from the diff
    use_multiprocess: (bool) use multi-processor optimizations (default=True)

    include_tables and exclude_tables are mutually exclusive arguments.  Only one should
    be defined

    :returns: Generator of ordered diff line strings that include newline line endings
    :raises: KeyError if include_tables or exclude_tables includes a mis-specified table
    that is not included in filepath_a OR filepath_b
    r(   r)   r$   r%   r"   r#   r   c           	   3   l  K   t          |           5 }|                                }d d d            n# 1 swxY w Y   t          |          5 }|                                }	d d d            n# 1 swxY w Y   t          |          }
t          |          }t          ||	|||
|          E d {V  d S )N)n)open	readlinesr   r   )r(   r)   r$   r%   r"   r#   ff	fromlinestftolinesfromdatetodaterF   s               r*   _create_unified_diffz$u_diff.<locals>._create_unified_diff   sS      , 	'2I	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	'-   	%BllnnG	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% 	% $G,,!(++
 
 
 	
 	
 	
 	
 	
 	
 	
 	
 	
s   488A//A36A3Nr   r	   rC   )	r   r   rF   r   r   r   r   r   rR   s	     `      r*   u_diffrT      s      8


 
 	

 
 
 
$
 
 
 
 
 
4 *	 	 	 	 	 	 	 	 	 	 	r,   	diff_tool	diff_argsc	              #       K   dt           dt           dt           dt           dt           dt           dt          t                    f fd}	t          ||||||||	          E d	{V  d	S )
a'  Performs a unified diff on a TTX serialized data format dump of font binary data using
    an external diff executable that is requested by the caller via `command`

    diff_tool: (string) command line executable string
    diff_args: (list of strings) arguments for the diff tool
    filepath_a: (string) pre-file local file path
    filepath_b: (string) post-file local file path
    include_tables: (list of str) Python list of OpenType tables to include in the diff
    exclude_tables: (list of str) Python list of OpentType tables to exclude from the diff
    use_multiprocess: (bool) use multi-processor optimizations (default=True)

    include_tables and exclude_tables are mutually exclusive arguments.  Only one should
    be defined

    :returns: Generator of ordered diff line strings that include newline line endings
    :raises: KeyError if include_tables or exclude_tables includes a mis-specified table
    that is not included in filepath_a OR filepath_b
    :raises: IOError if exception raised during execution of `command` on TTX files
    r(   r)   _pre_pathname_prepath_post_pathname	_postpathr   c              3      K   g
z   | |gz   }t          j        |t           j        t           j        d          }|j        D ]}|V  |j                                        }	|	rt          |	          d S )Nutf8)stdoutstderrencoding)
subprocessPopenPIPEr^   r_   readIOError)r(   r)   rX   rY   rZ   r[   commandprocesslineerrrV   rU   s             r*   _create_external_diffz0run_external_diff.<locals>._create_external_diff  s       +	)\=,II"??	
 
 
 N 	 	DJJJJn!!## 	#,,	 	r,   NrS   )
rU   rV   r   r   r   r   r   r   r   rj   s
   ``        r*   run_external_diffrk      s      >  	
   
$      , *	 	 	 	 	 	 	 	 	 	 	r,   )rD   NNrE   rE   T)NNrE   rE   T)!r   ra   r>   
contextlibr   difflibr   multiprocessingr   r   typingr   r   r	   r
   r   r   r   r   fontTools.ttLibr   utilsr   intboolr+   r   r!   r4   r@   rC   rT   rk   r/   r,   r*   <module>rt      s   				      % % % % % %             + + + + + + + + Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q " " " " " " # # # # # #WWW W T$Z(	W
 T$Z(W W W W 4tT4-.W W W W<::: 4tT!": : : :RRR R 	R
 T$Z(R T$Z(R R 
R R R R8	 T$Z( T$Z(	
 
    


 T$Z(
 T$Z(	

 
 
 
 eD$dD$678
 
 
 
,!
!
!
 T$Z(!
 T$Z(	!

 !
 !
 !
 T4tT4@(4.PQ!
 d^!
 !
 !
 !
\ +/+/!? ??? ? T$Z(	?
 T$Z(? ? ? ? d^? ? ? ?N ,0+/!> >>Dz> > 	>
 T$Z(> T$Z(> > > > d^> > > > > >r,   