
    ʆhlc                       S r SSKJr  SSKr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
Jr  SSKJr  SSKJr  SSKJrJr  SSKJrJrJr  SS	KJr  \(       a   SS
K	JrJr  SSKJr  SSKJr  SSKJr  SSK J!r!  \RD                  " \RF                  S9  Sr$Sr% " S S\5      r&Sr'\
" \'\&S9r(\(RS                  SS\S9  \(RU                  SS9r+0 r,\-\.\/   \4   r0SS jr1\+SS.       SS jjr2\Rf                  S.SS jjr4SS .SS! jjr5SS" jr6S#S.       SS$ jjr7          SS& jr8SS' jr9\2" \1" S(S)S*S+9\1" S,S-S.\Rf                  < S/3S09\1" S1S2S3S4\:S5S69\1" S7S8S9S:S;9\1" S<S8S=S>9\1" S?S8S@S>9\1" SAS8SBS>9\1" SCS8SDS>9\1" SES8SFS>9/	S/SG9SSH j5       r;\2" \1" SIS)SJS+9\1" S,S-S.\Rf                  < S/3S09\1" SKSSLS09\1" SMSNSOS8SPSQ9/SR/SG9SSS j5       r<\2" \1" STS)S-SUSV9\1" SWSXSYSZS)S[S\9\1" S]S^S_S`SaSbS\9\1" ScSdSeS8SfSQ9\1" SgS7S%S8ShSQ9\1" S1S2S3S4\:SiS69\1" S<S8S=S>9\1" S?S8S@S>9\1" SAS8SBS>9\1" SCS8SDS>9\1" SES8SFS>9/5      SSj j5       r=\2" \1" STS)S-SkSV9\1" SlSmSnSSoS\9\1" SWSXSYSZS)S[S\9\1" S]S^S_S`SaSbS\9\1" ScSdSeSpS8SfSq9\1" SgS7S%S8ShSQ9\1" S1S2S3S4\:SiS69\1" SrSsStS8SuSQ9\1" SvSwSxS8SySQ9\1" S<S8S=S>9/
5      SSz j5       r>\2" \1" SnS{S|9\1" S}S~S)SS9\1" SSSTSSSS9\1" SWSXSYSZS)S[S\9\1" S]S^S_S`SaSbS\9\1" ScSdSeSpS8SfSq9\1" SgS7S%S8ShSQ9\1" S1S2S3S4\:SiS69\1" SSSSS\9\1" S<S8S=S>9\1" SSS\:SS69\1" SSS\:SS69\1" SSS9SSSq9/5      SS j5       r? " S S\@5      rASS jrBSS jrC\DS:X  a  \R                  " \C" 5       5        gg)u   :module: watchdog.watchmedo
:author: yesudeep@google.com (Yesudeep Mangalapilly)
:author: contact@tiger-222.fr (Mickaël Schoentgen)
:synopsis: ``watchmedo`` shell script utility.
    )annotationsN)ArgumentParserRawDescriptionHelpFormatter)StringIO)dedent)TYPE_CHECKINGAny)WatchdogShutdownError
load_classplatform)VERSION_STRING)	Namespace_SubParsersAction)Callable)FileSystemEventHandler)ObserverType)BaseObserver)leveltrickszpython-pathc                  L   ^  \ rS rSrSrSS.S	U 4S jjjrS
S jrSS jrSrU =r	$ )HelpFormatter&   a  A nicer help formatter.

Help for arguments can be indented and contain new lines.
It will be de-dented and arguments in the help
will be separated by a blank line for better readability.

Source: https://github.com/httpie/httpie/blob/2423f89/httpie/cli/argparser.py#L31
   )max_help_positionc               .   > XS'   [         TU ]  " U0 UD6  g )Nr   )super__init__)selfr   argskwargs	__class__s       J/opt/services/DDDS/venv/lib/python3.13/site-packages/watchdog/watchmedo.pyr   HelpFormatter.__init__0   s    &7"#$)&)    c                4    S[        U 5      R                   S3$ )N<>)type__name__)r   s    r"   __repr__HelpFormatter.__repr__5   s    4:&&'q))r$   c                Z    [        U5      R                  5       S-   nUR                  5       $ )Nz

)r   strip
splitlines)r   textwidths      r"   _split_linesHelpFormatter._split_lines8   s&    d|!!#f,  r$    )r   r	   r   intr    r	   returnNone)r5   str)r/   r7   r0   r4   r5   	list[str])
r)   
__module____qualname____firstlineno____doc__r   r*   r1   __static_attributes____classcell__)r!   s   @r"   r   r   &   s&     => * *
*! !r$   r   u,  Copyright 2018-2024 Mickaël Schoentgen & contributors
Copyright 2014-2018 Thomas Amland & contributors
Copyright 2012-2014 Google, Inc.
Copyright 2011-2012 Yesudeep Mangalapilly

