
    j              
       :   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  SSKJr  SSKJrJrJr  SS	KJrJrJr  SS
KJr  \R4                  " S5      rS\S\4S jrS\SS4S jrS\S\4S jrS\S\S-  S\ S\-  \\\/\!4   -  \4   4S jr"g)    N)Callable)Path)dedent)Anycast   )Change)
BaseFilterDefaultFilterPythonFilter)detect_target_typeimport_stringrun_process)VERSIONzwatchfiles.clipath_strreturnc                 x    [        U 5      nUR                  5       (       d  [        U5      eUR                  5       $ )N)r   existsFileNotFoundErrorresolve)r   paths     K/var/www/reloj-farallon/venv/lib/python3.13/site-packages/watchfiles/cli.pyresolve_pathr      s-    >D;;==%%||~    args_c                  	   U =(       d    [         R                  SS n[        R                  " S[	        [
        R                  =(       d    SR                  S5      5      [        R                  S9nUR                  SSS	9  UR                  S
SSSS9  UR                  SS[        SS9  UR                  SS[        S/ SQSS9  UR                  SS[        SSS9  UR                  SS[        SS9  UR                  SSS S!9  UR                  S"SS#S!9  UR                  S$S[        S%/ S&QS'S9  UR                  S(S[        S)S*S9  UR                  S+S[        S,S-S9  UR                  S.S[        SS/S9  UR                  S0SS1S!9  UR                  S2S3S4S5[         3S69  UR                  U5      nUR                  (       a  [         R"                  nO([%        [         UR&                  R)                  5       5      n[         R*                  " 5       nUR-                  U5        UR/                  [         R0                  " S7S8S995        [         R2                  " S5      nUR5                  U5        UR-                  U5        UR6                  S:X  a  [9        UR:                  5      nOUR6                  nUS::X  a~  [<        R?                  S;UR:                  5        [A        UR:                  5        URB                  (       a7  UR:                  /[D        RF                  " URB                  5      -   [         l        O&URB                  (       a  [<        RI                  S<5         URJ                   Vs/ s H  n[M        U5      PM     n	n[W        URX                  URZ                  5      u  p[<        R]                  S@[        SAR_                  SB W	 5       5      UR:                  UU5        [a        U	UR:                  UUU[         R"                  :H  URb                  URd                  URf                  (       + URh                  URj                  SC.	6  gs  snf ! [N         a=  n
[Q        S=U
 S>3[         RR                  S?9  [         RT                  " S5         Sn
A
GNSn
A
ff = f)Da  
Watch one or more directories and execute either a shell command or a python function on file changes.

Example of watching the current directory and calling a python function:

    watchfiles foobar.main

Example of watching python files in two local directories and calling a shell command:

    watchfiles --filter python 'pytest --lf' src tests

See https://watchfiles.helpmanual.io/cli/ for more information.
r   N
watchfiles 
)progdescriptionformatter_classtargetz&Command or dotted function path to run)helppaths*.z8Filesystem paths to watch, defaults to current directory)nargsdefaultr$   z--ignore-paths?zrSpecify directories to ignore, to ignore multiple paths use a comma as separator, e.g. "env" or "env,node_modules")r(   typer$   z--target-typeauto)commandfunctionr,   zWhether the target should be intercepted as a shell command or a python function, defaults to "auto" which infers the target type from the target string)r(   r+   r)   choicesr$   z--filterr)   zWhich files to watch, defaults to "default" which uses the "DefaultFilter", "python" uses the "PythonFilter", "all" uses no filter, any other value is interpreted as a python function/class path which is imported)r(   r+   r)   r$   z--argszbArguments to set on sys.argv before calling target function, used only if the target is a functionz	--verbose
store_truez1Set log level to "debug", wins over `--verbosity`)actionr$   z--non-recursivez7Do not watch for changes in sub-directories recursivelyz--verbosityinfo)warningr2   debugzLog level, defaults to "info"z--sigint-timeout   z?How long to wait for the sigint timeout before sending sigkill.z--grace-periodr   zKNumber of seconds after the process is started before watching for changes.z--sigkill-timeoutzLHow long to wait for the sigkill timeout before issuing a timeout exception.z--ignore-permission-deniedzEIgnore permission denied errors while watching files and directories.z	--versionz-Vversionz
%(prog)s v)r1   r6   z[%(asctime)s] %(message)sz%H:%M:%S)fmtdatefmtr.   z/target_type=function, attempting import of "%s"z1--args is only used when the target is a functionzpath "z" does not existfileu:   watchfiles v%s 👀  path=%s target="%s" (%s) filter=%s...z, c              3   .   #    U  H  nS U S 3v   M     g7f)"N ).0ps     r   	<genexpr>cli.<locals>.<genexpr>   s     *EqAaS(Es   )	r#   target_typewatch_filterr4   sigint_timeoutsigkill_timeout	recursiveignore_permission_deniedgrace_period)6sysargvargparseArgumentParserr   cli__doc__stripRawTextHelpFormatteradd_argumentstrintfloatr   
parse_argsverboseloggingDEBUGgetattr	verbosityupperStreamHandlersetLevelsetFormatter	Formatter	getLogger
addHandlerrB   r   r#   loggerr4   import_exitargsshlexsplitr3   r%   r   r   printstderrexitbuild_filterfilterignore_pathsr2   joinr   rD   rE   non_recursiverG   rH   )r   rd   parserarg_namespace	log_levelhdlr	wg_loggerrB   r?   r%   erC   watch_filter_strs                r   rM   rM      s^     CHHQRLD$$CKK-244T:; 55F
 'OP
sC.h   b   /U  
 _  
 q	   L?rs
,5n   ,,   N   Z   [   $T  
 T)zRYQZE[\%%d+MMM	G]%<%<%B%B%DE	  "DMM)g'',GQ[\]!!,/Iy!  F*()=)=>#//j FH\H\]M(()%,,-M<N<N0OOCH			JK*7*=*=>*=Qa*=>
 &2-2F2FHbHb%c"L
KKD		*E** 	##!7==($33%55#111!.!G!G"//! ? qc)*<s*   Q "P?7Q ?Q 
R2RRfunction_pathc                 :   [         R                  " 5       nU[        R                  ;  a  [        R                  R	                  U5         [        U 5      $ ! [         a;  n[        SU 3[        R                  S9  [        R                  " S5         S nAg S nAff = f)NzImportError: r9   r   )
osgetcwdrI   r   appendr   ImportErrorrg   rh   ri   )rv   cwdrt   s      r   rc   rc      sk    
))+C
#((]++ aS!

3s   

A 
B1BBfilter_nameignore_paths_strc                    / nU(       a8  UR                  S5       Vs/ s H  n[        U5      R                  5       PM     nnU S:X  a  [        US9S4$ U S:X  a  [	        US9S4$ U S:X  a  U(       a  [
        R                  S5        g	[        U 5      n[        U[        5      (       a'  [        U[        5      (       a  U" US9UR                  4$ U(       a  [
        R                  S
5        [        U[        5      (       a(  [        U[        5      (       a  U" 5       UR                  4$ [        [        [        [         /["        4   U5      nU[%        U5      4$ s  snf )N,r)   )rl   r   pythonr   allz>"--ignore-paths" argument ignored as "all" filter was selected)Nz(no filter)zN"--ignore-paths" argument ignored as filter is not a subclass of DefaultFilter)rf   r   r   r   r   rb   r3   rc   
isinstancer+   
issubclass__name__r
   r   r   r	   rR   boolrepr)r}   r~   rl   r?   watch_filter_clsrC   s         r   rj   rj      s2     "L3C3I3I#3NO3NaQ)3NOi,7HH		 6FF		NN[\"";/"D))j9I=.Y.Y\:<L<U<UUUgh"D))j9I:.V.V!#3#<#<<<Hfc]D%89;KLT"2333- Ps   #E)#rK   rW   rx   re   rI   collections.abcr   pathlibr   textwrapr   typingr   r   r   r	   filtersr
   r   r   runr   r   r   r6   r   r`   rb   rR   r   rM   rc   tupler   rj   r=   r   r   <module>r      s      	  
 $     < < ? ? 			+	,3 4 \ \ \~	s 	s 	44(+d
4
4-(FC=$+>"??DE4r   