當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。