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


Python api.EventEmitter类代码示例

本文整理汇总了Python中watchdog.observers.api.EventEmitter的典型用法代码示例。如果您正苦于以下问题:Python EventEmitter类的具体用法?Python EventEmitter怎么用?Python EventEmitter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __init__

    def __init__(self, event_queue, watch, timeout=DEFAULT_EMITTER_TIMEOUT):
      EventEmitter.__init__(self, event_queue, watch, timeout)
      self._lock = threading.Lock()

      self._directory_handle = get_directory_handle(watch.path,
                                                    WATCHDOG_FILE_FLAGS)
      self._buffer = ctypes.create_string_buffer(BUFFER_SIZE)
开发者ID:edevil,项目名称:watchdog,代码行数:7,代码来源:read_directory_changes.py

示例2: __init__

 def __init__(self, event_queue, watch, timeout=DEFAULT_EMITTER_TIMEOUT):
     EventEmitter.__init__(self, event_queue, watch, timeout)
     self.wm = pyinotify.WatchManager()
     self.notifier = pyinotify.Notifier(self.wm, InotifyEventHandler(emitter=self))
     self.wm.add_watch(watch.path, mask, rec=watch.is_recursive)
     self.stopped = threading.Event()
     self.path = watch.path
开发者ID:DanielOaks,项目名称:watchdog,代码行数:7,代码来源:inotify_pyinotify.py

示例3: __init__

 def __init__(self, event_queue, watch, timeout=DEFAULT_EMITTER_TIMEOUT,
              stat=default_stat, listdir=os.listdir):
     EventEmitter.__init__(self, event_queue, watch, timeout)
     self._snapshot = None
     self._lock = threading.Lock()
     self._take_snapshot = lambda: DirectorySnapshot(
         self.watch.path, self.watch.is_recursive, stat=stat, listdir=listdir)
开发者ID:skcript,项目名称:watchdog,代码行数:7,代码来源:polling.py

示例4: queue_event

 def queue_event(self, event):
     EventEmitter.queue_event(self, event)
     if event.event_type == EVENT_TYPE_CREATED:
         self._register_kevent(event.src_path, event.is_directory)
     elif event.event_type == EVENT_TYPE_MOVED:
         self._unregister_kevent(event.src_path)
         self._register_kevent(event.dest_path, event.is_directory)
     elif event.event_type == EVENT_TYPE_DELETED:
         self._unregister_kevent(event.src_path)
开发者ID:connoryang,项目名称:dec-eve-serenity,代码行数:9,代码来源:kqueue.py

示例5: __init__

    def __init__(self, event_queue, watch, timeout = DEFAULT_EMITTER_TIMEOUT):
        EventEmitter.__init__(self, event_queue, watch, timeout)
        self._kq = select.kqueue()
        self._lock = threading.RLock()
        self._descriptors = KeventDescriptorSet()

        def walker_callback(path, stat_info, self = self):
            self._register_kevent(path, stat.S_ISDIR(stat_info.st_mode))

        self._snapshot = DirectorySnapshot(watch.path, watch.is_recursive, walker_callback)
开发者ID:connoryang,项目名称:dec-eve-serenity,代码行数:10,代码来源:kqueue.py

示例6: queue_event

    def queue_event(self, event):
        """
        Handles queueing a single event object.

        :param event:
            An instance of :class:`watchdog.events.FileSystemEvent`
            or a subclass.
        """
        # Handles all the book keeping for queued events.
        # We do not need to fire moved/deleted events for all subitems in
        # a directory tree here, because this function is called by kqueue
        # for all those events anyway.
        EventEmitter.queue_event(self, event)
        if event.event_type == EVENT_TYPE_CREATED:
            self._register_kevent(event.src_path, event.is_directory)
        elif event.event_type == EVENT_TYPE_MOVED:
            self._unregister_kevent(event.src_path)
            self._register_kevent(event.dest_path, event.is_directory)
        elif event.event_type == EVENT_TYPE_DELETED:
            self._unregister_kevent(event.src_path)
