diff options
author | Sebastien Martini <seb@dbzteam.org> | 2009-10-25 01:53:46 +0200 |
---|---|---|
committer | Sebastien Martini <seb@dbzteam.org> | 2009-10-25 01:53:46 +0200 |
commit | 3cde3f595cdeb109843a505bf4a115c882c53d62 (patch) | |
tree | a6717e392b5ba19c2bd512fe8080abb81a34cf4f | |
parent | a4672d66b72cb209ac36dbe2887c22637e0c3714 (diff) | |
download | pyinotify-3cde3f595cdeb109843a505bf4a115c882c53d62.tar.gz |
Updated examples (mostly comments).
-rw-r--r-- | examples/chain.py | 9 | ||||
-rw-r--r-- | examples/daemon.py | 2 | ||||
-rw-r--r-- | examples/exclude.py | 2 | ||||
-rw-r--r-- | examples/loop.py | 2 | ||||
-rw-r--r-- | examples/not_quiet.py | 9 | ||||
-rw-r--r-- | examples/stats.py | 4 | ||||
-rw-r--r-- | examples/stats_threaded.py | 2 | ||||
-rw-r--r-- | examples/transient_file.py | 5 |
8 files changed, 15 insertions, 20 deletions
diff --git a/examples/chain.py b/examples/chain.py index 139eb64..9760414 100644 --- a/examples/chain.py +++ b/examples/chain.py @@ -1,14 +1,13 @@ -# Example +# Example: monitors events and logs them into a log file. # -# This example logs the observed events into a log file. from pyinotify import * class Log(ProcessEvent): def my_init(self, fileobj): """ - Template method automatically called from ProcessEvent.__init__(). - And keyworded arguments passed to ProcessEvent.__init__() are delegated - to my_init(). + Method automatically called from ProcessEvent.__init__(). Additional + keyworded arguments passed to ProcessEvent.__init__() are then + delegated to my_init(). This is the case for fileobj. """ self._fileobj = fileobj diff --git a/examples/daemon.py b/examples/daemon.py index 1b63999..6e6c9ca 100644 --- a/examples/daemon.py +++ b/examples/daemon.py @@ -1,4 +1,4 @@ -# Example +# Example: daemonize pyinotify's notifier. # import pyinotify diff --git a/examples/exclude.py b/examples/exclude.py index 01a54ad..850dbfe 100644 --- a/examples/exclude.py +++ b/examples/exclude.py @@ -1,4 +1,4 @@ -# Example +# Example: excludes items from being monitored. # import pyinotify import os diff --git a/examples/loop.py b/examples/loop.py index 890eba6..b737c5d 100644 --- a/examples/loop.py +++ b/examples/loop.py @@ -1,4 +1,4 @@ -# Example +# Example: loops monitoring events forever. # import pyinotify diff --git a/examples/not_quiet.py b/examples/not_quiet.py index e4d5a56..3b24db2 100644 --- a/examples/not_quiet.py +++ b/examples/not_quiet.py @@ -1,8 +1,7 @@ -# Example +# Example: raise exceptions on errors. # - -# Overrides default behavior and raise exception on add_watch, update_watch, -# rm_watch errors. +# Overrides default behavior and raise exception on add_watch, update_watch +# or rm_watch errors. import pyinotify @@ -16,7 +15,7 @@ print r # quiet=False raise exception try: - wm.add_watch(['/tmp', '/tmp-do-not-exist'], + wm.add_watch(['/tmp', '/tmp-do-not-exist'], pyinotify.ALL_EVENTS, quiet=False) except pyinotify.WatchManagerError, err: print err, err.wmd diff --git a/examples/stats.py b/examples/stats.py index 4393004..1e882ec 100644 --- a/examples/stats.py +++ b/examples/stats.py @@ -1,10 +1,8 @@ -# Example +# Example: prints statistics. # -# Prints statistics. from pyinotify import * class Identity(ProcessEvent): - def process_default(self, event): # Does nothing, just to demonstrate how stuffs could trivially # be accomplished after having processed statistics. diff --git a/examples/stats_threaded.py b/examples/stats_threaded.py index e33081c..997dc6b 100644 --- a/examples/stats_threaded.py +++ b/examples/stats_threaded.py @@ -1,4 +1,4 @@ -# Example +# Example: prints statistics (threaded version). # import time from pyinotify import * diff --git a/examples/transient_file.py b/examples/transient_file.py index 0db25b9..7957717 100644 --- a/examples/transient_file.py +++ b/examples/transient_file.py @@ -1,7 +1,6 @@ -# Example +# Example: monitors transient files. # -# Permit to watch a transient file, run this code, then run -# transient_file.sh in another shell. +# Run this code, then run transient_file.sh in another shell. from pyinotify import * class ProcessTransientFile(ProcessEvent): |