ulif.pynotify.base – Base components

Base components for core functionality.

ulif.pynotify.base.NONE

No change marker

ulif.pynotify.base.ADDED

File/directory added marker

ulif.pynotify.base.MODIFIED

File/directory changed marker

ulif.pynotify.base.DELETED

File/directory deleted marker

ulif.pynotify.base.UNKNOWN_TYPE

Unidentifiable file type

ulif.pynotify.base.FILE_TYPE

Regular file

ulif.pynotify.base.DIR_TYPE

A directory

class ulif.pynotify.base.FSChange(path, changetype=2)

A change in filesystem.

Changes in filesystem are files or directories which were modified.

path

the filesystem path of the dir/file that changed

basename

the basename of the filesystem entity (a dir or file)

changetype

the type of change

filetype

the file type of the change

class ulif.pynotify.base.FSWalker

A walker for the filesystem.

This plain walker scans a directory or file for changes. It does this by comparing the timestamp of all files found with a given one. It’s a simple pure Python implementation and does not store any status information. Therefore it is runnable with virtually any Python version and requires no extra modules. The drawback is, that his walker cannot detect file/directory deletion.

walk(root_dir, timestamp)

Walk the filetree rooted at root_dir and message changes.

Changes are files, changed in time elapsed since timestamp.

Returns a generator of FSChange objects.

The root_dir, despite of its name can also be a regular file.

Todo

Consider using standard lib os.walk()

Previous topic

ulif.pynotify API

Next topic

ulif.pynotify.sqlite – SQLite support

This Page