
    g                        d Z ddlmZ ddlZddlZddlmZmZ ddlm	Z	m
Z
 erddlmZ  G d de      Zdd	Z e       Zd
gZy)u  :module: watchdog.observers
:synopsis: Observer that picks a native implementation if available.
:author: yesudeep@google.com (Yesudeep Mangalapilly)
:author: contact@tiger-222.fr (Mickaël Schoentgen)

Classes
=======
.. autoclass:: Observer
   :members:
   :show-inheritance:
   :inherited-members:

Observer thread that schedules watching directories and dispatches
calls to event handlers.

You can also import platform specific classes directly and use it instead
of :class:`Observer`.  Here is a list of implemented observer classes.:

============== ================================ ==============================
Class          Platforms                        Note
============== ================================ ==============================
|Inotify|      Linux 2.6.13+                    ``inotify(7)`` based observer
|FSEvents|     macOS                            FSEvents based observer
|Kqueue|       macOS and BSD with kqueue(2)     ``kqueue(2)`` based observer
|WinApi|       Microsoft Windows                Windows API-based observer
|Polling|      Any                              fallback implementation
============== ================================ ==============================

.. |Inotify|     replace:: :class:`.inotify.InotifyObserver`
.. |FSEvents|    replace:: :class:`.fsevents.FSEventsObserver`
.. |Kqueue|      replace:: :class:`.kqueue.KqueueObserver`
.. |WinApi|      replace:: :class:`.read_directory_changes.WindowsApiObserver`
.. |Polling|     replace:: :class:`.polling.PollingObserver`

    )annotationsN)TYPE_CHECKINGProtocol)UnsupportedLibcErrorplatform)BaseObserverc                      e Zd ZddddZy)ObserverType.)timeoutc                    y )N )selfr   s     P/var/www/openai/venv/lib/python3.12/site-packages/watchdog/observers/__init__.py__call__zObserverType.__call__2   s        N)r   floatreturnr   )__name__
__module____qualname__r   r   r   r   r
   r
   1   s    +.Dr   r
   c                 N   t        j                         r+t        j                  t              5  ddlm}  | cd d d        S t        j                         r		 ddlm	} |S t        j                         r		 dd	lm} |S t        j$                         rddlm} |S ddlm} |S # 1 sw Y   xY w# t        $ rK 	 ddlm} t        j                  dd       |cY S # t        $ r t        j                  dd       Y nw xY wY gw xY w# t        $ r t        j                  d
d       Y w xY w)Nr   )InotifyObserver)FSEventsObserver)KqueueObserverz.Failed to import fsevents. Fall back to kqueue   )
stacklevelz;Failed to import fsevents and kqueue. Fall back to polling.)WindowsApiObserverz@Failed to import `read_directory_changes`. Fall back to polling.)PollingObserver)r   is_linux
contextlibsuppressr   watchdog.observers.inotifyr   	is_darwinwatchdog.observers.fseventsr   	Exceptionwatchdog.observers.kqueuer   warningswarn
is_windows)watchdog.observers.read_directory_changesr   is_bsdwatchdog.observers.pollingr   )r   r   r   r   r   s        r   _get_observer_clsr-   5   s     !56B" 76 
				$D $#					&T &%		<:? 76  	&&D N[\]%%	  k[hijkj		&  	lMM\ijk	lsS   BB* 2D B'*	C>4C:C> C85C>7C88C>=C> D$#D$Observer)r   r
   )__doc__
__future__r   r    r'   typingr   r   watchdog.utilsr   r   watchdog.observers.apir   r
   r-   r.   __all__r   r   r   <module>r5      sG   "H #   * 93E8 E!H ,r   