§
    é4«j¹  ã                  ó¼   — d Z ddlmZ ddlZddlZddlmZ erddlmZ ddl	m
Z
  G d„ de¦  «        Z G d	„ d
e¦  «        Z G d„ dej        ¦  «        Zdd„Zdd„ZdS )u  :module: watchdog.utils
:synopsis: Utility classes and functions.
:author: yesudeep@google.com (Yesudeep Mangalapilly)
:author: contact@tiger-222.fr (MickaÃ«l Schoentgen)

Classes
-------
.. autoclass:: BaseThread
   :members:
   :show-inheritance:
   :inherited-members:

é    )ÚannotationsN)ÚTYPE_CHECKING)Ú
ModuleType)ÚTrickc                  ó   — e Zd ZdS )ÚUnsupportedLibcErrorN)Ú__name__Ú
__module__Ú__qualname__© ó    úEC:\Projects\DSCons\.venv\Lib\site-packages\watchdog/utils/__init__.pyr   r      s   € € € € € Ø€Dr   r   c                  ó   — e Zd ZdZdS )ÚWatchdogShutdownErrorz=Semantic exception used to signal an external shutdown event.N)r	   r
   r   Ú__doc__r   r   r   r   r      s   € € € € € ØGÐGÐGÐGr   r   c                  óZ   — e Zd ZdZdd„Zedd„¦   «         Zdd„Zdd	„Zdd
„Z	dd„Z
dd„ZdS )Ú
BaseThreadz1Convenience class for creating stoppable threads.ÚreturnÚNonec                óÎ   — t           j                             | ¦  «         t          | d¦  «        rd| _        n|                      d¦  «         t          j        ¦   «         | _        d S )NÚdaemonT)Ú	threadingÚThreadÚ__init__Úhasattrr   Ú	setDaemonÚEventÚ_stopped_event©Úselfs    r   r   zBaseThread.__init__&   s\   € ÝÔ×!Ò! $Ñ'Ô'Ð'Ý�4˜Ñ"Ô"ð 	!ØˆDŒKˆKà�NŠN˜4Ñ Ô Ð Ý'œoÑ/Ô/ˆÔÐÐr   úthreading.Eventc                ó   — | j         S ©N)r   r   s    r   Ústopped_eventzBaseThread.stopped_event.   s   € àÔ"Ð"r   Úboolc                ó6   — | j                              ¦   «          S )z6Determines whether the thread should continue running.)r   Úis_setr   s    r   Úshould_keep_runningzBaseThread.should_keep_running2   s   € àÔ&×-Ò-Ñ/Ô/Ð/Ð/r   c                ó   — dS )z³Override this method instead of :meth:`stop()`.
        :meth:`stop()` calls this method.

        This method is called immediately after the thread is signaled to stop.
        Nr   r   s    r   Úon_thread_stopzBaseThread.on_thread_stop6   ó   € € € r   c                ó`   — | j                              ¦   «          |                      ¦   «          dS )zSignals the thread to stop.N)r   Úsetr*   r   s    r   ÚstopzBaseThread.stop=   s/   € àÔ×ÒÑ!Ô!Ð!Ø×ÒÑÔÐÐÐr   c                ó   — dS )zÚOverride this method instead of :meth:`start()`. :meth:`start()`
        calls this method.

        This method is called right before this thread is started and this
        object's run() method is invoked.
        Nr   r   s    r   Úon_thread_startzBaseThread.on_thread_startB   r+   r   c                ól   — |                       ¦   «          t          j                             | ¦  «         d S r#   )r0   r   r   Ústartr   s    r   r2   zBaseThread.startJ   s1   € Ø×ÒÑÔÐÝÔ×Ò˜tÑ$Ô$Ð$Ð$Ð$r   N)r   r   )r   r!   )r   r%   )r	   r
   r   r   r   Úpropertyr$   r(   r*   r.   r0   r2   r   r   r   r   r   #   s²   € € € € € Ø;Ð;ð0ð 0ð 0ð 0ð ð#ð #ð #ñ „Xð#ð0ð 0ð 0ð 0ðð ð ð ðð ð ð ð
ð ð ð ð%ð %ð %ð %ð %ð %r   r   Úmodule_nameÚstrr   r   c                ó–   — 	 t          | ¦  «         n'# t          $ r}d| › �}t          |¦  «        |‚d}~ww xY wt          j        |          S )z;Imports a module given its name and returns a handle to it.zNo module named N)Ú
__import__ÚImportErrorÚsysÚmodules)r4   ÚeÚerrors      r   Úload_moduler=   O   sc   € ð(Ý�;ÑÔÐÐøÝð (ð (ð (Ø0 ;Ð0Ð0ˆÝ˜%Ñ Ô  aÐ'øøøøð(øøøõ Œ;�{Ô#Ð#s   ‚ ’
6œ1±6Údotted_pathútype[Trick]c                óR  — |                       d¦  «        }t          |¦  «        dk    rd| › d�}t          |¦  «        ‚|d         }d                     |dd…         ¦  «        }t	          |¦  «        }t          ||¦  «        rt          ||¦  «        S d|› d|› �}t          |¦  «        ‚)	a�  Loads and returns a class definition provided a dotted path
    specification the last part of the dotted path is the class name
    and there is at least one module name preceding the class name.

    Notes
    -----
    You will need to ensure that the module you are trying to load
    exists in the Python path.

    Examples
    --------
    - module.name.ClassName    # Provided module.name is in the Python path.
    - module.ClassName         # Provided module is in the Python path.

    What won't work:
    - ClassName
    - modle.name.ClassName     # Typo in module name.
    - module.name.ClasNam      # Typo in classname.

    ú.é   zDotted module path z+ must contain a module name and a classnameéÿÿÿÿNzModule z does not have class attribute )ÚsplitÚlenÚ
ValueErrorÚjoinr=   r   ÚgetattrÚAttributeError)r>   Údotted_path_splitr<   Ú
klass_namer4   Úmodules         r   Ú
load_classrM   Y   sÁ   € ð* $×)Ò)¨#Ñ.Ô.ÐÝ
ÐÑÔ Ò"Ð"Ø^ kÐ^Ð^Ð^ˆÝ˜ÑÔÐØ" 2Ô&€JØ—(’(Ð,¨S¨b¨SÔ1Ñ2Ô2€Kå˜Ñ%Ô%€FÝˆv�zÑ"Ô"ð +Ý�v˜zÑ*Ô*Ð*àN�kÐNÐNÀ*ÐNÐN€EÝ
˜Ñ
Ô
Ðr   )r4   r5   r   r   )r>   r5   r   r?   )r   Ú
__future__r   r9   r   Útypingr   Útypesr   Úwatchdog.tricksr   Ú	Exceptionr   r   r   r   r=   rM   r   r   r   ú<module>rS      s2  ððð ð #Ð "Ð "Ð "Ð "Ð "à 
€
€
€
Ø Ð Ð Ð Ø  Ð  Ð  Ð  Ð  Ð  àð &Ø Ð Ð Ð Ð Ð à%Ð%Ð%Ð%Ð%Ð%ð	ð 	ð 	ð 	ð 	˜9ñ 	ô 	ð 	ðHð Hð Hð Hð H˜Iñ Hô Hð Hð)%ð )%ð )%ð )%ð )%�Ô!ñ )%ô )%ð )%ðX$ð $ð $ð $ð! ð ! ð ! ð ! ð ! ð ! r   