Called when a file or directory is modified.

        Args:
            event: Watchdog event, ``watchdog.events.DirModifiedEvent`` or
                ``watchdog.events.FileModifiedEvent``.
763992
def on_modified(self, event):
        
        if not self._event_error:
            self.logger.info(u"Change detected from an edit on: %s",
                             event.src_path)

            self.compile_dependencies(event.src_path)
158727
def _modify_event(self, event_name, method, func):
        
        if event_name not in self.ALL_EVENTS:
            raise TypeError(('event_name ("%s") can only be one of the '
                             'following: %s') % (event_name,
                                                 repr(self.ALL_EVENTS)))
        if not isinstance(func, collections.Callable):
            raise TypeError(('func must be callable to be added as an '
                             'observer.'))
        getattr(self._events[event_name], method)(func)
481854
def process_IN_CREATE(self, raw_event):
        
        if raw_event.mask & IN_ISDIR:
            watch_ = self._watch_manager.get_watch(raw_event.wd)
            created_dir = os.path.join(watch_.path, raw_event.name)
            if watch_.auto_add and not watch_.exclude_filter(created_dir):
                addw = self._watch_manager.add_watch
                # The newly monitored directory inherits attributes from its
                # parent directory.
                addw_ret = addw(created_dir, watch_.mask,
                                proc_fun=watch_.proc_fun,
                                rec=False, auto_add=watch_.auto_add,
                                exclude_filter=watch_.exclude_filter)

                # Trick to handle mkdir -p /d1/d2/t3 where d1 is watched and
                # d2 and t3 (directory or file) are created.
                # Since the directory d2 is new, then everything inside it must
                # also be new.
                created_dir_wd = addw_ret.get(created_dir)
                if ((created_dir_wd is not None) and (created_dir_wd > 0) and
                    os.path.isdir(created_dir)):
                    try:
                        for name in os.listdir(created_dir):
                            inner = os.path.join(created_dir, name)
                            if self._watch_manager.get_wd(inner) is not None:
                                continue
                            # Generate (simulate) creation events for sub-
                            # directories and files.
                            if os.path.isfile(inner):
                                # symlinks are handled as files.
                                flags = IN_CREATE
                            elif os.path.isdir(inner):
                                flags = IN_CREATE | IN_ISDIR
                            else:
                                # This path should not be taken.
                                continue
                            rawevent = _RawEvent(created_dir_wd, flags, 0, name)
                            self._notifier.append_event(rawevent)
                    except OSError, err:
                        msg = "process_IN_CREATE, invalid directory %s: %s"
                        log.debug(msg % (created_dir, str(err)))
        return self.process_default(raw_event)
304135
def run_on_modifications(paths)
      changed_files, success = Runner.run(Inspector.clean(paths), watchers, options)

      throw :task_has_failed unless success
    end
964754
async def _watch(self):
        

        file_name = os.path.basename(self._file_path)
        logger.info(
            'Watching %s "%s"',
            self.THING,
            self._file_path,
        )

        while self._running:
            evt = await self._watcher.get_event()

            if evt.name == file_name:
                await self._load()
                logger.info(
                    'Reloading changed %s from "%s"',
                    self.THING,
                    self._file_path
                )
693160
function emitChangeEvent(emitter, path, log) {
        emitter.emit("file:changed", {
            path: path,
            log: log,
            namespace: "core",
            event: "change"
        });
    }
589715
def _unwatch_file(self, filepath, trigger_event=True):
        
        if filepath not in self._watched_files:
            return
        if trigger_event:
            self.trigger_deleted(filepath)
        del self._watched_files[filepath]
245652
def update_event(self, event, action, flags):
        
        if action == PYCBC_EVACTION_UNWATCH:
            if event.flags & LCB_READ_EVENT:
                self.reactor.removeReader(event)
            if event.flags & LCB_WRITE_EVENT:
                self.reactor.removeWriter(event)

        elif action == PYCBC_EVACTION_WATCH:
            if flags & LCB_READ_EVENT:
                self.reactor.addReader(event)
            if flags & LCB_WRITE_EVENT:
                self.reactor.addWriter(event)

            if flags & LCB_READ_EVENT == 0:
                self.reactor.removeReader(event)
            if flags & LCB_WRITE_EVENT == 0:
                self.reactor.removeWriter(event)
