§
    xÅjlc  ã                  óê  — d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	m
Z
m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 dd	lmZ er dd
l	mZmZ ddlmZ ddlmZ ddlmZ ddl m!Z!  ej"        ej#        ¬¦  «         dZ$dZ% G d„ de¦  «        Z&dZ' e
e'e&¬¦  «        Z(e( )                    dde¬¦  «         e( *                    d¬¦  «        Z+i Z,e-e.e/         ef         Z0d¾d!„Z1e+dd"œd¿d*„Z2ej3        d+œdÀd/„Z4dd0œdÁd5„Z5dÂd8„Z6d9d+œdÃd=„Z7dÄdD„Z8dÅdG„Z9 e2 e1dHdIdJ¬K¦  «         e1dLdMdNej3        ›dO�¬P¦  «         e1dQdRdSdTe:dU¬V¦  «         e1dWdXdYdZ¬[¦  «         e1d\dXd]¬^¦  «         e1d_dXd`¬^¦  «         e1dadXdb¬^¦  «         e1dcdXdd¬^¦  «         e1dedXdf¬^¦  «        g	dg¬g¦  «        dÆdi„¦   «         Z; e2 e1djdIdk¬K¦  «         e1dLdMdNej3        ›dO�¬P¦  «         e1dlddm¬P¦  «         e1dndodpdXdq¬r¦  «        gdsg¬g¦  «        dÆdt„¦   «         Z< e2 e1dudIdMdv¬w¦  «         e1dxdydzd{dId|¬}¦  «         e1d~dd€d�d‚dƒ¬}¦  «         e1d„d…d†dXd‡¬r¦  «         e1dˆdWdBdXd‰¬r¦  «         e1dQdRdSdTe:dŠ¬V¦  «         e1d\dXd]¬^¦  «         e1d_dXd`¬^¦  «         e1dadXdb¬^¦  «         e1dcdXdd¬^¦  «         e1dedXdf¬^¦  «        g¦  «        dÆd‹„¦   «         Z= e2 e1dudIdMdŒ¬w¦  «         e1d�dŽd�dd�¬}¦  «         e1dxdydzd{dId|¬}¦  «         e1d~dd€d�d‚dƒ¬}¦  «         e1d„d…d†d‘dXd‡¬’¦  «         e1dˆdWdBdXd‰¬r¦  «         e1dQdRdSdTe:dŠ¬V¦  «         e1d“d”d•dXd–¬r¦  «         e1d—d˜d™dXdš¬r¦  «         e1d\dXd]¬^¦  «        g
¦  «        dÆd›„¦   «         Z> e2 e1d�dœ¬�¦  «         e1dždŸdId ¬¡¦  «         e1d¢d£dud¤d¥d¦¬§¦  «         e1dxdydzd{dId|¬}¦  «         e1d~dd€d�d‚dƒ¬}¦  «         e1d„d…d†d‘dXd‡¬’¦  «         e1dˆdWdBdXd‰¬r¦  «         e1dQdRdSdTe:dŠ¬V¦  «         e1d¨d©dªd«¬}¦  «         e1d\dXd]¬^¦  «         e1d¬d­d®e:d¯¬V¦  «         e1d°d±d²e:d³¬V¦  «         e1d´dµdYd¶d·¬’¦  «        g¦  «        dÆd¸„¦   «         Z? G d¹„ dºe@¦  «        ZAdÇd»„ZBdÈd¼„ZCeDd½k    r ejE         eC¦   «         ¦  «         dS dS )É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                  ó:   ‡ — e Zd ZdZddœdˆ fd„Zdd„Zdd„Zˆ xZS )ÚHelpFormattera#  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_positionÚargsr	   r   ÚintÚkwargsÚreturnÚNonec               óD   •— ||d<    t          ¦   «         j        |i |¤Ž d S )Nr   )ÚsuperÚ__init__)Úselfr   r   r   Ú	__class__s       €úCC:\Projects\Historical\venv\Lib\site-packages\watchdog/watchmedo.pyr!   zHelpFormatter.__init__0   s0   ø€ à&7ˆÐ"Ñ#Ø�‰ŒÔ˜$Ð) &Ð)Ð)Ð)Ð)Ð)ó    Ústrc                ó2   — dt          | ¦  «        j        › d�S )Nú<ú>)ÚtypeÚ__name__)r"   s    r$   Ú__repr__zHelpFormatter.__repr__5   s   € Ø)•4˜‘:”:Ô&Ð)Ð)Ð)Ð)r%   ÚtextÚwidthú	list[str]c                ór   — t          |¦  «                             ¦   «         dz   }|                     ¦   «         S )Nz

)r   ÚstripÚ
splitlines)r"   r-   r.   s      r$   Ú_split_lineszHelpFormatter._split_lines8   s.   € Ý�d‰|Œ|×!Ò!Ñ#Ô# fÑ,ˆØ�ŠÑ Ô Ð r%   )r   r	   r   r   r   r	   r   r   )r   r&   )r-   r&   r.   r   r   r/   )r+   Ú
__module__Ú__qualname__Ú__doc__r!   r,   r3   Ú__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)Úactionr:   Útop_command)ÚdestÚname_or_flagsr&   r   r	   r   ÚArgumentc                 ó$   — t          | ¦  «        |fS )z\Convenience function to properly format arguments to pass to the
    command decorator.
    )Úlist)r>   r   s     r$   ÚargumentrB   N   s   € õ �ÑÔ Ð&Ð&r%   )ÚparentÚcmd_aliasesr   úlist[Argument]rC   ú!_SubParsersAction[ArgumentParser]rD   úlist[str] | Noner   c               ó   ‡ ‡‡— dˆ ˆˆfd„}|S )a
  Decorator 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)

    Úfuncr   r   c                ó¤  •— | j                              dd¦  «        }t          | j        pd¦  «        }‰	                     |‰pg |t
          ¬¦  «        }|t          |<   |                     ¦   «         }|                     ddddd	¬
