/usr/lib/python3/dist-packages/twisted/internet/__pycache__
NameSizeModeActions
abstract.cpython-310.pyc176100644editdlrm
address.cpython-310.pyc56700644editdlrm
asyncioreactor.cpython-310.pyc99550644editdlrm
base.cpython-310.pyc408700644editdlrm
cfreactor.cpython-310.pyc156380644editdlrm
default.cpython-310.pyc11720644editdlrm
defer.cpython-310.pyc687400644editdlrm
endpoints.cpython-310.pyc733480644editdlrm
epollreactor.cpython-310.pyc69210644editdlrm
error.cpython-310.pyc150360644editdlrm
fdesc.cpython-310.pyc31730644editdlrm
gireactor.cpython-310.pyc40980644editdlrm
glib2reactor.cpython-310.pyc14680644editdlrm
gtk2reactor.cpython-310.pyc25890644editdlrm
gtk3reactor.cpython-310.pyc18690644editdlrm
inotify.cpython-310.pyc108480644editdlrm
interfaces.cpython-310.pyc1173770644editdlrm
kqreactor.cpython-310.pyc85820644editdlrm
main.cpython-310.pyc9750644editdlrm
pollreactor.cpython-310.pyc59600644editdlrm
posixbase.cpython-310.pyc234570644editdlrm
process.cpython-310.pyc286110644editdlrm
protocol.cpython-310.pyc306580644editdlrm
pyuisupport.cpython-310.pyc9730644editdlrm
reactor.cpython-310.pyc19200644editdlrm
selectreactor.cpython-310.pyc53030644editdlrm
serialport.cpython-310.pyc27780644editdlrm
ssl.cpython-310.pyc89290644editdlrm
stdio.cpython-310.pyc9840644editdlrm
task.cpython-310.pyc321410644editdlrm
tcp.cpython-310.pyc466840644editdlrm
testing.cpython-310.pyc333470644editdlrm
threads.cpython-310.pyc42080644editdlrm
tksupport.cpython-310.pyc21690644editdlrm
udp.cpython-310.pyc165840644editdlrm
unix.cpython-310.pyc195310644editdlrm
utils.cpython-310.pyc93270644editdlrm
win32eventreactor.cpython-310.pyc138810644editdlrm
wxreactor.cpython-310.pyc48970644editdlrm
wxsupport.cpython-310.pyc16930644editdlrm
_baseprocess.cpython-310.pyc22160644editdlrm
_dumbwin32proc.cpython-310.pyc116270644editdlrm
_glibbase.cpython-310.pyc117910644editdlrm
_idna.cpython-310.pyc14940644editdlrm
_newtls.cpython-310.pyc87140644editdlrm
_pollingfile.cpython-310.pyc84760644editdlrm
_posixserialport.cpython-310.pyc21910644editdlrm
_posixstdio.cpython-310.pyc53090644editdlrm
_producer_helpers.cpython-310.pyc38670644editdlrm
_resolver.cpython-310.pyc84020644editdlrm
_signals.cpython-310.pyc28240644editdlrm
_sslverify.cpython-310.pyc684120644editdlrm
_threadedselect.cpython-310.pyc117550644editdlrm
_win32serialport.cpython-310.pyc37070644editdlrm
_win32stdio.cpython-310.pyc40240644editdlrm
__init__.cpython-310.pyc6080644editdlrm
Edit: /usr/lib/python3/dist-packages/twisted/internet/__pycache__/inotify.cpython-310.pyc (10848B)
o b<8@s|dZddlZddlZddlmZddlmZddlmZm Z dZ dZ dZ d Z d Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZe eBZeeBZe e BZ e e BeBeBeBeBeBeBeBZ!e dfe dfe dfe dfedfedfed fed!fed"fed#fed$fed%fed&fed'fed(fed)fed*fed+fed,fed-fgZ"d.d/Z#Gd0d1d1Z$Gd2d3d3eZ%ej&Z&gd4Z'dS)5a  This module provides support for Twisted to linux inotify API. In order to use this support, simply do the following (and start a reactor at some point):: from twisted.internet import inotify from twisted.python import filepath def notify(ignored, filepath, mask): """ For historical reasons, an opaque handle is passed as first parameter. This object should never be used. @param filepath: FilePath on which the event happened. @param mask: inotify event as hexadecimal masks """ print("event %s on %s" % ( ', '.join(inotify.humanReadableMask(mask)), filepath)) notifier = inotify.INotify() notifier.startReading() notifier.watch(filepath.FilePath("/some/directory"), callbacks=[notify]) notifier.watch(filepath.FilePath(b"/some/directory2"), callbacks=[notify]) Note that in the above example, a L{FilePath} which is a L{bytes} path name or L{str} path name may be used. However, no matter what type of L{FilePath} is passed to this module, internally the L{FilePath} is converted to L{bytes} according to L{sys.getfilesystemencoding}. For any L{FilePath} returned by this module, the caller is responsible for converting from a L{bytes} path name to a L{str} path name. @since: 10.1 N)fdesc)FileDescriptor)_inotifylog @iiii i@iiii i@laccessmodifyattrib close_write close_nowriteopen moved_frommoved_tocreatedelete delete_self move_selfunmountqueue_overflowignoredonly_dir dont_followmask_addis_dirone_shotcCs(g}tD] \}}||@r||q|S)zh Auxiliary function that converts a hexadecimal mask into a series of human readable flags. )_FLAG_TO_HUMANappend)maskskvr):/usr/lib/python3/dist-packages/twisted/internet/inotify.pyhumanReadableMaskqs   r+c@s(eZdZdZeddfddZddZdS)_Watcha Watch object that represents a Watch point in the filesystem. The user should let INotify to create these objects @ivar path: The path over which this watch point is monitoring @ivar mask: The events monitored by this watchpoint @ivar autoAdd: Flag that determines whether this watch point should automatically add created subdirectories @ivar callbacks: L{list} of callback functions that will be called when an event occurs on this watch. FNcCs,||_||_||_|durg}||_dSN) asBytesModepathr%autoAdd callbacks)selfr/r%r0r1r)r)r*__init__s  z_Watch.__init__cCs$|}|jD]}||||qdS)zL Callback function used by L{INotify} to dispatch an event. N)r.r1)r2filepatheventscallbackr)r)r*_notifys z_Watch._notify)__name__ __module__ __qualname____doc__ IN_WATCH_MASKr3r7r)r)r)r*r,}s r,c@sxeZdZdZeZdddZddZddZd d Zd d Z d dZ ddZ ddZ e dddfddZddZddZdS)INotifya The INotify file descriptor, it basically does everything related to INotify, from reading to notifying watch points. @ivar _buffer: a L{bytes} containing the data read from the inotify fd. @ivar _watchpoints: a L{dict} that maps from inotify watch ids to watchpoints objects @ivar _watchpaths: a L{dict} that maps from watched paths to the inotify watch ids NcCsTtj||d|j|_t|jt|jd|_d|_ d|_ i|_ i|_ dS)N)reactorrT) rr3rinit_fdrsetNonBlocking_setCloseOnExec connected_writeDisconnected_buffer _watchpoints _watchpaths)r2r>r)r)r*r3s    zINotify.__init__cCs@|}|j|j||}t||||}||j|<||j|<|S)a~ Private helper that abstracts the use of ctypes. Calls the internal inotify API and checks for any errors after the call. If there's an error L{INotify._addWatch} can raise an INotifyError. If there's no error it proceeds creating a watchpoint and adding a watchpath for inverse lookup of the file descriptor from the path. )r.raddrAr,rGrH)r2r/r%r0r1wdiwpr)r)r* _addWatchs    zINotify._addWatchcCs.|j|j||j|}|j|jdS)a Private helper that abstracts the use of ctypes. Calls the internal inotify API to remove an fd from inotify then removes the corresponding watchpoint from the internal mapping together with the file descriptor from the watchpath. N)rremoverArGpoprHr/)r2rJrKr)r)r*_rmWatchs zINotify._rmWatchc Cs`t|||jdkr.z t|jWdSty-}z t|dWYd}~dSd}~wwdS)zR Release the inotify file descriptor and do the necessary cleanup rz'Couldn't close INotify file descriptor.N)rconnectionLostrAoscloseOSErrorrerr)r2reasoner)r)r*rPs  zINotify.connectionLostcCs|jS)z Get the underlying file descriptor from this inotify observer. Required by L{abstract.FileDescriptor} subclasses. )rAr2r)r)r*filenoszINotify.filenocCst|j|jdS)zC Read some data from the observed file descriptors N)r readFromFDrA_doReadrWr)r)r*doReadszINotify.doReadc Cs*|j|7_t|jdkrtd|jdd\}}}}|r,|jdd|d}nd}|jd|d|_z|j|}Wn tyHYqw|j}|rU| |}| |||j r}|t @r}|t @r}|j||jd|jd} |jd|j|j| |t@r|||t|jdksdSdS)zF Work on the data just read from the file descriptor. r z=LLLLrNTr%r0r1)rFlenstructunpackrstriprGKeyErrorr/r.childr7r0IN_ISDIR IN_CREATEwatchr%r1r> callLater _addChildrenIN_DELETE_SELFrOloseConnection) r2in_rJr%cookiesizenamerKr/new_wdr)r)r*rZs2       zINotify._doReadcCsz|j}Wn tyYdSw|D]1}|r9|j||jd|jd}||tt B|j d|j |j ||rE||t tBqdS)a This is a very private method, please don't even think about using it. Note that this is a fricking hack... it's because we cannot be fast enough in adding a watch to a directory and so we basically end up getting here too late if some operations have already been going on in the subdir, we basically need to catchup. This eventually ends up meaning that we generate double events, your app must be resistant. NTr]r)r/childrenrSisdirrfr%r1r7rdrer>rgrhrGisfileIN_CLOSE_WRITE)r2rKlistdirfrJr)r)r*rh$s   zINotify._addChildrenFcCs\|r|D]}|r|j||||ddqdS||}|r"|S|tB}|||||S)aL Watch the 'mask' events in given path. Can raise C{INotifyError} when there's a problem while adding a directory. @param path: The path needing monitoring @type path: L{FilePath} @param mask: The events that should be watched @type mask: L{int} @param autoAdd: if True automatically add newly created subdirectories @type autoAdd: L{bool} @param callbacks: A list of callbacks that should be called when an event happens in the given path. The callback should accept 3 arguments: (ignored, filepath, mask) @type callbacks: L{list} of callables @param recursive: Also add all the subdirectories in this path @type recursive: L{bool} F) recursiveN)walkrqrf _isWatchedrirL)r2r/r%r0r1rvrcrJr)r)r*rfFs  z INotify.watchcCs6|}||}|durt|d||dS)z Remove the watch point monitoring the given path @param path: The path that should be ignored @type path: L{FilePath} Nz is not watched)r.rxrbrO)r2r/rJr)r)r*ignoress  zINotify.ignorecCs|}|j|dS)z Helper function that checks if the path is already monitored and returns its watchdescriptor if so or None otherwise. @param path: The path that should be checked @type path: L{FilePath} N)r.rHget)r2r/r)r)r*rxszINotify._isWatchedr-)r8r9r:r;rr3rLrOrPrXr[rZrhr<rfryrxr)r)r)r*r=s   ,# - r=)r=r+r< IN_ACCESS IN_MODIFY IN_ATTRIBIN_CLOSE_NOWRITErsIN_OPEN IN_MOVED_FROM IN_MOVED_TOre IN_DELETEri IN_MOVE_SELF IN_UNMOUNT IN_Q_OVERFLOW IN_IGNORED IN_ONLYDIRIN_DONT_FOLLOW IN_MASK_ADDrd IN_ONESHOTIN_CLOSEIN_MOVED IN_CHANGED)(r;rQr_twisted.internetrtwisted.internet.abstractrtwisted.pythonrrr{r|r}rsr~rrrrerrirrrrrrrrdrrrrr<r#r+r,r= INotifyError__all__r)r)r)r*s$   s