Gladius Forge watchers setup function. It takes a list of extra watchers
to add to the process.
@param  {list<function>} extraWatchers: List of extra watchers to add.
513670
function(addExtraWatchers) {
  /* Watchers -------------------------------------------------------------- */
  gulp.task('watch', ['serve'], function () {
    gulp.watch(paths.src.es6, ['bundle-js:dev:clean']);
    gulp.watch(paths.src.js, ['bundle-js:dev:clean']);
    gulp.watch(paths.src.styles, ['styles']);
    gulp.watch(paths.src.views, ['tpl-reload']);
    gulp.watch(paths.out.base + '**/*', ['reload']);

    addExtraWatchers && addExtraWatchers(gulp);
  });
}
435915
function makeObserver(handlers) {
  console.assert(handlers && typeof handlers === 'object', "Argument to makeObserver must be hash.");
  var handler = assign(create(observerPrototype), handlers);
  var observer = handler.handle.bind(handler);
  observer.keys = getTypesFromHandlers(handlers);
  return observer;
}
1035154
def add_to_watched(self, watched):
        
        assert isinstance(watched, github.Repository.Repository), watched
        headers, data = self._requester.requestJsonAndCheck(
            "PUT",
            "/repos/" + watched._identity + "/subscription",
            input={"subscribed": True}
        )
913672
@Deprecated
  public FluoConfiguration addObservers(Iterable<ObserverSpecification> observers) {
    int next = getNextObserverId();
    for (ObserverSpecification oconf : observers) {
      addObserver(oconf, next++);
    }
    return this;
  }
267390
function setupErrorCatching() {
    process.on('uncaughtException', function (err) {
        if (err.toString() === "Error: watch EPERM") {
            // Silly User decided to DELETE a watched folder....  Need to eliminate the watch so it can be watched when they re-add it again.
            verifyWatches();
        } else {
            console.error(err);
        }
    });
}
42374
function(object, extra_helpers) {
      object = object || {};
      this._extra_helpers = extra_helpers;
      var v = new EJS.Helpers(object, extra_helpers || {});
      return this.template.process.call(object, object,v);
    }
1149968
function addPlayer(userId, callbacks) {
        let player = factory.addPlayer();
        if(!player) return null;

        self._callbacks.set(player, callbacks);

        // If the game didn't have an owner, it does now
        // This should only happen when the game is first created
        // and the initial player is added
        if(!owner)
            owner = player;

        self._users[userId] = { id: userId, player };

        return player;
    }
569127
function addVisitFunction(type) {
    ASTVisitor.prototype['visit' + type] = function(node) {
        var self = this;
        var extraArgs = Array.prototype.slice.call(arguments, 1);

        if (DEBUG) {
            checkNode(node);
        }

        NODE_CHILDREN[type].forEach(function(property) {
            var value = node[property];

            if (_.isArray(value)) {
                value.forEach(function(item) {
                    if (item !== null) {
                        self.visit.apply(self, [item].concat(extraArgs));
                    }
                });
            } else if (value !== null && value !== undefined) {
                self.visit.apply(self, [value].concat(extraArgs));
            }
        });
    };
}
927050
function addSwatchGroup(name) {
  var swatchGroup = doc.swatchGroups.add();
  swatchGroup.name = name;

  return swatchGroup;
}
873654
public function addToWatchFolders($path, $watch_folders)
    {
        collect($watch_folders)->each(function ($folder) use ($path) {
            $this->watchFolders[] = !file_exists($new = make_path([$path, $folder])) && file_exists($folder)
                ? $folder
                : $new;
        });
    }
1084265
function beginWatch() {
    let watchPaths = []
    let outputs = []

    util.each(cfgArr, function(config) {
      outputs = outputs.concat(config.output)
      watchPaths = watchPaths.concat(config.files)
      watchPaths = watchPaths.concat(config.libPaths)
    })

    chokidar
      .watch(watchPaths, {
        persistent: true,
        ignored: outputs,
        ignoreInitial: true,
        followSymlinks: true,
        usePolling: true,
        alwaysStat: false,
        interval: 100,
        atomic: true,
        ignorePermissionErrors: false
      })
      .on('change', function() {
        i = 0
        build(cfgArr[i], true)
      })
  }