¦  «         |                     ddddd¬
¦  «         ‰D ](\  }} |j        |i |¤Ž | 	                    | ¬¦  «         Œ)| S )NÚ_ú-Ú )ÚaliasesÚdescriptionr9   z-qz--quietÚ	verbosityÚappend_constéÿÿÿÿ)r=   r;   Úconstz-vz	--verboseé   )rI   )
r+   Úreplacer   r6   Ú
add_parserr   Úcommand_parsersÚadd_mutually_exclusive_groupÚadd_argumentÚset_defaults)
rI   ÚnameÚdescÚparserÚverbosity_groupr>   r   r   rD   rC   s
          €€€r$   Ú	decoratorzcommand.<locals>.decoratord   sø   ø€ ØŒ}×$Ò$ S¨#Ñ.Ô.ˆÝ�d”lÐ( bÑ)Ô)ˆØ×"Ò" 4°Ð1BÀÐPTÕfsÐ"ÑtÔtˆØ &�˜ÑØ ×=Ò=Ñ?Ô?ˆØ×$Ò$ T¨9¸;È~ÐegÐ$ÑhÔhÐhØ×$Ò$ T¨;¸[ÐQ_ÐghÐ$ÑiÔiÐiØ%)ð 	+ð 	+Ñ!ˆM˜6ØˆFÔ Ð9°&Ð9Ð9Ð9Ø×Ò TÐÑ*Ô*Ð*Ð*Øˆr%   )rI   r   r   r   © )r   rC   rD   r_   s   ``` r$   Úcommandra   U   s5   øøø€ ðð ð ð ð ð ð ð ð Ðr%   )Ú	separatorÚpathname_specrb   r/   c               ó,   — |                       |¦  «        S )zêSplits 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)rc   rb   s     r$   Ú
