当前位置: 首页>>代码示例>>Python>>正文


Python events.PatternMatchingEventHandler方法代码示例

本文整理汇总了Python中watchdog.events.PatternMatchingEventHandler方法的典型用法代码示例。如果您正苦于以下问题:Python events.PatternMatchingEventHandler方法的具体用法?Python events.PatternMatchingEventHandler怎么用?Python events.PatternMatchingEventHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在watchdog.events的用法示例。


在下文中一共展示了events.PatternMatchingEventHandler方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from watchdog import events [as 别名]
# 或者: from watchdog.events import PatternMatchingEventHandler [as 别名]
def __init__(self, runner):
        self.runner = runner

        self.event_handler = PatternMatchingEventHandler(patterns=["*.fast5"],
                ignore_patterns=[],
                ignore_directories=True)
        self.event_handler.on_created = self.on_created
        self.event_handler.on_moved = self.on_moved

        self.observer = Observer()

        self.observedPaths = []
        for path in self.runner.input:
            if os.path.isdir(path):
                self.observer.schedule(self.event_handler, path, recursive=True)
                self.observedPaths.append(path)
        log("Monitoring {} in real time. Press Ctrl+C to exit.".format(", ".join(self.observedPaths))) 
开发者ID:scottgigante,项目名称:picopore,代码行数:19,代码来源:realtime.py

示例2: __init__

# 需要导入模块: from watchdog import events [as 别名]
# 或者: from watchdog.events import PatternMatchingEventHandler [as 别名]
def __init__(self, media):
        self._media = media

        self.event_handler = PatternMatchingEventHandler(
            patterns=_storage.extensions)
        self.event_handler.on_created = self.on_created
        self.event_handler.on_moved = self.on_moved
        self.event_handler.on_deleted = self.on_deleted

        self.observer = Observer()
        self.observer.schedule(self.event_handler, self._media.folder,
                               recursive=True)

        self.observer.start() 
开发者ID:ffplayout,项目名称:ffplayout-engine,代码行数:16,代码来源:folder.py

示例3: make_handler

# 需要导入模块: from watchdog import events [as 别名]
# 或者: from watchdog.events import PatternMatchingEventHandler [as 别名]
def make_handler(file_name):
    class Handler(PatternMatchingEventHandler):
        def on_modified(self, event):
            log.debug('Modified: {}'.format(event.src_path))
            with open(file_name) as f:
                code = f.read()
            code_atom.reset(code)

    return Handler(patterns=[abspath(file_name)]) 
开发者ID:edne,项目名称:pineal,代码行数:11,代码来源:watcher.py

示例4: __init__

# 需要导入模块: from watchdog import events [as 别名]
# 或者: from watchdog.events import PatternMatchingEventHandler [as 别名]
def __init__(self, folder, callback, dbpool):
        print 'now scanning {0}'.format(folder)
        self.path = folder
        self.callback = callback
        self.dbpool = dbpool
        self.event_handler = PatternMatchingEventHandler(patterns=['*'])
        self.event_handler.process = self.process
        self.event_handler.on_any_event = self.on_any_event
        self.observer = Observer()
        self.observer.schedule(self.event_handler, self.path, recursive=True)
        self.observer.start() 
开发者ID:nirvik,项目名称:iWant,代码行数:13,代码来源:watching.py

示例5: __init__

# 需要导入模块: from watchdog import events [as 别名]
# 或者: from watchdog.events import PatternMatchingEventHandler [as 别名]
def __init__(self, container, host_dir, container_dir, options=None):
        """
        Initialize a new instance of ContainerNotifier

        Args:
            container: Container
            host_dir (str): Host directory
            container_dir (str): Container directory
        """

        self.container = container
        self.host_dir = host_dir
        self.container_dir = container_dir
        options = NotifierOptions() if options is None else options

        event_handler = PatternMatchingEventHandler(
            ignore_patterns=options.exclude_patterns, ignore_directories=False)

        handler = self.__change_handler
        event_handler.on_created = handler
        event_handler.on_moved = handler
        event_handler.on_modified = handler

        if options.notify_debounce:
            logging.info('File change events debouncing with %fs delay.', options.notify_debounce)
            self.notify_debounced = CallDebouncer(self.notify, options.notify_debounce)
        else:
            self.notify_debounced = self.notify

        self.observer = Observer()
        self.observer.schedule(event_handler, host_dir, recursive=True)
        self.observer.start() 
开发者ID:merofeev,项目名称:docker-windows-volume-watcher,代码行数:34,代码来源:container_notifier.py

示例6: observe_trig_file

# 需要导入模块: from watchdog import events [as 别名]
# 或者: from watchdog.events import PatternMatchingEventHandler [as 别名]
def observe_trig_file():
    print_limit(" - Enabling Trigger Events Config File Observation -", 2)
    path = homedir + "/Pigrow/config/"
    trig_events_handler = PatternMatchingEventHandler("*.txt", "", True, False)
    trig_events_handler.on_created = trig_change
    trig_events_handler.on_modified = trig_change
    trig_events_ob = Observer()
    trig_events_ob.schedule(trig_events_handler, path, recursive=True)
    trig_events_ob.start() 
开发者ID:Pragmatismo,项目名称:Pigrow,代码行数:11,代码来源:trigger_watcher.py


注:本文中的watchdog.events.PatternMatchingEventHandler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。