开发者ID:Witos,项目名称:watchdog,代码行数:20,代码来源:kqueue.py

示例7: __init__

 def __init__(self, event_queue, watch, timeout=DEFAULT_EMITTER_TIMEOUT):
   EventEmitter.__init__(self, event_queue, watch, timeout)
   self._lock = threading.Lock()
   self._inotify = Inotify(watch.path, watch.is_recursive)
开发者ID:edevil,项目名称:watchdog,代码行数:4,代码来源:inotify.py

示例8: __init__

 def __init__(self, event_queue, watch, timeout=DEFAULT_EMITTER_TIMEOUT):
     EventEmitter.__init__(self, event_queue, watch, timeout)
     self._snapshot = DirectorySnapshot(watch.path, watch.is_recursive)
     self._lock = threading.Lock()
开发者ID:hectorj2f,项目名称:file_metadata_collector,代码行数:4,代码来源:polling.py

示例9: test___init__

 def test___init__(self):
   event_queue = EventQueue()
   watch = ObservedWatch('/foobar', True)
   event_emitter = EventEmitter(event_queue, watch, timeout=1)
   event_emitter.queue_event(FileModifiedEvent('/foobar/blah'))
开发者ID:edevil,项目名称:watchdog,代码行数:5,代码来源:test_watchdog_observers_api.py

示例10: __init__

 def __init__(self, event_queue, watch, timeout=DEFAULT_EMITTER_TIMEOUT):
     EventEmitter.__init__(self, event_queue, watch, timeout)
     self._lock = threading.Lock()
     self._inotify = None
开发者ID:Arash-Afshar,项目名称:watchdog,代码行数:4,代码来源:inotify.py

示例11: __init__

 def __init__(self, event_queue, watch, timeout=DEFAULT_EMITTER_TIMEOUT):
     EventEmitter.__init__(self, event_queue, watch, timeout)
     self._fsevents = FSEventsQueue(watch.path)
     self._fsevents.start()
开发者ID:Arash-Afshar,项目名称:watchdog,代码行数:4,代码来源:fsevents2.py

示例12: __init__

 def __init__(self, event_queue, watch, make_snapshot, timeout):
   EventEmitter.__init__(self, event_queue, watch, timeout)
   self._make_snapshot = make_snapshot
   self._snapshot = make_snapshot(self.watch.path)
开发者ID:Thilas,项目名称:xbmc-addon-watchdog,代码行数:4,代码来源:polling.py

示例13: on_created

            return
        logging.debug(event)

    def on_created(self, event):
        logging.debug(event)

    def on_deleted(self, event):
        logging.debug(event)

    def on_modified(self, event):
        logging.debug(event)

#path = sys.argv[1]
qu = EventQueue()
ob_w = ObservedWatch(path,True)
em = EventEmitter(qu,ob_w,1)

em.start()
t = True
try:
    while 1:
        if qu.task_done():
            time.sleep(3)
        else:
            logging.info("{0:s}".format(qu.get()))

except KeyboardInterrupt:
    em.stop()
em.stop()
em.join()
开发者ID:compfaculty,项目名称:TeachMePython,代码行数:30,代码来源:simple.py

示例14: __init__

 def __init__(self, event_queue, watch, timeout=DEFAULT_EMITTER_TIMEOUT):
     EventEmitter.__init__(self, event_queue, watch, timeout)
     self._lock = threading.Lock()
     self._handle = get_directory_handle(watch.path)
开发者ID:Amber-Creative,项目名称:ambererpnext,代码行数:4,代码来源:read_directory_changes.py

示例15: __init__

 def __init__(self, event_queue, watch, timeout=1):
     EventEmitter.__init__(self, event_queue, watch, timeout)
     self._snapshot = None
开发者ID:lidormalicb,项目名称:xbmc-addon-watchdog,代码行数:3,代码来源:polling.py


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