<commit_before>Watchdog
========
Python API to monitor file system events.

Example Usage:
--------------

<pre>import sys
import time
from watchdog import Observer
from watchdog.events import FileSystemEventHandler
import logging

logging.basicConfig(level=logging.DEBUG)

class MyEventHandler(FileSystemEventHandler):
    def catch_all_handler(self, event):
        logging.debug(event)

    def on_moved(self, event):
        self.catch_all_handler(event)

    def on_created(self, event):
        self.catch_all_handler(event)

    def on_deleted(self, event):
        self.catch_all_handler(event)

    def on_modified(self, event):
        self.catch_all_handler(event)


event_handler = MyEventHandler()
observer = Observer()
observer.schedule('a-unique-name', event_handler, sys.argv[1:], recursive=True)
observer.start()
try:
    while True:
        time.sleep(1)
except KeyboardInterrupt:
    observer.unschedule('a-unique-name')
    observer.stop()
observer.join()</pre>


Supported Platforms:
--------------------

* Linux (inotify)
* Mac OS X (FSEevnts, kqueue)
* FreeBSD/BSD (kqueue)
* Windows (ReadDirectoryChangesW with I/O completion ports; ReadDirectoryChangesW worker threads)
* OS-independent (polling the disk for directory snapshots and comparing them periodically; slow and not recommended)
<commit_msg>Include information about watchmedo in README.md<commit_after>Watchdog
========
Python API and shell utilities to monitor file system events.

Example API Usage:
------------------

A simple program that uses watchdog to monitor directories specified
as command-line arguments and logs events generated.

	import sys
	import time
	from watchdog import Observer
	from watchdog.events import FileSystemEventHandler
	import logging

	logging.basicConfig(level=logging.DEBUG)

	class MyEventHandler(FileSystemEventHandler):
	    def catch_all_handler(self, event):
	        logging.debug(event)

	    def on_moved(self, event):
	        self.catch_all_handler(event)

	    def on_created(self, event):
	        self.catch_all_handler(event)

	    def on_deleted(self, event):
	        self.catch_all_handler(event)

	    def on_modified(self, event):
	        self.catch_all_handler(event)


	event_handler = MyEventHandler()
	observer = Observer()
	observer.schedule('a-unique-name', event_handler, sys.argv[1:], recursive=True)
	observer.start()
	try:
	    while True:
	        time.sleep(1)
	except KeyboardInterrupt:
	    observer.unschedule('a-unique-name')
	    observer.stop()
	observer.join()


Shell Utilities:
----------------
Watchdog comes with a utility script called `watchmedo`.
Please type `watchmedo --help` at the shell prompt to
know more about this tool.

Here is how you can log the current directory recursively 
for events related only to *.py and *.txt files while 
ignoring all directory events:

	watchmedo log --pattern="*.py;*.txt" --ignore-directories --recursive .


Supported Platforms:
--------------------

* Linux (inotify)
* Mac OS X (FSEevnts, kqueue)
* FreeBSD/BSD (kqueue)
* Windows (ReadDirectoryChangesW with I/O completion ports; ReadDirectoryChangesW worker threads)
* OS-independent (polling the disk for directory snapshots and comparing them periodically; slow and not recommended)

{'fraction_non_alphanumeric': 0.11388119421360418, 'fraction_numerical': 0.0012311480455524776, 'mean_word_length': 3.793510324483776, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7259443', 'n_tokens_mistral': 965, 'n_tokens_neox': 910, 'n_words': 279}