Licensed under the terms of the Apache license, version 2.0. Please see
LICENSE in the source code for more information.)epilogformatter_classz	--versionversion)actionrA   top_command)destc                     [        U 5      U4$ )zTConvenience function to properly format arguments to pass to the
command decorator.
)list)name_or_flagsr    s     r"   argumentrH   N   s     &&r$   )parentcmd_aliasesc                   ^ ^^ SU UU4S jjnU$ )zDecorator to define a new command in a sanity-preserving way.
The function will be stored in the ``func`` variable when the parser
parses arguments so that it can be called directly like so::

  >>> args = cli.parse_args()
  >>> args.func(args)

c                  > U R                   R                  SS5      n[        U R                  =(       d    S5      nT	R	                  UT=(       d    / U[
        S9nU[        U'   UR                  5       nUR                  SSSSS	S
9  UR                  SSSSSS
9  T H&  u  pVUR                  " U0 UD6  UR                  U S9  M(     U $ )N_- )aliasesdescriptionr@   z-qz--quiet	verbosityappend_const)rD   rB   constz-vz	--verbose   )func)
r)   replacer   r<   
add_parserr   command_parsersadd_mutually_exclusive_groupadd_argumentset_defaults)
rW   namedescparserverbosity_grouprG   r    r   rJ   rI   s
          r"   	decoratorcommand.<locals>.decoratord   s    }}$$S#.dll(b)""41BPTfs"t & ==?$$T9;~eg$h$$T;[Q_gh$i%)!M9&9T* &* r$   )rW   r   r5   r   r3   )r   rI   rJ   rb   s   ``` r"   commandrd   U   s      r$   )	separatorc               $    U R                  U5      $ )zSplits a pathname specification separated by an OS-dependent separator.

:param pathname_spec:
    The pathname specification.
:param separator:
    (OS Dependent) `:` on Unix and `;` on Windows or user-specified.
split)pathname_specre   s     r"   
path_splitrj   t   s     y))r$   )indexc               `    U SSS2    H"  n[         R                  R                  X5        M$     g)zAdds specified paths at specified index into the sys.path list.

:param paths:
    A list of paths to add to the sys.path
:param index:
    (Default 0) The index in the sys.path list where the paths will be
    added.
NrT   )syspathinsert)	pathnamesrk   pathnames      r"   add_to_sys_pathrr      s&     ddO( $r$   c                    SSK n[        U S5       nUR                  UR                  5       5      sSSS5        $ ! , (       d  f       g= f)zLoads the YAML configuration from the specified file.

:param tricks_file_path:
    The path to the tricks configuration file.
:returns:
    A dictionary of configuration information.
r   Nrb)yamlopen	safe_loadread)tricks_file_pathnameru   fs      r"   load_configr{      s2     	"D	)Q~~affh' 
*	)	)s	   :
A;c               ^    U R                  U5      nUR                  U5      nUS/:X  a  / nX44$ )zVParses pattern argument specs and returns a two-tuple of
(patterns, ignore_patterns).
rO   rg   )patterns_specignore_patterns_specre   patternsignore_patternss        r"   parse_patternsr      s<     ""9-H*00;O2$$$r$   	recursivec                   [        U5       H  nU R                  XUS9  M     U R                  5           [        R                  " S5        M  ! [
         a    U R                  5          Of = fU R                  5         g)aC  Single observer thread with a scheduled path and event handler.

:param observer:
    The observer thread.
:param event_handler:
    Event handler which will be called in response to file system events.
:param pathnames:
    A list of pathnames to monitor.
:param recursive:
    ``True`` if recursive; ``False`` otherwise.
r   rV   N)setschedulestarttimesleepr
   stopjoin)observerevent_handlerrp   r   rq   s        r"   observe_withr      sh    $ 	N-YG #NNJJqM   MMOs   A A*)A*c                   U HU  nUR                  5        H>  u  pV[        U5      nU" S0 UD6n[        USS5      =(       d    Un	U R                  XUS9  M@     MW     g)aB  Schedules tricks with the specified observer and for the given watch
path.

:param observer:
    The observer thread into which to schedule the trick and watch.
:param tricks:
    A list of tricks.
:param pathname:
    A path name which should be watched.
:param recursive:
    ``True`` if recursive; ``False`` otherwise.
source_directoryNr   r3   )itemsr   getattrr   )
r   r   rq   r   trickr^   value	trick_clshandlertrick_pathnames
             r"   schedule_tricksr      s^      ;;=KD"4(I(%(G$W.@$GS8NgK	 ) r$   files*zperform tricks from given file)nargshelpz--python-path.zPaths separated by z to add to the Python path.)defaultr   z
