
    ʆh                        S r SSKJr  SSKrSSKrSSKJr  \(       a  SSKJr  SSK	J
r
   " S S\5      r " S	 S
\5      r " S S\R                  5      rSS jrSS jrg)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                      \ rS rSrSrg)UnsupportedLibcError    N)__name__
__module____qualname____firstlineno____static_attributes__r
       O/opt/services/DDDS/venv/lib/python3.13/site-packages/watchdog/utils/__init__.pyr   r      s    r   r   c                      \ rS rSrSrSrg)WatchdogShutdownError   z=Semantic exception used to signal an external shutdown event.r
   N)r   r   r   r   __doc__r   r
   r   r   r   r      s    Gr   r   c                  h    \ rS rSrSrSS jr\SS j5       rSS jrSS jr	SS jr
SS jrSS	 jrS
rg)
BaseThread#   z1Convenience class for creating stoppable threads.c                    [         R                  R                  U 5        [        U S5      (       a  SU l        OU R                  S5        [         R                  " 5       U l        g )NdaemonT)	threadingThread__init__hasattrr   	setDaemonEvent_stopped_eventselfs    r   r   BaseThread.__init__&   sE    !!$'4""DKNN4 'oo/r   c                    U R                   $ N)r!   r"   s    r   stopped_eventBaseThread.stopped_event.   s    """r   c                @    U R                   R                  5       (       + $ )z6Determines whether the thread should continue running.)r!   is_setr"   s    r   should_keep_runningBaseThread.should_keep_running2   s    &&--///r   c                    g)zOverride 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_stopBaseThread.on_thread_stop6       r   c                X    U R                   R                  5         U R                  5         g)zSignals the thread to stop.N)r!   setr.   r"   s    r   stopBaseThread.stop=   s     !r   c                    g)zOverride 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_startBaseThread.on_thread_startB   r0   r   c                b    U R                  5         [        R                  R                  U 5        g r&   )r6   r   r   startr"   s    r   r9   BaseThread.startJ   s"    t$r   )r!   r   N)returnNone)r;   zthreading.Event)r;   bool)r   r   r   r   r   r   propertyr'   r+   r.   r3   r6   r9   r   r
   r   r   r   r   #   s7    ;0 # #0
%r   r   c                     [        U 5        [        R                  U    $ ! [         a  nSU  3n[        U5      UeSnAff = f)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_modulerG   O   sK    (; ;;{##  (";-0% a'(s     
A ;A c                   U R                  S5      n[        U5      S::  a  SU  S3n[        U5      eUS   nSR                  USS 5      n[	        U5      n[        XS5      (       a  [        XS5      $ SU SU 3n[        U5      e)	aE  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 classnameNzModule z does not have class attribute )splitlen
ValueErrorjoinrG   r   getattrAttributeError)dotted_pathdotted_path_splitrF   
klass_namerD   modules         r   
load_classrV   Y   s    * $))#.
"%k]2]^"2&J((,Sb12K%Fv""v**k]"A*NE

r   )rD   strr;   r   )rR   rW   r;   ztype[Trick])r   
__future__r   rB   r   typingr   typesr   watchdog.tricksr   	Exceptionr   r   r   r   rG   rV   r
   r   r   <module>r]      sX    # 
    %	9 	HI H)%!! )%X$! r   