path_splitrg   t   s   € ð ×Ò˜yÑ)Ô)Ð)r%   )ÚindexÚ	pathnamesrh   r   r   c               ób   — | ddd…         D ]"}t           j                             ||¦  «         Œ#dS )zòAdds 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.
    NrR   )ÚsysÚpathÚinsert)ri   rh   Úpathnames      r$   Úadd_to_sys_pathro      s@   € ð ˜d˜d ˜d”Oð )ð )ˆÝŒ�Š˜˜xÑ(Ô(Ð(Ð(ð)ð )r%   Útricks_file_pathnameÚdictc                ó¬   — ddl }t          | d¦  «        5 }|                     |                     ¦   «         ¦  «        cddd¦  «         S # 1 swxY w Y   dS )zÌLoads 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)rp   rt   Úfs      r$   Úload_configry   Œ   s–   € ð €K€K€Kå	Ð" DÑ	)Ô	)ð (¨QØ�~Š~˜aŸfšf™hœhÑ'Ô'ð(ð (ð (ð (ñ (ô (ð (ð (ð (ð (ð (ð (øøøð (ð (ð (ð (ð (ð (s   •'A	Á	AÁAú;Úpatterns_specÚignore_patterns_specútuple[list[str], list[str]]c               óp   — |                       |¦  «        }|                      |¦  «        }|dgk    rg }||fS )z^Parses pattern argument specs and returns a two-tuple of
    (patterns, ignore_patterns).
    rM   re   )r{   r|   rb   ÚpatternsÚignore_patternss        r$   Úparse_patternsr�   š   sG   € ð ×"Ò" 9Ñ-Ô-€HØ*×0Ò0°Ñ;Ô;€OØ˜2˜$ÒÐØˆØ�_Ð$Ð$r%   Úobserverr   Úevent_handlerr   Ú	recursiveÚboolc               ó   — t          |¦  «        D ]}|                      |||¬¦  «         Œ|                      ¦   «          	 	 t          j        d¦  «         Œ# t
          $ r |                      ¦   «          Y nw xY w|                      ¦   «          dS )ag  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„   TrT   N)ÚsetÚscheduleÚstartÚtimeÚsleepr
   ÚstopÚjoin)r‚   rƒ   ri   r„   rn   s        r$   Úobserve_withr�   §   s¢   € õ$ ˜	‘N”Nð Hð HˆØ×Ò˜-¨¸YÐÑGÔGÐGÐGØ‡N‚NÑÔÐðð	ÝŒJ�q‰MŒMˆMð	øå ð ð ð Ø�Š‰Œˆˆˆðøøøà‡M‚M�O„O€O€O€Os   Á A ÁA7Á6A7ú
