
    9h                     B   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
JrJrJrJr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  \R:                  " 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\\\\/\#4   4   \4   4S jr$g)    N)Path)dedent)AnyCallableListOptionalTupleUnion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     SC:\Suresh\moveshuttle\MDcreated\moveengine\venv\Lib\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functionr0   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)warningr6   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)r5   r:   z[%(asctime)s] %(message)sz%H:%M:%S)fmtdatefmtr2   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_filterr8   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
addHandlerrF   r   r'   loggerr8   import_exitargsshlexsplitr7   r)   r   r   printstderrexitbuild_filterfilterignore_pathsr6   joinr   rH   rI   non_recursiverK   rL   )r   rh   parserarg_namespace	log_levelhdlr	wg_loggerrF   rC   r)   erG   watch_filter_strs                r   rQ   rQ      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: r=   r   )
osgetcwdrM   r   appendr   ImportErrorrk   rl   rm   )rz   cwdrx   s      r   rg   rg      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-   )rp   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)rj   r   r   r   r   rf   r7   rg   
isinstancer/   
issubclass__name__r   r   r   r   rV   boolrepr)r   r   rp   rC   watch_filter_clsrG   s         r   rn   rn      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)%rO   r[   r|   ri   rM   pathlibr   textwrapr   typingr   r   r   r   r	   r
   r   r"   r   filtersr   r   r   runr   r   r   r:   r   rd   rf   rV   r   rQ   rg   r   rn   rA   r   r   <module>r      s      	  
   D D D  < < ? ? 			+	,3 4 \ \ \~	s 	s 	44(04
5}h}d/B&CCDcIJ4r   