How to use hupper - 10 common examples

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
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:
        with open(opts.callback_file, 'ab') as fp:
            fp.write('{:d}\n'.format(int(time.time())).encode('utf8'))
    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        pass
github Pylons / hupper / tests / myapp / cli.py View on Github external
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:
        with open(opts.callback_file, 'ab') as fp:
            fp.write('{:d}\n'.format(int(time.time())).encode('utf8'))
    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        pass
github Pylons / hupper / tests / myapp / cli.py View on Github external
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:
        with open(opts.callback_file, 'ab') as fp:
            fp.write('{:d}\n'.format(int(time.time())).encode('utf8'))
    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        pass
github Pylons / hupper / tests / test_reloader.py View on Github external
def make_proxy(monitor_factory, callback, logger):
    from hupper.reloader import FileMonitorProxy

    proxy = FileMonitorProxy(callback, logger)
    proxy.monitor = monitor_factory(proxy.file_changed)
    return proxy
github Pylons / hupper / tests / test_reloader.py View on Github external
def test_ignore_files():
    class DummyMonitor(object):
        paths = set()

        def add_path(self, path):
            self.paths.add(path)

    from hupper.reloader import FileMonitorProxy

    cb = DummyCallback()
    proxy = FileMonitorProxy(cb, None, {'/a/*'})
    monitor = proxy.monitor = DummyMonitor()

    path = 'foo.txt'
    assert path not in monitor.paths
    proxy.add_path(path)
    assert path in monitor.paths

    path = '/a/foo.txt'
    assert path not in monitor.paths
    proxy.add_path(path)
    assert path not in monitor.paths
github Pylons / hupper / tests / test_cli.py View on Github external
def test_interval_parser():
    assert interval_parser("5") == 5
github Pylons / hupper / tests / test_cli.py View on Github external
def test_interval_parser_errors(value):
    with pytest.raises(argparse.ArgumentTypeError):
        interval_parser(value)
github Pylons / hupper / tests / test_watch.py View on Github external
    @hupper.watch(verbose=1)
    def myfunc():
        pass
github Pylons / hupper / tests / myapp / cli.py View on Github external
            kw['monitor_factory'] = lambda cb: PollingFileMonitor(cb, **pkw)
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: