How to use the hupper.watchdog.WatchdogFileMonitor function in hupper

To help you get started, we’ve selected a few hupper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Pylons / hupper / tests / myapp / cli.py View on Github external
args = sys.argv[1:]
    opts = parse_options(args)
    if opts.reload:
        kw = {}
        if opts.poll:
            from hupper.polling import PollingFileMonitor

            pkw = {}
            if opts.poll_interval:
                pkw['poll_interval'] = opts.poll_interval
            kw['monitor_factory'] = lambda cb: PollingFileMonitor(cb, **pkw)

        if opts.watchdog:
            from hupper.watchdog import WatchdogFileMonitor

            kw['monitor_factory'] = WatchdogFileMonitor

        if opts.watchman:
            from hupper.watchman import WatchmanFileMonitor

            kw['monitor_factory'] = WatchmanFileMonitor

        if opts.reload_interval:
            kw['reload_interval'] = opts.reload_interval

        hupper.start_reloader(__name__ + '.main', **kw)

    if hupper.is_active():
        hupper.get_reloader().watch_files([os.path.join(here, 'foo.ini')])
        hupper.get_reloader().watch_files(opts.watch_files)

    if opts.callback_file: