Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# Copyright (c) 2014, Facebook, Inc. All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. #
"""DirectoryWatcherTask watches for new, deleted, and modified files
The `IGNORE_INITIAL_FILES` attribute can be overridden to Flaase if you do not want to receive a bunch of `onFileCreated` callbacks during startup.
This could be better implemented with the inotify/pyinotify API, but for basic rapid prototyping, polling should be sufficient. """ help='Directory path to watch [%(default)s]')
"""Override this to do custom processing when new files are created.""" self.logger.debug('onFileCreated(%s, %s)', filename, stat)
"""Override this to do custom processing when files are deleted.""" self.logger.debug('onFileDeleted(%s, %s)', filename, old_stat)
"""Override this to do custom processing when files are modified.""" self.logger.debug('onFileChanged(%s, %s, %s)', filename, old_stat, new_stat)
"""Overridden to stat a particular filesystem path""" # There is a race condition between listdir() and stat() where # files might be deleted. On ENOENT from a stat call, assume # the file is gone. Raise non-ENOENT exceptions raise
"""Overridden to track file statuses.""" # For the first run, ignore pre-existing files by default. # Override this class and set this to False if you want them.
old_value = []
else:
"""Wrapper for making unittesting/mocking easier"""
"""Wrapper for making unittesting/mocking easier""" |