+
    i                        R t ^ RIHt ^ RIHt ^ RIHt ^ RIt^ RIt^ RIt^ RI	H
t
 ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ^ R	IHt ^ R
IHt ^RIHt  ! R R4      tR# )zsupport routines for the helpers in tools/.

These aren't imported by the enclosing util package as the are not
needed for normal library use.

)annotations)ArgumentParser)	NamespaceN)Path)Any)Dict)Iterator)Optional)Union)compatc                     ] tR t^#t$ R]R&   R]R&   R]R&   R]R&   R]R	&   R]R
&   R R ltR R ltR R ltR R ltR R lt	R R lt
R R ltRRRR/R R llt]P                  R R l4       t]P                  R  R! l4       tR"tR# )#code_writer_cmdr   parserr   argsboolsuppress_outputdiffs_detectedr   source_rootpyproject_toml_pathc                   V ^8  d   QhRR/# )   tool_scriptstr )formats   "vC:\Users\petid\OneDrive\Desktop\Maestro\MAESTRO\maestro-backend\venv\Lib\site-packages\sqlalchemy/util/tool_support.py__annotate__code_writer_cmd.__annotate__+   s     
 
C 
    c                	l   \        V4      P                  P                  V n        V P                  \        R 4      ,          V n        V P                  P	                  4       '       g   Q h\        4       V n        V P                  P                  RRRR7       V P                  P                  RRRRR7       R	# )
zpyproject.tomlz--stdout
store_truez)Write to stdout instead of saving to file)actionhelp-cz--checkzDon't write the files back, just return the status. Return code 0 means nothing would change. Return code 1 means some files would be reformatted)r"   r!   N)r   parentr   r   existsr   r   add_argument)selfr   s   &&r   __init__code_writer_cmd.__init__+   s    ,33::#'#3#3d;K6L#L ''..0000$&  < 	! 	

 	  B   	! 	
r   c                    V ^8  d   QhRRRR/# r   tempfiler   returnNoner   )r   s   "r   r   r   ?   s     
 
S 
T 
r   c                	^    V P                  \        V4      R RRRV P                   2/4       R# )
entrypointzimportsoptionsz--toml-config N_run_console_scriptr   r   r'   r,   s   &&r   run_zimportscode_writer_cmd.run_zimports?   s4      Mj^D,D,D+EF	
r   c                    V ^8  d   QhRRRR/# r+   r   )r   s   "r   r   r   H   s     
 
# 
$ 
r   c                	^    V P                  \        V4      R RRRV P                   2/4       R# )r0   blackr2   z	--config Nr3   r5   s   &&r   	run_blackcode_writer_cmd.run_blackH   s4      MgYt'?'?&@A	
r   c               $    V ^8  d   QhRRRRRR/# )r   pathr   r2   zDict[str, Any]r-   r.   r   )r   s   "r   r   r   Q   s!     %
 %
 %
n %
 %
r   c                V   \         P                  R8H  pVR,          p\        P                  ! R4       F  pVP                  V8X  g   K  Tp M	  \	        RV 24      hVP                  RR4      p\        P                  ! WsR7      V.,           p/ p	V P                  '       d   \        P                  ;V	R&   V	R	&   \        P                  ! \        P                  R
RVP                  : RVP                  : RVP                  : R2.V,           3R\!        V P"                  4      /V	B  R# )zURun a Python console application from within the process.

Used for black, zimports