--intervalz	--timeouttimeoutg      ?z?Use this as the polling interval/blocking timeout (in seconds).)rD   r   r(   r   z--recursive
store_trueTz-Recursively monitor paths (defaults to True).)rB   r   r   z--debug-force-pollingz[debug] Forces polling.)rB   r   z--debug-force-kqueuez[debug] Forces BSD kqueue(2).z--debug-force-winapiz[debug] Forces Windows API.z--debug-force-fseventsz[debug] Forces macOS FSEvents.z--debug-force-inotifyz [debug] Forces Linux inotify(7).)rJ   c                r   U R                   (       a	  SSKJn  UnOU R                  (       a	  SSKJn  UnO[        (       d  U R                  (       d%  [        (       a#  [        R                  " 5       (       a	  SSK
Jn  UnO<U R                  (       a	  SSKJn  UnO"U R                  (       a	  SSKJn  UnOSSKJn  Un[)        [+        U R,                  5      5        / nU R.                   GH3  n	U" U R0                  S9n
[2        R4                  R7                  U	5      (       d=  [9        [:        R<                  [2        R>                  " [:        R<                  5      U	5      e[A        U	5      n U[B           n[F        U;   a  [)        U[F           5        [2        R4                  RI                  U	5      =(       d2    [2        R4                  RK                  [2        RL                  " 5       5      n[O        XXRP                  S9  U
RS                  5         URU                  U
5        GM6       [V        RX                  " S5        M  ! [D         a   nS	[B        < S
U	< S3n[E        U5      UeSnAff = f! [Z         a,    U H#  nUR]                  5         UR_                  5         M%      Of = fU H  nURa                  5         M     g)z;Command to execute tricks from a tricks configuration file.r   PollingObserverKqueueObserverWindowsApiObserverInotifyObserverFSEventsObserverObserverr   zNo z key specified in r   Nr   rV   )1debug_force_pollingwatchdog.observers.pollingr   debug_force_kqueuewatchdog.observers.kqueuer   r   debug_force_winapir   
is_windows)watchdog.observers.read_directory_changesr   debug_force_inotifywatchdog.observers.inotifyr   debug_force_fseventswatchdog.observers.fseventsr   watchdog.observersr   rr   rj   python_pathr   r   osrn   existsOSErrorerrnoENOENTstrerrorr{   CONFIG_KEY_TRICKSKeyErrorCONFIG_KEY_PYTHON_PATHdirnamerelpathgetcwdr   r   r   appendr   r   r
   unschedule_allr   r   )r   r   observer_clsr   r   r   r   r   	observerstricks_filer   configr   eerrordir_pathos                    r"   tricks_fromr      s   b >&		 	 <%m 7 7]]xObObOdOdP)		!	!>&		"	"@' 	0Jt//01Izz5ww~~k**%,,ELL(A;OO[)	)-.F
 "V+F#9:;77??;/O277??299;3O(nnM") ",JJqM   	)+..@qQE5/q(	) ! AFFH  	 s*   (	H9 I& 9
I#II#&3JJtrick_pathsz5Dotted paths for all the tricks you want to generate.z--append-to-filez
                   Appends the generated tricks YAML to a file.
                   If not specified, prints to standard output.z-az--append-onlyappend_onlyz
                   If --append-to-file is not specified, produces output for
                   appending instead of a complete tricks YAML file.)rD   rB   r   zgenerate-tricks-yamlc                   SSK n[        U R                  5      n[        U5        [	        5       nU R
                   H-  n[        U5      nUR                  UR                  5       5        M/     UR                  5       nUR                  5         UR                  [        U05      nU[         S3-  nU R                  c5  U R                  (       d  Xv-   n[         R"                  R                  U5        g[$        R&                  R)                  U R                  5      (       d  Xv-   n[+        U R                  SSS9 nUR                  U5        SSS5        g! , (       d  f       g= f)zLCommand to generate Yaml configuration for tricks named on the command line.r   Nz:
azutf-8)encoding)ru   rj   r   rr   r   r   r   writegenerate_yamlgetvalueclosedumpr   r   append_to_filer   rm   stdoutr   rn   r   rv   )	r   ru   python_pathsoutput
trick_pathr   contentheaderfiles	            r"   tricks_generate_yamlr   H  s   B d../LL!ZF&&
z*	Y,,./ ' ooG
LLNYY.=>F
"#3''F"&G

!ww~~d1122&G$%%sW=JJw >==s   8E
E!directoriesz%Directories to watch. (default: '.').)r   r   r   z-pz	--patternz
--patternsr   z9Matches event paths with these patterns (separated by ;).)rD   r   r   z-iz--ignore-patternz--ignore-patternsr   rO   z9Ignores event paths with these patterns (separated by ;).z-Dz--ignore-directoriesignore_directorieszIgnores events for directories.z-Rz%Monitors the directories recursively.z2Use this as the polling interval/blocking timeout.c                J   SSK Jn  [        U R                  U R                  5      u  p#U" UUU R
                  S9nU R                  (       a	  SSKJn  UnOU R                  (       a	  SSK
Jn  UnO[        (       d  U R                  (       d%  [        (       a#  [        R                  " 5       (       a	  SSKJn  UnO<U R$                  (       a	  SSKJn	  U	nO"U R*                  (       a	  SSKJn
  U
nOSS	KJn  UnU" U R4                  S
9n[7        XU R8                  U R:                  S9  g)z1Command to log file system events to the console.r   )LoggerTrick)r   r   r   r   r   r   r   r   r   r   r   N)watchdog.tricksr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   r   s                r"   logr     s    N , .t}}d>R>R SH'22G >&		 	 <%m 7 7]]xObObOdOdP)		!	!>&		"	"@' 	0DLL1HD$4$4Or$   zDirectories to watch.z-cz	--commandrd   am  
    Shell command executed in response to matching events.
    These interpolation variables are available to your command string:

        ${watch_src_path}   - event source path
        ${watch_dest_path}  - event destination path (for moved events)
        ${watch_event_type} - event type
        ${watch_object}     - 'file' or 'directory'

    Note:
        Please ensure you do not use double quotes (") to quote
        your command string. That will force your shell to
        interpolate before the command is processed by this
        command.

    Example:

        --command='echo "${watch_src_path}"'
    F)rD   r   rB   r   z-wz--waitwait_for_processzDWait for process to finish to avoid multiple simultaneous instances.z-Wz--dropdrop_during_processzhIgnore events that occur while command is still being executed to avoid multiple simultaneous instances.c           	        SSK Jn  U R                  (       d  SU l        U R                  (       a	  SSKJn  UnOSSKJn  Un[        U R                  U R                  5      u  pVU" U R                  UUU R                  U R                  U R                  S9nU" U R                  S9n[        XU R                   U R"                  S9  g)	zDCommand to execute shell commands in response to file system events.r   )ShellCommandTrickNr   r   )r   r   r   r   r   r   r   )r   r   rd   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )	r   r   r   r   r   r   r   r   r   s	            r"   shell_commandr     s    n 2<< >&/ .t}}d>R>R SH'22.. 44G DLL1HD$4$4Or$   z,Long-running command to run in a subprocess.)r   command_argsargz
    Command arguments.

    Note: Use -- before the command arguments, otherwise watchmedo will
    try to interpret them.
    )metavarr   r   z-dz--directory	DIRECTORYr   zLDirectory to watch. Use another -d or --directory option for each directory.)rD   r   rB   r   z--signalsignalSIGINTz6Stop the subprocess with this signal (default SIGINT).z--kill-after
kill_afterg      $@zYWhen stopping, kill the subprocess after the specified timeout in seconds (default 10.0).z--debounce-intervaldebounce_intervalg        zwAfter a file change, Wait until the specified interval (in seconds) passes with no file changes, and only then restart.z--no-restart-on-command-exitrestart_on_command_exitstore_falsez.Don't auto-restart the command after it exits.c                  ^^ U R                   (       a	  SSKJn  UnOSSKJn  UnSSKmSSKJn  U R                  (       d  S/U l        U R
                  R                  S5      (       a  [        TU R
                  5      O[        U R
                  5      nTR                  TR                  1m[        TS5      (       a  TR                  TR                   5        SUU4S	 jjnT H  nTR                  Xv5        M     [#        U R$                  U R&                  5      u  pU R(                  /n
U
R+                  U R,                  5        U" U
UU	U R.                  UU R0                  U R2                  U R4                  S
9nUR7                  5         U" U R8                  S9n [;        XU R                  U R<                  S9  URA                  5         g! [>         a     Nf = f! URA                  5         f = f)zLCommand to start a long-running subprocess and restart it on matched events.r   r   r   N)AutoRestartTrickr   SIGSIGHUPc                Z   > T H  nTR                  UTR                  5        M!     [        e)N)r   SIG_IGNr
   )_signum_framesignumr   termination_signalss      r"   handler_termination_signal0auto_restart.<locals>.handler_termination_signal  s%    )FMM&&..1 *##r$   )r   r   r   stop_signalr   debounce_interval_secondsr   r   r   )r  zsignal._SIGNUMr  objectr5   r6   )!r   r   r   r   r   r   r   r   r   
startswithr   r4   SIGTERMr   hasattraddr   r   r   r   rd   extendr   r   r   r   r   r   r   r   r   r
   r   )r   r   r   r   r   r  r  r  r   r   rd   r   r   r   r  s                @@r"   auto_restartr  g  s   ~ >&/05 37++2H2H2O2O'&$++.UXY]YdYdUeK ">>6==9vx  .$ $ &f9 & !/t}}d>R>R SH||nGNN4$$%'22??"&"8"8 $ < <	G MMODLL1HX(8(8DNNS 	 !  	s$   G
 

GG GG G,c                      \ rS rSrSrg)LogLevelErrori   r3   N)r)   r9   r:   r;   r=   r3   r$   r"   r  r     s    r$   r  c                    [        U R                  =(       d    / 5      nUS:  a  Sn[        U5      eUS:  a  Sn[        U5      e/ SQSU-      $ )NrT   z&-q/--quiet may be specified only once.   z,-v/--verbose may be specified up to 2 times.)ERRORWARNINGINFODEBUGrV   )sumrR   r  )r   rR   r   s      r"   _get_log_level_from_argsr    sR    DNN(b)I2~8E""1}>E""0Y??r$   c                    [         R                  5       n U R                  c  [         R                  5         g [	        U 5      n[        R                  " S5      R                  U5         U R                  U 5        g! [
         aS  n[        SUR                  S    3[        R                  S9  [        U R                     R                  5          SnAgSnAff = f! [         a     gf = f)zEntry-point function.NrV   zError: r   )r   watchdog   )cli
parse_argsrC   
print_helpr  r  printr   rm   stderrrZ   logging	getLoggersetLevelrW   KeyboardInterrupt)r   	log_levelexcs      r"   mainr)    s    >>D,T2	
 j!**95		$   }%CJJ7(()446  s*   A; )C ;
CA	CC
C('C(__main__)rG   r7   r    r	   r5   Argument)r   zlist[Argument]rI   z!_SubParsersAction[ArgumentParser]rJ   zlist[str] | Noner5   r   )ri   r7   re   r7   r5   r8   )rp   r8   rk   r4   r5   r6   )ry   r7   r5   dict)r~   r7   r   r7   re   r7   r5   ztuple[list[str], list[str]])
r   r   r   r   rp   r8   r   boolr5   r6   )
r   r   r   z
list[dict]rq   r7   r   r-  r5   r6   )r   r   r5   r6   )r   r   r5   r7   )r5   r4   )Fr<   
__future__r   r   r#  r   os.pathrm   r   argparser   r   ior   textwrapr   typingr   r	   watchdog.utilsr
   r   r   watchdog.versionr   r   r   r   watchdog.eventsr   r   r   watchdog.observers.apir   basicConfigr  r   r   r   r?   r  r\   add_subparsers
subparsersrZ   tuplerF   r7   r+  rH   rd   pathseprj   rr   r{   r   r   r   floatr   r   r   r   r  	Exceptionr  r  r)  r)   exitr3   r$   r"   <module>r@     s   #   	  
  @   % F F +56/3   ',, ' & !/ !.
4 FMB   Y  G]3
cC ' 1;$(	
 . "	
 > 8:zz * ;< 
)( HK
%
%.1
%AD
% 
%) 
  
:L* 	*JK&rzzn4OP	

 	R	
 	@		
 	(D]^"0	

 	".	

 	$1	

 	#3	
K*V 
Y-\>]-\>B 	H	

 	&rzzn4OP	

 	C	
 	H	
%8 ((;> ?> : 	8		
 	L	
 	"L	
 	"%2	
 	8	
 	E	
 	(D]^"0	

 	".	

 	$1	

 	#3	
{BDJ(PKDJ(PV 	c3=TU	
2 	L	
 	"L	
 	"%2	
 	8	
 	E	
 	#W	
 	&B	
 	(D]^cRTjPkTjP< 	!OP	
	
 	_	
 	L	
 	"L	
 	"%2	
 	8	
 	E	
 	I		
 	(D]^l	
 	!$K	
 	** A	
eY[x:y[x:z	I 	@. zHHTV r$   