Ë
    äÞËjC  ã                  óÖ   — d Z ddlmZ ddlZddlZddlmZ  G d„ de«      Z G d„ de«      Z	 G d	„ d
ej                  «      Zd„ Zd„ Zesej                  dk\  rddlmZ y G 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_CHECKINGc                  ó   — e Zd Zy)ÚUnsupportedLibcN©Ú__name__Ú
__module__Ú__qualname__© ó    úT/var/www/photos/backend/venv/lib/python3.12/site-packages/watchdog/utils/__init__.pyr   r   &   s   „ Ør   r   c                  ó   — e Zd ZdZy)ÚWatchdogShutdownz=Semantic exception used to signal an external shutdown event.N)r   r	   r
   Ú__doc__r   r   r   r   r   *   s   „ ÚGr   r   c                  óD   — e Zd ZdZd„ Zed„ «       Zd„ Zd„ Zd„ Z	d„ Z
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__1   sB   € Ü×Ñ×!Ñ! $Ô'Ü�4˜Ô"ØˆD�Kà�N‰N˜4Ô Ü'Ÿo™oÓ/ˆÕr   c                ó   — | j                   S ©N)r   r   s    r   Ústopped_eventzBaseThread.stopped_event9   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_running=   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_stopA   ó   � r   c                óX   — | j                   j                  «        | j                  «        y)zSignals the thread to stop.N)r   Úsetr%   r   s    r   ÚstopzBaseThread.stopH   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_startM   r&   r   c                ób   — | j                  «        t        j                  j                  | «       y r   )r+   r   r   Ústartr   s    r   r-   zBaseThread.startU   s"   € Ø×ÑÔÜ×Ñ×Ñ˜tÕ$r   N)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}t        d| › �«      |‚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Úes     r   Úload_moduler6   Z   sJ   € ðCÜ�;Ôô �;‰;�{Ñ#Ð#øô ò CÜÐ,¨[¨MÐ:Ó;ÀÐBûðCús   ‚   	=©8¸=c                óø   — | j                  d«      }t        |«      dk  rt        d| › d�«      ‚|d   }dj                  |dd «      }t	        |«      }t        ||«      rt        ||«      S t        d|› d|› �«      ‚)	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Újoinr6   r   ÚgetattrÚAttributeError)Údotted_pathÚdotted_path_splitÚ
klass_namer4   Úmodules        r   Ú
load_classrE   c   s•   € ð* $×)Ñ)¨#Ó.ÐÜ
ÐÓ Ò"ÜÐ.¨{¨mÐ;fÐgÓhÐhØ" 2Ñ&€JØ—(‘(Ð,¨S¨bÐ1Ó2€Kä˜Ó%€FÜˆv�zÔ"Ü�v˜zÓ*Ð*ô ˜7 ; -Ð/NÈzÈlÐ[Ó
\Ð\r   )é   é   )ÚProtocolc                  ó   — e Zd Zy)rH   Nr   r   r   r   rH   rH   Ž   s   … r   rH   )r   Ú
__future__r   r2   r   Útypingr   Ú	Exceptionr   r   r   r   r6   rE   Úversion_inforH   r   r   r   ú<module>rN      sn   ðñ"õ #ã 
Û Ý  ô	�iô 	ôH�yô Hô)%�×!Ñ!ô )%òX$ò!]ñH �C×$Ñ$¨Ò.æ+÷
 Òr   