trio_inotify package

Submodules

trio_inotify.inotify module

Tools to interact with the inotify interface

class trio_inotify.inotify.InotifyEvent(wd: int, mask: trio_inotify.inotify.InotifyMasks, cookie: int, file_name: bytes)[source]

Bases: object

Unpacked inotify event bytes.

Variables:
  • wd (int) – Watch file descriptor.
  • mask (InotifyMasks) – Inotify event mask.
  • cookie (int) – Inotify event cookie if applicable.
  • file_name (bytes) – File path associated with event.
class trio_inotify.inotify.InotifyMasks

Bases: enum.Flag

An enumeration.

IN_ACCESS = 1
IN_ALL_EVENTS = 4095
IN_ATTRIB = 4
IN_CLOEXEC = 524288
IN_CLOSE = 24
IN_CLOSE_NOWRITE = 16
IN_CLOSE_WRITE = 8
IN_CREATE = 256
IN_DELETE = 512
IN_DELETE_SELF = 1024
IN_DONT_FOLLOW = 33554432
IN_IGNORED = 32768
IN_ISDIR = 1073741824
IN_MASK_ADD = 536870912
IN_MODIFY = 2
IN_MOVE = 192
IN_MOVED_FROM = 64
IN_MOVED_TO = 128
IN_MOVE_SELF = 2048
IN_NONBLOCK = 2048
IN_ONESHOT = 2147483648
IN_ONLYDIR = 16777216
IN_OPEN = 32
IN_Q_OVERFLOW = 16384
IN_UNMOUNT = 8192
class trio_inotify.inotify.WatchManager[source]

Bases: object

Add, remove and track watches on an inotify interface.

add_watch(path: str, event_mask: trio_inotify.inotify.InotifyMasks = None, recursive: bool = False) → None[source]

Add new watch to inotify interface and track.

Parameters:
  • path (str) – File/directory to watch.
  • event_mask (InotifyMasks) – inotify events to watch for.
  • recursive (bool) – Include subdirectories/newly created directories.
Returns:

None

del_watch(path: str) → None[source]

Remove a watch. Removes recursively if removing a recursive watch member.

Parameters:path (str) – File/directory to stop watching.
Returns:None
class trio_inotify.inotify.Watcher(watch_manager: trio_inotify.inotify.WatchManager, event_handler: Callable = None)[source]

Bases: object

Watch for inotify events on established watches. Optionally pass events to an event handler.

get_inotify_event() → List[trio_inotify.inotify.InotifyEvent][source]

Read bytes from inotify descriptor if available.

Return list:One or more NamedTuple objects containing event data.

Module contents