Multi-variant of :meth:`observe`
494311
def observe_multi(self, keys, master_only=False):
        """"""
        return _Base.observe_multi(self, keys, master_only=master_only)
390453
def update(observed_method, object, *extra_args, &block) #:nodoc:
      return if !respond_to?(observed_method) || disabled_for?(object)
      send(observed_method, object, *extra_args, &block)
    end
1257847
function watch (specs, handler, options) {
  const err = fileOptions.validate(specs)
  if (err) {
    return Promise.reject(err)
  }
  const normalisedSpecs = fileOptions.normalize(specs)
  const events = new EventEmitter()

  // Option resolving
  const opts = options || {}
  const dir = opts.dir || '.'
  const fileReader = opts.fileReader || readAsFile
  const loader = opts.loader || defaultLoader
  const buildConcurrency = opts.concurrency || 1
  const resolveRoot = path.resolve(opts.resolveRoot || process.cwd())

  // State that is maintained by watching for file changes
  const fileInfos = {}
  const affectedFiles = {}
  const affectedFilesInverse = {}

  function linkingLoader (filename, parentFilename) {
    if (parentFilename) {
      const file = path.relative(dir, filename)
      affectedFiles[file] = affectedFiles[file] || new Set()
      affectedFiles[file].add(parentFilename)

      affectedFilesInverse[parentFilename] = affectedFilesInverse[parentFilename] || new Set()
      affectedFilesInverse[parentFilename].add(file)
      watchFile(file)
    }
    return loader(filename, parentFilename)
  }

  function unlinkFile (filename) {
    delete affectedFiles[filename] // the files affected by changing the file `filename`

    // the files that affect the file `filename`
    if (affectedFilesInverse[filename]) {
      affectedFilesInverse[filename].forEach((affectorFilename) => {
        affectedFiles[affectorFilename].delete(filename)
        if (affectedFiles[affectorFilename].size === 0) {
          delete affectedFiles[affectorFilename]
        }
      })

      delete affectedFilesInverse[filename]
    }
  }

  const inlinedWatcher = chokidar.watch([], {cwd: dir})
  inlinedWatcher.on('change', (filename) => {
    const files = Array.from(getSourceFileObjs(filename))
    Promise.all(files.map((fileInfo) => handleFile(fileInfo, {rootCause: 'change', cause: 'change'})))
      .then(() => events.emit('change', filename))
      .catch(handleFileFailure)
  })

  inlinedWatcher.on('unlink', (filename) => {
    const files = Array.from(getSourceFileObjs(filename))
    unlinkFile(filename)
    Promise.all(files.map((fileInfo) => handleFile(fileInfo, {rootCause: 'delete', cause: 'change'})))
      .then(() => events.emit('delete', filename))
      .catch(handleFileFailure)
  })

  function watchFile (filename) {
    inlinedWatcher.add(filename)
  }

  function getSourceFileObjs (filename, collectorSet) {
    const results = collectorSet || new Set()
    if (affectedFiles[filename]) {
      affectedFiles[filename].forEach((affectedFilename) => {
        if (fileInfos[affectedFilename]) {
          results.add(fileInfos[affectedFilename])
        }
        getSourceFileObjs(affectedFilename, results)
      })
    }
    return results
  }

  function workHandler (work) {
    fileInfos[work.fileInfo.src] = work.fileInfo
    return fileReader(work.fileInfo, { loader: linkingLoader, resolveRoot })
      .then(file => handler(undefined, file, work.cause))
      .catch((err) => {
        if (err instanceof ParseError) {
          return handler(err, new File({info: work.fileInfo, content: undefined}), work.cause)
        } else {
          throw err
        }
      })
      .then((res) => work.resolve(res))
      .catch((err) => work.reject(err))
  }

  const workQueue = new WorkQueue(workHandler, {})

  function handleFile (fileInfo, cause) {
    return new Promise((resolve, reject) => {
      workQueue.add({fileInfo: fileInfo, cause: cause, resolve: resolve, reject: reject})
    })
  }

  function handleFileFailure (err) {
    events.emit('error', err)
  }

  function build () {
    return Promise.all(w.files())
      .map((fileInfo) => {
        return handleFile(fileInfo, {rootCause: 'build', cause: 'build'})
      }, {concurrency: buildConcurrency})
  }

  const w = new Watcher(normalisedSpecs, opts)

  w.on('add', (fileInfo) => {
    return handleFile(fileInfo, {rootCause: 'add', cause: 'add'})
      .then(() => events.emit('add', fileInfo.src))
      .catch(handleFileFailure)
  })

  w.on('change', (fileInfo) => {
    return handleFile(fileInfo, {rootCause: 'change', cause: 'change'})
      .then(() => events.emit('change', fileInfo.src))
      .catch(handleFileFailure)
  })

  w.on('remove', (fileInfo) => {
    unlinkFile(fileInfo.src)
    events.emit('delete', fileInfo.src)
  })

  return w._promise.then(() => ({build: build, events: events}))
}
1139094
function watch(arg_src_dir)
{
	console.info('Watching for change on: ' + arg_src_dir)
	
	const watch_settings = { ignored: /[\/\\]\./, persistent: true }
	var watcher = chokidar.watch(arg_src_dir, watch_settings)
	watcher.on('change', reload_file)
	
	return watcher
}
1363585
def observed(cls, _func):
        

        def wrapper(*args, **kwargs):
            self = args[0]
            assert(isinstance(self, Observable))

            self._notify_method_before(self, _func.__name__, args, kwargs)
            res = _func(*args, **kwargs)
            self._notify_method_after(self, _func.__name__, res, args, kwargs)
            return res

        return wrapper
1070830
def do_watch(self, *args):
        
        tables = []
        if not self.engine.cached_descriptions:
            self.engine.describe_all()
        all_tables = list(self.engine.cached_descriptions)
        for arg in args:
            candidates = set((t for t in all_tables if fnmatch(t, arg)))
            for t in sorted(candidates):
                if t not in tables:
                    tables.append(t)

        mon = Monitor(self.engine, tables)
        mon.start()
16562
def beholder_ng(func):
    """"""
    @functools.wraps(func)
    def behold(file, length, *args, **kwargs):
        seek_cur = file.tell()
        try:
            return func(file, length, *args, **kwargs)
        except Exception:
            # from pcapkit.foundation.analysis import analyse
            from pcapkit.protocols.raw import Raw
            error = traceback.format_exc(limit=1).strip().split(os.linesep)[-1]
            # error = traceback.format_exc()

            file.seek(seek_cur, os.SEEK_SET)

            # raw = Raw(file, length, error=str(error))
            # return analyse(raw.info, raw.protochain, raw.alias)
            next_ = Raw(file, length, error=error)
            return next_
    return behold
655834
async def seen(self, tick, source=None):
        '''
        
        '''
        await self.set('.seen', tick)

        if source is not None:
            seen = await self.snap.addNode('meta:seen', (source, self.ndef))
            await seen.set('.seen', tick)
810166
function specToWatcherObj (watcherInstance, spec, options) {
  const dest = options.dest
  return new Promise((resolve, reject) => {
    const watcher = chokidar.watch(spec.files, {cwd: options.dir})
      .on('ready', () => {
        resolve({
          watcher: watcher,
          spec: spec
        })
      })
      .on('error', (err) => reject(err))
      .on('add', (path) => watcherInstance.emit('add', fileOptions.createFileUsingSpec(path, spec, dest)))
      .on('change', (path) => watcherInstance.emit('change', fileOptions.createFileUsingSpec(path, spec, dest)))
      .on('unlink', (path) => watcherInstance.emit('remove', fileOptions.createFileUsingSpec(path, spec, dest)))
  })
}
636185
def let meth, &proc
      proc || raise(ArgumentError, 'block is missing')
      vars[meth] = proc
      define_method(meth) { @__ms__vars[meth] ||= self.instance_exec(&proc) }
    end
1270347
def observe_id(self):
        """"""
        if self._observe_id is None:
            hasher = hashlib.sha256()
            hasher.update(self.viewset_class.__module__.encode('utf8'))
            hasher.update(self.viewset_class.__name__.encode('utf8'))
            hasher.update(self.viewset_method.encode('utf8'))
            # Arguments do not need to be taken into account as they are
            # derived from the request path, which is already accounted for.
            for key in sorted(self.GET.keys()):
                hasher.update(key.encode('utf8'))
                hasher.update(self.GET[key].encode('utf8'))
            hasher.update(self.path.encode('utf8'))
            hasher.update(self.path_info.encode('utf8'))
            if self._force_auth_user is not None:
                hasher.update(
                    (str(self._force_auth_user.id) or 'anonymous').encode('utf8')
                )
            else:
                hasher.update(b'anonymous')
            self._observe_id = hasher.hexdigest()

        return self._observe_id
1338768
function (observe, how, where) {
            // Go through each property.
            observe.each(function (val, name) {
                // If the value is an `object`, and has an `attrs` or `serialize` function.
                where[name] = canMakeObserve(val) && can.isFunction(val[how]) ?
                // Call `attrs` or `serialize` to get the original data back.
                val[how]() :
                // Otherwise return the value.
                val;
            });
            return where;
        }
1208841
def _augment_observation_files(self, e):
        
        e.file_records = [self._augment_file(f) for f in e.file_records]
        return e
207101
void observe(FolderObserver observer) {
    synchronized (idleMutex) {
      this.observer = observer;
      pushedData = new PushedData();
      idleAcknowledged.set(false);
    }
  }
1309523
def adapt_obsres(self, obsres):
        """"""

        _logger.debug('adapt observation result for work dir')
        for f in obsres.images:
            # Remove path components
            f.filename = os.path.basename(f.filename)
        return obsres
608938
def watch_and_run(monitor, times, recursively, directory, *flags)
      result = OpenStruct.new(directory: directory, changes: [])
      i = 0
      result.changes[i] = OpenStruct.new(called: false)
      can_return = false
      callback = Proc.new do |change|
        next if can_return

        result.changes[i].called = true;
        result.changes[i].change = change

        i += 1

        if i < times
          result.changes[i] = OpenStruct.new(called: false)
        else
          can_return = true
        end
      end

      if recursively
        monitor.watch_recursively(directory, *flags, &callback)
      else
        monitor.watch(directory, *flags, &callback)
      end

      thread = Thread.new(monitor) { |m| m.run! }
      sleep(0.2) # give time for the monitor to bootup

      yield # So much boilerplate code to get here :S

      sleep(0.2) # allow the monitor to run the callbacks

      # Nothing can change after the callback if there is only one of them,
      # so never wait for one callback
      if times > 1
        until can_return
          sleep(0.1)
        end
      end

      return result
    ensure
      monitor.stop
      thread.join if thread
    end
1108817
function watch (glob, watchOpt) {
    if (!started) {
      deferredWatch = emitter.watch.bind(null, glob, watchOpt)
    } else {
      // destroy previous
      if (fileWatcher) fileWatcher.close()
      glob = glob && glob.length > 0 ? glob : defaultWatchGlob
      glob = Array.isArray(glob) ? glob : [ glob ]
      watchOpt = xtend({ poll: opts.poll }, watchOpt)

      fileWatcher = createFileWatch(glob, watchOpt)
      fileWatcher.on('watch', emitter.emit.bind(emitter, 'watch'))
    }
    return emitter
  }