<s> """<STR_LIT>""" <EOL> import functools <EOL> import time <EOL> from watchdog . observers import Observer <EOL> from watchdog . events import FileSystemEventHandler <EOL> def watch ( path , handler ) : <EOL> """<STR_LIT>""" <EOL> @ functools . wraps ( handler ) <EOL> def wrapper ( self , event ) : <EOL> if not event . is_directory : <EOL> return handler ( event . event_type , event . src_path ) <EOL> attrs = { '<STR_LIT>' : wrapper } <EOL> EventHandler = type ( "<STR_LIT>" , ( FileSystemEventHandler , ) , attrs ) <EOL> observer = Observer ( ) <EOL> observer . schedule ( EventHandler ( ) , path = path , recursive = True ) <EOL> observer . start ( ) <EOL> try : <EOL> while True : <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> except KeyboardInterrupt : <EOL> observer . stop ( ) <EOL> observer . join ( ) </s>