1148573
function SwaggerWatcher(server) {
  var self = this;
  self.server = server;

  /**
   * The Swagger API files that are being watched.
   * @type {FSWatcher[]}
   */
  self.watchedSwaggerFiles = [];

  /**
   * The Handler files that are being watched.
   * @type {FSWatcher[]}
   */
  self.watchedHandlerFiles = [];

  // Watch Swagger API files
  server.on('parsed', function(err, api, parser) {
    // Watch all the files that were parsed
    self.unwatchSwaggerFiles();
    self.watchSwaggerFiles(parser.$refs.paths('fs'));
  });

  // Watch Handler Files
  server.on('handled', function(err, filePaths) {
    self.unwatchHandlerFiles(filePaths);
    self.watchHandlerFiles(filePaths);
  });
}
1064015
def addWatchedDirectory(self, dirname, watching=Purr.WATCHED, save_config=True):
        """"""
        # see if we're alredy watching this exact set of directories -- do nothing if so
        dirname = Purr.canonizePath(dirname)
        # do nothing if already watching
        if dirname in self.watched_dirs:
            dprint(1, "addWatchDirectory(): already watching %s\n", dirname)
            # watching=None means do not change the watch-state
            if watching is None:
                return
        else:
            if watching is None:
                watching = Purr.WATCHED
            # make watcher object
            wdir = Purrer.WatchedDir(dirname, mtime=self.timestamp,
                                     watch_patterns=self._watch_patterns, ignore_patterns=self._ignore_patterns)
            # fileset=None indicates error reading directory, so ignore it
            if wdir.fileset is None:
                print("There was an error reading the directory %s, will stop watching it." % dirname)
                self.setWatchingState(dirname, Purr.REMOVED, save_config=True)
                return
            self.watchers[dirname] = wdir
            self.watched_dirs.append(dirname)
            dprintf(2, "watching directory %s, mtime %s, %d files\n",
                    dirname, time.strftime("%x %X", time.localtime(wdir.mtime)), len(wdir.fileset))
            # find files in this directory matching the watch_patterns, and watch them for changes
            watchset = set()
            for patt in self._watch_patterns:
                watchset.update(fnmatch.filter(wdir.fileset, patt))
            for fname in watchset:
                quiet = matches_patterns(fname, self._quiet_patterns)
                fullname = Purr.canonizePath(os.path.join(dirname, fname))
                if fullname not in self.watchers:
                    wfile = Purrer.WatchedFile(fullname, quiet=quiet, mtime=self.timestamp)
                    self.watchers[fullname] = wfile
                    dprintf(3, "watching file %s, timestamp %s, quiet %d\n",
                            fullname, time.strftime("%x %X", time.localtime(wfile.mtime)), quiet)
            # find subdirectories  matching the subdir_patterns, and watch them for changes
            for fname in wdir.fileset:
                fullname = Purr.canonizePath(os.path.join(dirname, fname))
                if os.path.isdir(fullname):
                    for desc, dir_patts, canary_patts in self._subdir_patterns:
                        if matches_patterns(fname, dir_patts):
                            quiet = matches_patterns(fname, self._quiet_patterns)
                            wdir = Purrer.WatchedSubdir(fullname, canary_patterns=canary_patts, quiet=quiet,
                                                        mtime=self.timestamp)
                            self.watchers[fullname] = wdir
                            dprintf(3, "watching subdirectory %s/{%s}, timestamp %s, quiet %d\n",
                                    fullname, ",".join(canary_patts),
                                    time.strftime("%x %X", time.localtime(wdir.mtime)), quiet)
                            break
        # set state and save config
        self.setWatchingState(dirname, watching, save_config=save_config)
793237
function(self, agent, id, cb) {
  let msg = {action: 'subscribe', id: id};
  agent.request(Constants.KEYWORDS.MASTER_WATCHER, msg, function(err, servers) {
    if(err) {
      logger.error('subscribeRequest request to master with error: %j', err.stack);
      utils.invokeCallback(cb, err);
    }
    let res = [];
    for(let id in servers) {
      res.push(servers[id]);
    }
    addServers(self, res);
    utils.invokeCallback(cb);
  });
}
486019
def _add_extra_handlers(self, handlers):
        
        extra_handlers = [(h[0], h[1], {"microservice": self}) for h in self.extra_handlers]
        handlers.extend(extra_handlers)
26827
def add_subscribers(self, subscribers, **kwargs):
        
        if subscribers:
            with self._callbacks_lock:
                self._add_subscribers_for_type(
                    'done', subscribers, self._done_callbacks, **kwargs)
                self._add_subscribers_for_type(
                    'queued', subscribers, self._queued_callbacks, **kwargs)
                self._add_subscribers_for_type(
                    'progress', subscribers, self._progress_callbacks, **kwargs)
930794
def AddWatchOnly(self, script_hash):
        
        if script_hash in self._contracts:
            logger.error("Address already in contracts")
            return

        self._watch_only.append(script_hash)