list[dict]rn   c               óÈ   — |D ]^}|                      ¦   «         D ]G\  }}t          |¦  «        } |di |¤Ž}t          |dd¦  «        p|}	|                      ||	|¬¦  «         ŒHŒ_dS )aj  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‡   r`   )Úitemsr   Úgetattrr‰   )
r‚   r   rn   r„   Útrickr[   ÚvalueÚ	trick_clsÚhandlerÚtrick_pathnames
             r$   Úschedule_tricksrš   Ä   s›   € ð ð Lð LˆØ Ÿ;š;™=œ=ð 	Lð 	L‰KˆD�%Ý" 4Ñ(Ô(ˆIØ�iÐ(Ð( %Ð(Ð(ˆGÝ$ WÐ.@À$ÑGÔGÐSÈ8ˆNØ×Ò˜g ~ÀÐÑKÔKÐKÐKð		LðLð L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).)r=   r    r*   rž   z--recursiveÚ
store_trueTz-Recursively monitor paths (defaults to True).)r;   r    rž   z--debug-force-pollingz[debug] Forces polling.)r;   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).)rD   r   c                ó   — | j         r	ddlm} |}ni| j        r	ddlm} |}nYt          s| j        st          rt          j	        ¦   «         r	ddl
m} |}n(| j        r	ddlm} |}n| j        r	ddlm} |}nddlm} |}t)          t+          | j        ¦  «        ¦  «         g }| j        D �]k}	 || j        ¬¦  «        }
t2          j                             |	¦  «        s7t9          t:          j        t3          j        t:          j        ¦  «        |	¦  «        ‚tA          |	¦  «        }	 |tB                   }n0# tD          $ r#}d	tB          ›d
|	›d�}tE          |¦  «        |‚d}~ww xY wtF          |v rt)          |tF                   ¦  «         t2          j         $                    |	¦  «        p/t2          j         %                    t3          j&        ¦   «         ¦  «        }tO          |
||| j(        ¬¦  «         |
 )                    ¦   «          | *                    |
¦  «         �Œm	 	 tW          j,        d¦  «         Œ# tZ          $ r0 |D ]*}| .                    ¦   «          | /                    ¦   «          Œ+Y nw xY w|D ]}| 0                    ¦   «          ŒdS )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‡   TrT   )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¯   ro   rg   Úpython_pathr›   r¡   Úosrl   ÚexistsÚOSErrorÚerrnoÚENOENTÚstrerrorry   Ú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 Ôð  Ø>Ð>Ð>Ð>Ð>Ð>à&ˆˆØ	Ô	 ð  Ø<Ð<Ð<Ð<Ð<Ð<à%ˆˆÝð   Ô 7ð  ½]ð  ÍxÔObÑOdÔOdð  ØPÐPÐPÐPÐPÐPà)ˆˆØ	Ô	!ð  Ø>Ð>Ð>Ð>Ð>Ð>à&ˆˆØ	Ô	"ð 	 Ø@Ð@Ð@Ð@Ð@Ð@à'ˆˆð 	0Ð/Ð/Ð/Ð/Ð/àˆå•J˜tÔ/Ñ0Ô0Ñ1Ô1Ð1Ø€IØ”zð #ñ #ˆØ�<¨¬Ð5Ñ5Ô5ˆåŒw�~Š~˜kÑ*Ô*ð 	PÝ�%œ,­¬µE´LÑ(AÔ(AÀ;ÑOÔOÐOå˜[Ñ)Ô)ˆð	)ØÕ-Ô.ˆFˆFøÝð 	)ð 	)ð 	)ØQÕ+ÐQÐQÀÐQÐQÐQˆEÝ˜5‘/”/ qÐ(øøøøð	)øøøõ " VÐ+Ð+Ý˜FÕ#9Ô:Ñ;Ô;Ð;å”7—?’? ;Ñ/Ô/ÐOµ2´7·?²?Å2Ä9Á;Ä;Ñ3OÔ3OˆÝ˜ &¨(¸d¼nÐMÑMÔMÐMØ�ŠÑÔÐØ×Ò˜Ñ"Ô"Ð"Ñ"ðð	ÝŒJ�q‰MŒMˆMð	øå ð ð ð Øð 	ð 	ˆAØ×ÒÑÔÐØ�FŠF‰HŒHˆHˆHð	ð 	ðøøøð ð ð ˆØ	�Š‰Œˆˆðð s*   ÄD,Ä,
EÄ6EÅEÈH( È(7I"É!I"Ú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.)r=   r;   rž   zgenerate-tricks-yamlc                óÖ  — ddl }t          | j        ¦  «        }t          |¦  «         t	          ¦   «         }| j        D ]8}t          |¦  «        }|                     |                     ¦   «         ¦  «         Œ9| 	                    ¦   «         }| 
                    ¦   «          |                     t          |i¦  «        }|t          › d�z  }| j        €-| j        s||z   }t           j                             |¦  «         dS t$          j                             | j        ¦  «        s||z   }t+          | j        dd¬¦  «        5 }|                     |¦  «         ddd¦  «         dS # 1 swxY w Y   dS )zLCommand to generate Yaml configuration for tricks named on the command line.r   Nz:
Úazutf-8)Úencoding)rt   rg   r½   ro   r   rÕ   r   ÚwriteÚgenerate_yamlÚgetvalueÚcloseÚdumprÆ   rÄ   Úappend_to_filerÖ   rk   Ústdoutr¾   rl   r¿   ru   )	r   rt   Úpython_pathsÚoutputÚ
trick_pathr—   ÚcontentÚheaderÚfiles	            r$   Útricks_generate_yamlrç   H  s¤  € ðB €K€K€Kå˜dÔ.Ñ/Ô/€LÝ�LÑ!Ô!Ð!Ý‰ZŒZ€FàÔ&ð 0ð 0ˆ
Ý˜zÑ*Ô*ˆ	Ø�Š�Y×,Ò,Ñ.Ô.Ñ/Ô/Ð/Ð/à�oŠoÑÔ€GØ
‡L‚L�N„N€Nà�YŠYÕ.°Ð=Ñ>Ô>€FØ
Õ"Ð'Ð'Ð'Ñ'€FØÔÐ"àÔð 	'Ø˜wÑ&ˆGÝŒ
×Ò˜Ñ!Ô!Ð!Ð!Ð!åŒw�~Š~˜dÔ1Ñ2Ô2ð 	'Ø˜wÑ&ˆGÝ�$Ô% s°WÐ=Ñ=Ô=ð 	 ÀØ�JŠJ�wÑÔÐð	 ð 	 ð 	 ñ 	 ô 	 ð 	 ð 	 ð 	 ð 	 ð 	 ð 	 ð 	 øøøð 	 ð 	 ð 	 ð 	 ð 	 ð 	 s   Ä;EÅE"Å%E"Údirectoriesz%Directories to watch. (default: '.').)r�   r    rž   z-pz	--patternz
--patternsr   z9Matches event paths with these patterns (separated by ;).)r=   r    rž   z-iz--ignore-patternz--ignore-patternsr€   rM   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                óÀ  — ddl m} t          | j        | j        ¦  «        \  }} |||| j        ¬¦  «        }| j        r	ddlm} |}ni| j	        r	ddl
m} |}nYt          s| j        st          rt          j        ¦   «         r	ddlm} |}n(| j        r	ddlm}	 |	}n| j        r	ddlm}
 |
}ndd	lm} |} || j        ¬
¦  «        }t7          ||| j        | j        ¬¦  «         dS )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í   „  su  € ðN ,Ð+Ð+Ð+Ð+Ð+å .¨t¬}¸dÔ>RÑ SÔ SÑ€HˆoØˆkØØ'ØÔ2ðñ ô €Gð Ôð  Ø>Ð>Ð>Ð>Ð>Ð>à&ˆˆØ	Ô	 ð  Ø<Ð<Ð<Ð<Ð<Ð<à%ˆˆÝð   Ô 7ð  ½]ð  ÍxÔObÑOdÔOdð  ØPÐPÐPÐPÐPÐPà)ˆˆØ	Ô	!ð  Ø>Ð>Ð>Ð>Ð>Ð>à&ˆˆØ	Ô	"ð 	 Ø@Ð@Ð@Ð@Ð@Ð@à'ˆˆð 	0Ð/Ð/Ð/Ð/Ð/àˆàˆ| D¤LÐ1Ñ1Ô1€HÝ�˜7 DÔ$4ÀÄÐOÑOÔOÐOÐOÐOr%   zDirectories to watch.z-cz	--commandra   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)r=   r    r;   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                ó>  — ddl m} | j        sd| _        | j        r	ddlm} |}nddlm} |}t          | j	        | j
        ¦  «        \  }} || j        ||| j        | j        | j        ¬¦  «        } || j        ¬¦  «        }t          ||| j        | j        ¬¦  «         dS )	zDCommand to execute shell commands in response to file system events.r   )ÚShellCommandTrickNr¤   r®   )r   r€   ré   rî   rï   r°   r‡   )rì   rñ   ra   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Ð1Ð1Ð1Ð1Ð1àŒ<ð ØˆŒð Ôð  Ø>Ð>Ð>Ð>Ð>Ð>à&ˆˆà/Ð/Ð/Ð/Ð/Ð/àˆå .¨t¬}¸dÔ>RÑ SÔ SÑ€HˆoØÐØŒØØ'ØÔ2ØÔ.Ø Ô4ðñ ô €Gð ˆ| D¤LÐ1Ñ1Ô1€HÝ�˜7 DÔ$4ÀÄÐOÑOÔOÐOÐOÐ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.)r=   rõ   r;   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           
     ót  ‡‡— | j         r	ddlm} |}nddlm} |}ddlŠddlm} | j        sdg| _        | j         	                    d¦  «        rt          ‰| j        ¦  «        nt          | j        ¦  «        }‰j        ‰j        hŠt          ‰d¦  «        r‰                     ‰j        ¦  «         dˆˆfd„}‰D ]}‰                     ||¦  «         Œt#          | j        | j        ¦  «        \  }}	| j        g}
|
                     | j        ¦  «          ||
||	| j        || j        | j        | j        ¬¦  «        }|                     ¦   «           || j        ¬¦  «        }	 t;          ||| j        | j        ¬¦  «         n# t>          $ r Y nw xY w|                      ¦   «          dS # |                      ¦   «          w xY w)zLCommand to start a long-running subprocess and restart it on matched events.r   r¤   r®   N)ÚAutoRestartTrickrŸ   ÚSIGÚSIGHUPÚ_signumúsignal._SIGNUMÚ_frameÚobjectr   r   c                óR   •— ‰D ]}‰                      |‰j        ¦  «         Œt          ‚)N)r÷   ÚSIG_IGNr
   )r  r  Úsignumr÷   Útermination_signalss      €€r$   Úhandler_termination_signalz0auto_restart.<locals>.handler_termination_signalà  s1   ø€ à)ð 	2ð 	2ˆFØ�MŠM˜& &¤.Ñ1Ô1Ð1Ð1Ý#Ð#r%   )r   r€   ré   Ústop_signalrù   Údebounce_interval_secondsrû   r°   r‡   )r  r  r  r  r   r   )!r±   r²   r¥   r¼   r¯   r÷   rì   rþ   rè   Ú
startswithr”   r   ÚSIGTERMrø   ÚhasattrÚaddr   r�   r   r€   ra   Úextendró   ré   rù   rú   rû   rŠ   r¡   r�   r„   r
   r�   )r   r¥   rÌ   r¯   rþ   r
  r	  r  r   r€   ra   r˜   r‚   r÷   r  s                @@r$   Úauto_restartr  g  s.  øø€ ð~ Ôð  Ø>Ð>Ð>Ð>Ð>Ð>à&ˆˆà/Ð/Ð/Ð/Ð/Ð/àˆà€M€M€Mà0Ð0Ð0Ð0Ð0Ð0àÔð !Ø˜5ˆÔð 37´+×2HÒ2HÈÑ2OÔ2OÐe•'˜& $¤+Ñ.Ô.Ð.ÕUXÐY]ÔYdÑUeÔUe€Kð "œ>¨6¬=Ð9Ðåˆv�xÑ Ô ð /Ø×Ò ¤Ñ.Ô.Ð.ð$ð $ð $ð $ð $ð $ð $ð &ð :ð :ˆØ�Š�fÐ8Ñ9Ô9Ð9Ð9å .¨t¬}¸dÔ>RÑ SÔ SÑ€HˆoØŒ|ˆn€GØ‡N‚N�4Ô$Ñ%Ô%Ð%ØÐØØØ'ØÔ2ØØ”?Ø"&Ô"8Ø $Ô <ð	ñ 	ô 	€Gð ‡M‚M�O„O€OØˆ| D¤LÐ1Ñ1Ô1€HðÝ�X˜w¨Ô(8ÀDÄNÐSÑSÔSÐSÐSøÝ ð ð ð Øˆðøøøð 	�Š‰Œˆˆˆøˆ�Š‰Œˆˆøøøs*   ÅE; Å:F! Å;
FÆF! ÆFÆF! Æ!F7c                  ó   — e Zd ZdS )ÚLogLevelErrorN)r+   r4   r5   r`   r%   r$   r  r     s   € € € € € Ø€Dr%   r  c                ó¤   — t          | j        pg ¦  «        }|dk     rd}t          |¦  «        ‚|dk    rd}t          |¦  «        ‚g d¢d|z            S )NrR   z&-q/--quiet may be specified only once.é   z,-v/--verbose may be specified up to 2 times.)ÚERRORÚWARNINGÚINFOÚDEBUGrT   )ÚsumrP   r  )r   rP   rÑ   s      r$   Ú_get_log_level_from_argsr    sc   € Ý�D”NÐ( bÑ)Ô)€IØ�2‚~€~Ø8ˆÝ˜EÑ"Ô"Ð"Ø�1‚}€}Ø>ˆÝ˜EÑ"Ô"Ð"Ø0Ð0Ð0°°Y±Ô?Ð?r%   c                 ó  — t                                ¦   «         } | j        €t                                ¦   «          dS 	 t	          | ¦  «        }ne# t
          $ rX}t          d|j        d         › �t          j	        ¬¦  «         t          | j                                      ¦   «          Y d}~dS d}~ww xY wt          j        d¦  «                             |¦  «         	 |                      | ¦  «         n# t          $ r Y dS w xY wdS )zEntry-point function.NrT   zError: r   )ræ   Úwatchdogé‚   )ÚcliÚ
parse_argsr<   Ú
print_helpr  r  Úprintr   rk   ÚstderrrW   ÚloggingÚ	getLoggerÚsetLevelrI   ÚKeyboardInterrupt)r   Ú	log_levelÚexcs      r$   Úmainr*    s  € å�>Š>ÑÔ€DØÔÐÝ�ŠÑÔÐØˆqðÝ,¨TÑ2Ô2ˆ	ˆ	øÝð ð ð ÝÐ%˜œ œÐ%Ð%­C¬JÐ7Ñ7Ô7Ð7Ý˜Ô(Ô)×4Ò4Ñ6Ô6Ð6Øˆqˆqˆqˆqˆqøøøøðøøøõ Ô�jÑ!Ô!×*Ò*¨9Ñ5Ô5Ð5ðØ�	Š	�$‰ŒˆˆøÝð ð ð Øˆsˆsðøøøð ˆ1s*   ½A Á
B/ÁAB*Â*B/ÃC0 Ã0
C>Ã=C>Ú__main__)r>   r&   r   r	   r   r?   )r   rE   rC   rF   rD   rG   r   r   )rc   r&   rb   r&   r   r/   )ri   r/   rh   r   r   r   )rp   r&   r   rq   )r{   r&   r|   r&   rb   r&   r   r}   )
r‚   r   rƒ   r   ri   r/   r„   r…   r   r   )
r‚   r   r   r�   rn   r&   r„   r…   r   r   )r   r   r   r   )r   r   r   r&   )r   r   )Fr6   Ú
__future__r   rÁ   r$  r¾   Úos.pathrk   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   r8   r  rY   Úadd_subparsersÚ
subparsersrW   ÚtuplerA   r&   r?   rB   ra   Úpathseprg   ro   ry   r�   r�   rš   ÚfloatrÔ   rç   rí   rò   r  Ú	Exceptionr  r  r*  r+   Úexitr`   r%   r$   ú<module>r>     s  ððð ð #Ð "Ð "Ð "Ð "Ð "à €€€Ø €€€Ø 	€	€	€	Ø €€€Ø 
€
€
€
Ø €€€Ø @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø %Ð %Ð %Ð %Ð %Ð %Ð %Ð %à FÐ FÐ FÐ FÐ FÐ FÐ FÐ FÐ FÐ FØ +Ð +Ð +Ð +Ð +Ð +àð 4Ø5Ð5Ð5Ð5Ð5Ð5Ð5Ð5ØÐÐÐÐÐà6Ð6Ð6Ð6Ð6Ð6Ø/Ð/Ð/Ð/Ð/Ð/Ø3Ð3Ð3Ð3Ð3Ð3ð €Ô ˜'œ,Ð 'Ñ 'Ô 'Ð 'àÐ Ø&Ð ð!ð !ð !ð !ð !Ð/ñ !ô !ð !ð.
4€ð €n˜F°MÐBÑBÔB€Ø × Ò � Y¸Ð Ñ GÔ GÐ GØ×Ò ]ÐÑ3Ô3€
Ø€à��c”˜C�Ô €ð'ð 'ð 'ð 'ð 1;Ø$(ð	ð ð ð ð ð ð> 8:´zð *ð *ð *ð *ð *ð *ð ;<ð 
)ð 
)ð 
)ð 
)ð 
)ð 
)ð(ð (ð (ð (ð HKð
%ð 
%ð 
%ð 
%ð 
%ð 
%ðð ð ð ð:Lð Lð Lð Lð* 	€àˆ� Ð*JÐKÑKÔKØˆØØØP r¤zÐPÐPÐPð	
ñ 	
ô 	
ð
 	ˆØØØØØØRð	
ñ 	
ô 	
ð 	ˆØØØØ@ð		
ñ 	
ô 	
ð 	ˆÐ(°ÐD]Ð^Ñ^Ô^ØˆØ"ØØ0ð	
ñ 	
ô 	
ð
 	ˆØ"ØØ.ð	
ñ 	
ô 	
ð
 	ˆØ$ØØ1ð	
ñ 	
ô 	
ð
 	ˆØ#ØØ3ð	
ñ 	
ô 	
ðK*ðV �
ðY-ñ -ô -ð\>ð >ð >ñ]-ô -ð\>ðB 	€àˆØØØHð	
ñ 	
ô 	
ð
 	ˆØØØP r¤zÐPÐPÐPð	
ñ 	
ô 	
ð
 	ˆØØðCð	
ñ 	
ô 	
ð 	ˆØØØØðHð	
ñ 	
ô 	
ð%ð8 (Ð(ð;ñ ô ð> ð  ð  ñ?ô ð> ð: 	€àˆØØØØ8ð		
ñ 	
ô 	
ð 	ˆØØØØØØLð	
ñ 	
ô 	
ð 	ˆØØØØ"ØØLð	
ñ 	
ô 	
ð 	ˆØØ"Ø%ØØ2ð	
ñ 	
ô 	
ð 	ˆØØØØØ8ð	
ñ 	
ô 	
ð 	ˆØØØØØØEð	
ñ 	
ô 	
ð 	ˆÐ(°ÐD]Ð^Ñ^Ô^ØˆØ"ØØ0ð	
ñ 	
ô 	
ð
 	ˆØ"ØØ.ð	
ñ 	
ô 	
ð
 	ˆØ$ØØ1ð	
ñ 	
ô 	
ð
 	ˆØ#ØØ3ð	
ñ 	
ô 	
ð{BñDô DðJ(Pð (Pð (PñKDô DðJ(PðV 	€àˆ� c°3Ð=TÐUÑUÔUØˆØØØØðð	
ñ 	
ô 	
ð2 	ˆØØØØØØLð	
ñ 	
ô 	
ð 	ˆØØØØ"ØØLð	
ñ 	
ô 	
ð 	ˆØØ"Ø%ØØØ2ð	
ñ 	
ô 	
ð 	ˆØØØØØ8ð	
ñ 	
ô 	
ð 	ˆØØØØØØEð	
ñ 	
ô 	
ð 	ˆØØØ#ØØWð	
ñ 	
ô 	
ð 	ˆØØØ&ØðBð	
ñ 	
ô 	
ð 	ˆÐ(°ÐD]Ð^Ñ^Ô^ðcRñTô TðjPð Pð PñkTô TðjPð< 	€àˆ�Ð!OÐPÑPÔPØˆØØØðð	
	
ñ 
	
ô 
	
ð 	ˆØØØØØØ_ð	
ñ 	
ô 	
ð 	ˆØØØØØØLð	
ñ 	
ô 	
ð 	ˆØØØØ"ØØLð	
ñ 	
ô 	
ð 	ˆØØ"Ø%ØØØ2ð	
ñ 	
ô 	
ð 	ˆØØØØØ8ð	
ñ 	
ô 	
ð 	ˆØØØØØØEð	
ñ 	
ô 	
ð 	ˆØØØØIð		
ñ 	
ô 	
ð 	ˆÐ(°ÐD]Ð^Ñ^Ô^ØˆØØØØØlð	
ñ 	
ô 	
ð 	ˆØ!Ø$ØØðKð	
ñ 	
ô 	
ð 	ˆØ*Ø*ØØ ØAð	
ñ 	
ô 	
ðeYñ[ô [ðx:ð :ð :ñy[ô [ðx:ðz	ð 	ð 	ð 	ð 	�Iñ 	ô 	ð 	ð@ð @ð @ð @ðð ð ð ð. ˆzÒÐØ€C„HˆTˆT‰VŒVÑÔÐÐÐð Ðr%   