Ë
    êmxi¹  ã                  ó²   — 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y)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y)ÚUnsupportedLibcErrorN)Ú__name__Ú
__module__Ú__qualname__© ó    úN/home/htdocs/ttos/venv/lib/python3.12/site-packages/watchdog/utils/__init__.pyr   r      s   „ Ør   r   c                  ó   — e Zd ZdZy)ÚWatchdogShutdownErrorz=Semantic exception used to signal an external shutdown event.N)r	   r
   r   Ú__doc__r   r   r   r   r      s   „ ÚGr   r   c                  óR   — 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y	)Ú
BaseThreadz1Convenience class for creating stoppable threads.c                ó¾   — t         j                  j                  | «       t        | d«      rd| _        n| j                  d«       t        j                  «       | _        y )NÚdaemonT)Ú	threadingÚThreadÚ__init__Úhasattrr   Ú	setDaemonÚEventÚ_stopped_event©Úselfs    r   r   zBaseThread.__init__&   sB   € Ü×Ñ×!Ñ! $Ô'Ü�4˜Ô"ØˆD�Kà�N‰N˜4Ô Ü'Ÿo™oÓ/ˆÕr   c                ó   — | j                   S ©N)r   r   s    r   Ústopped_eventzBaseThread.stopped_event.   s   € à×"Ñ"Ð"r   c                ó8   — | j                   j                  «        S )z6Determines whether the thread should continue running.)r   Úis_setr   s    r   Úshould_keep_runningzBaseThread.should_keep_running2   s   € à×&Ñ&×-Ñ-Ó/Ð/Ð/r   c                 ó   — y)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                óX   — | j                   j                  «        | j                  «        y)zSignals the thread to stop.N)r   Úsetr&   r   s    r   ÚstopzBaseThread.stop=   s    € à×Ñ×ÑÔ!Ø×ÑÕr   c                 ó   — y)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                ób   — | j                  «        t        j                  j                  | «       y r    )r,   r   r   Ústartr   s    r   r.   zBaseThread.startJ   s"   € Ø×ÑÔÜ×Ñ×Ñ˜tÕ$r   N)ÚreturnÚNone)r/   zthreading.Event)r/   Úbool)r	   r
   r   r   r   Úpropertyr!   r$   r&   r*   r,   r.   r   r   r   r   r   #   s7   „ Ù;ó0ð ò#ó ð#ó0óóó
ô%r   r   c                ó„   — 	 t        | «       t        j                  |    S # t        $ r}d| › �}t        |«      |‚d}~ww xY w)z;Imports a module given its name and returns a handle to it.zNo module named N)Ú
__import__ÚImportErrorÚsysÚmodules)Úmodule_nameÚeÚerrors      r   Úload_moduler;   O   sK   € ð(Ü�;Ôô �;‰;�{Ñ#Ð#øô ò (Ø" ; -Ð0ˆÜ˜%Ó  aÐ'ûð(ús   ‚   	?©:º?c                ó   — | j                  d«      }t        |«      dk  rd| › d�}t        |«      ‚|d   }dj                  |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)Údotted_pathÚdotted_path_splitr:   Ú
klass_namer8   Úmodules         r   Ú
load_classrJ   Y   sœ   € ð* $×)Ñ)¨#Ó.ÐÜ
ÐÓ Ò"Ø% k ]Ð2]Ð^ˆÜ˜ÓÐØ" 2Ñ&€JØ—(‘(Ð,¨S¨bÐ1Ó2€Kä˜Ó%€FÜˆv�zÔ"Ü�v˜zÓ*Ð*à�k�]Ð"AÀ*ÀÐN€EÜ
˜Ó
Ðr   )r8   Ústrr/   r   )rF   rK   r/   ztype[Trick])r   Ú
__future__r   r6   r   Útypingr   Útypesr   Úwatchdog.tricksr   Ú	Exceptionr   r   r   r   r;   rJ   r   r   r   ú<module>rQ      sX   ðñõ #ã 
Û Ý  áÝ å%ô	˜9ô 	ôH˜Iô Hô)%�×!Ñ!ô )%óX$ô! r   