1095240
def _notify_deleted_file(self):
        
        self.file_deleted.emit(self.editor)
        # file deleted, disable file watcher
        self.enabled = False
1144691
function addWatcher(dirPath) {
    Debug._l(dirPath);
    Watcher(dirPath, function (filePath, action) {
        switch (action) {
            case Watcher.ADD_EVENT:
            case Watcher.CHANGE_EVENT:
                Debug._l(generateIdFromFilePath(filePath));
                generateCache(filePath);
                break;

            case Watcher.DELETE_EVENT:
                removeCache(generateIdFromFilePath(filePath));
                break;

        }
    });

}
115878
def orify(event, changed_callback):
    '''
    

    '''
    event.changed = changed_callback
    if not hasattr(event, '_set'):
        # `set`/`clear` methods have not been overridden on event yet.
        # Override methods to call `changed_callback` after performing default
        # action.
        event._set = event.set
        event._clear = event.clear
        event.set = lambda: or_set(event)
        event.clear = lambda: or_clear(event)
1217930
def on_deleted(self, event):
        
        logger.debug("File deleted: %s", event.src_path)
        if not event.is_directory:
            self.update_file(event.src_path)
1245867
def on_created(self, event):
        
        logger.debug("file created: %s", event.src_path)
        if not event.is_directory:
            self.update_file(event.src_path)
1152943
def on_deleted(self, event):
        
        key = 'filesystem:file_deleted'
        data = {
            'filepath': event.src_path,
            'is_directory': event.is_directory,
            'dirpath': os.path.dirname(event.src_path)
        }

        bmsg = BroadcastMessage(key=key, data=data)
        BroadcastManager.broadcast(bmsg)
812509
function onFileChanged(event) {
		if(event && event.type === 'Changed' && Array.isArray(event.modified)) {
			//event = {type, files: [{name, location, metadata: {contentType}}]}
			event.modified.forEach(function(file) {
				if(typeof file === 'string') {
					_cache.remove(_getKey(file));
				}
			});
		}
	}
961532
def _call_watcher(self_, watcher, event):
        
        if self_.self_or_cls.param._TRIGGER:
            pass
        elif watcher.onlychanged and (not self_._changed(event)):
            return

        if self_.self_or_cls.param._BATCH_WATCH:
            self_._events.append(event)
            if watcher not in self_._watchers:
                self_._watchers.append(watcher)
        elif watcher.mode == 'args':
            with batch_watch(self_.self_or_cls, run=False):
                watcher.fn(self_._update_event_type(watcher, event, self_.self_or_cls.param._TRIGGER))
        else:
            with batch_watch(self_.self_or_cls, run=False):
                event = self_._update_event_type(watcher, event, self_.self_or_cls.param._TRIGGER)
                watcher.fn(**{event.name: event.new})
1219358
void processEvent(DelayQueue<Delayed> delayQueue) {


    // wait for key to be signaled
    WatchKey key;
    try {
      key = watcher.poll(250, TimeUnit.MILLISECONDS);
    } catch (InterruptedException | ClosedWatchServiceException x) {
      return;
    }
    
    if(key == null) {
      return;
    }

    Path dir = keys.get(key);
    if (dir == null) {
      return;
    }

    for (WatchEvent<?> event : key.pollEvents()) {
      WatchEvent.Kind<?> kind = event.kind();

      if (kind == OVERFLOW) {
        continue;
      }

      // Context for directory entry event is the file name of entry
      @SuppressWarnings("unchecked")
      WatchEvent<Path> ev = (WatchEvent<Path>) event;
      Path name = ev.context();
      Path child = dir.resolve(name);

      //
      if (ignore.contains(child)) {
        return;
      }


      if (!ignorePattern.stream().anyMatch(
          m -> child.getFileSystem().getPathMatcher(m).matches(child.getFileName()))) {
        delayQueue.add(new WatchDirDelay());
      }


      // if directory is created, and watching recursively, then
      // register it and its sub-directories
      if (kind == ENTRY_CREATE) {
        try {
          if (Files.isDirectory(child, NOFOLLOW_LINKS)) {
            registerAll(child);
          }
        } catch (IOException x) {
        }
      }
    }


    // reset key and remove from set if directory no longer accessible
    boolean valid = key.reset();
    if (!valid) {
      keys.remove(key);

      // all directories are inaccessible
      if (keys.isEmpty()) {
        return;
      }
    }
  }