posixr0   console_scriptsz*Could not find entrypoint console_scripts.r2    )r@   stdoutstderrr#   zimport z; .z()cwdN)osnamer   importlib_metadata_get	Exceptiongetshlexsplitr   
subprocessDEVNULLrunsys
executablemoduleattrr   r   )
r'   r>   r2   is_posixentrypoint_nameentryimplcmdline_options_strcmdline_options_listkws
   &&&       r   r4   #code_writer_cmd._run_console_scriptQ   s    77g%!,/223DEEzz_, F
 <_<MN  &kk)R8${{ 
F   *4*<*<<BxL2h<(,T[[$))L
 ##		
 D$$%		
 		
r   c                    V ^8  d   QhRRRR/# )r   textr   r-   r.   r   )r   s   "r   r   r   x   s     - -# -$ -r   c                	    V P                   '       g1   \        P                  P                  R P	                  V4      4       R# R# ) N)r   rQ   rD   writejoin)r'   r^   s   &*r   write_statuscode_writer_cmd.write_statusx   s-    ###JJSXXd^, $r   c               $    V ^8  d   QhRRRRRR/# )r   r^   r   destination_pathUnion[str, Path]r-   r.   r   )r   s   "r   r   r   |   s$     ( ((+;(	(r   c                	>   V P                   P                  '       d   V P                  W!R 7       R# V P                   P                  '       d   \	        V4       R# V P                  RV R24       \        V4      P                  VRRR7       V P                  R4       R# ))sourceWriting ...utf-8
)encodingnewlinedone
N)r   check	_run_diffrC   printrc   r   
write_text)r'   r^   rf   s   &&&r   write_output_file_from_text+code_writer_cmd.write_output_file_from_text|   s     99???NN+N9YY$K)9(:#>?!"--w .  h'r   c               $    V ^8  d   QhRRRRRR/# )r   r,   r   rf   r-   r.   r   )r   s   "r   r   r      s$     ( ((/2(	(r   c                	   V P                   P                  '       d+   V P                  W!R 7       \        P                  ! V4       R# V P                   P
                  '       dN   \        V4      ;_uu_ 4       p\        VP                  4       4       RRR4       \        P                  ! V4       R# V P                  RV R24       \        P                  ! W4       V P                  R4       R#   + '       g   i     Lf; i))source_fileNrj   rk   rp   )r   rq   rr   rG   unlinkrC   openrs   readrc   shutilmove)r'   r,   rf   tfs   &&& r   write_output_file_from_tempfile/code_writer_cmd.write_output_file_from_tempfile   s     99???NN+NBIIhYYh2bggi   IIh)9(:#>?KK3h'  s   6C..C>	ri   Nry   c               (    V ^8  d   QhRRRRRRRR/# )r   rf   rg   ri   zOptional[str]ry   r-   r.   r   )r   s   "r   r   r      s2     * *** 	*
 #* 
*r   c               	   V'       d+   \        VR R7      ;_uu_ 4       p\        V4      pRRR4       MVe   VP                  RR7      pMQ R4       h\        VR R7      ;_uu_ 4       p\        P                  ! \        V4      X\        V4      P                  4       R^RR7      p\        V4      pV'       d"   RV n        \        R	P                  V4      4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)
rl   )rn   NT)keependsz!source or source_file is requiredz<proposed changes>rm   )fromfiletofilenlinetermrB   )
r{   list
splitlinesdifflibunified_diffr   as_posixr   rs   rb   )	r'   rf   ri   ry   r   source_linesdpd	d_as_lists	   &&$$     r   rr   code_writer_cmd._run_diff   s     kG44#Bx 54!,,d,;L===5"W55$$R./88:+A QI&*#bggi() 65 54 655s   C!&A1C4!C1	4D	c                   V ^8  d   QhRR/# )r   r-   zIterator[ArgumentParser]r   )r   s   "r   r   r      s      7 r   c              #  	*   "   V P                   x  R # 5i)N)r   r'   s   &r   add_argumentscode_writer_cmd.add_arguments   s     kks   c                   V ^8  d   QhRR/# )r   r-   zIterator[None]r   )r   s   "r   r   r      s      ^ r   c              #  	  "   V P                   P                  4       V n        V P                  P                  '       d   R V n        RV n        M+V P                  P                  '       d	   RV n        MR V n        Rx  V P                  P                  '       d+   V P                  '       d   \        P                  ! ^4       R# \        P                  ! ^ 4       R# 5i)FTN)	r   
parse_argsr   rq   r   r   rC   rQ   exitr   s   &r   run_programcode_writer_cmd.run_program   s     KK**,	99???"'D#'D YY#'D #(D 99???t222HHQKHHQKs   A&C).CC*0C)r   r   r   r   r   r   )__name__
__module____qualname____firstlineno____annotations__r(   r6   r;   r4   rc   ru   r   rr   
contextlibcontextmanagerr   r   __static_attributes__r   r   r   r   r   #   s    
O
(

%
N-((* !%	*
 &**:    r   r   )__doc__
__future__r   argparser   r   r   r   rG   pathlibr   rL   r}   rN   rQ   typingr   r   r   r	   r
   rB   r   r   r   r   r   <module>r      sK    # #    	     
      f fr   