ensures that threshold + 1 nodes are being watched
489705
def watch_appropriate_nodes
        remaining_paths.last( threshold + 1 ).reverse_each do |path|
          next if watched_paths.include? path
          watched_paths << path
          finish_node(path) unless zk.exists?(path, :watch => true)
        end
      end
214765
private void _watchNode(String path) throws ZooKeeperException {
        try {
            cacheNodeWatcher.get(path);
        } catch (Exception e) {
            if (e instanceof ZooKeeperException) {
                throw (ZooKeeperException) e;
            } else {
                throw new ZooKeeperException(e);
            }
        }
    }
671070
function setupWatchers(path) {
    // We want to track the watchers now and return if we are already watching this folder
    if (watchingFolders[path]) { return; }

    watchingFolders[path] = fs.watch(path, getWatcher(path + "/"));
    watchingFolders[path].on('error', function() {  verifyWatches(); });
    var fileList = fs.readdirSync(path);
    var stats;
    for (var i = 0; i < fileList.length; i++) {
        try {
            stats = fs.statSync(path + "/" + fileList[i]);
        }
        catch (e) {
            continue;
        }
        if (isWatching(fileList[i])) {
            timeStamps[path + "/" + fileList[i]] = stats.mtime.getTime();
        } else {
            if (stats.isDirectory()) {
                if (fileList[i] === "node_modules") {
                    watchingFolders[path + "/" + fileList[i]] = true;
                    continue;
                }
                if (fileList[i] === "tns_modules") {
                    watchingFolders[path + "/" + fileList[i]] = true;
                    continue;
                }
                if (fileList[i] === "App_Resources") {
                    watchingFolders[path + "/" + fileList[i]] = true;
                    continue;
                }
                setupWatchers(path + "/" + fileList[i]);
            }
        }
    }
}
790133
function notifyWatchersOnPaths(paths) {
    var expandedPaths = _expandNestedPaths(paths);

    watchers.map(function _notifyWatcher(watcher) {
      var hasPath = intersect(expandedPaths, watcher.paths).length > 0;

      if (hasPath) {
        var watchedKeyValues = {};
        try {
          watchedKeyValues = getAll(paths);
        } catch (e) {}

        if (watcher.options.async !== false) {
          setTimeout(function () {
            watcher.callback(watchedKeyValues);
          }, watcher.options.async || 0);
        } else {
          watcher.callback(watchedKeyValues);
        }
      }
    });

    if (paths !== '*') {
      notifyGlobalWatchers();
    }
  }
392346
def check_spectator(node_method):
    
    from functools import wraps
    @wraps(node_method)
    def wrapper(*args, **kwargs):
        node = args[0]
        if node.in_spectator_mode:
            #raise node.SpectatorError("You should not call this method when the node in spectator_mode")
            #warnings.warn("You should not call %s when the node in spectator_mode" % node_method)
            import warnings

        return node_method(*args, **kwargs)

    return wrapper
1346644
def stop_watching(self, cluster):
        
        znode_path = "/".join([self.base_path, cluster.name])
        if znode_path in self.stop_events:
            self.stop_events[znode_path].set()
190163
def reset(self):
        """"""
        watchers.MATCHER.debug("Node <%s> reset", self)
        self._reset()
        for child in self.children:
            child.node.reset()
407454
def _users_watching(self, **kwargs):
        """"""
        return self._users_watching_by_filter(object_id=self.instance.pk,
                                              **kwargs)
1122605
def _start_watching_blocks(self):
        '''
        
        '''
        if sum(map(len, (self.solid_watchers, self.block_watchers))) == 1:
            eth.filter('latest').watch(self._new_block)
25564
def threshold(args):
    """"""
    if args.fpr < 0 or args.fpr > 1:
        print("Please specify a FPR between 0 and 1")
        sys.exit(1)

    motifs = read_motifs(args.pwmfile)
    
    s = Scanner()
    s.set_motifs(args.pwmfile)
    s.set_threshold(args.fpr, filename=args.inputfile)

    print("Motif\tScore\tCutoff")
    for motif in motifs:
        min_score = motif.pwm_min_score()
        max_score = motif.pwm_max_score()
        opt_score = s.threshold[motif.id]
        if opt_score is None:
            opt_score = motif.pwm_max_score()
        threshold = (opt_score - min_score) / (max_score - min_score)
        print("{0}\t{1}\t{2}".format(
                motif.id, opt_score, threshold))
656102
function shouldHaveShardedOverlays(node) {
            return Object.keys(self.getProperty(node, CONSTANTS.OVERLAYS_PROPERTY) || {}).length >=
                _shardingLimit && self.getPath(node).indexOf('_') === -1;
        }
1072251
function(connect) {
		var obs = this._observer;
		if (obs) {
			if (connect) {
				obs.observe(document, {
					childList: true,
					subtree: true
				});
			} else {
				obs.disconnect();
			}
		}
	}
1359666
def start_watching(self):
        
        if not self.is_sync:
            return

        self._stop = False
        while not self._stop:
            self.reactor.doIteration(0)
656436
def run_once_on_threshold(callback, mv_lower, mv_upper, mv_reset=10, interval=0.01)
      AIN::run_once_on_threshold(callback, @pin, mv_lower, mv_upper, mv_reset, interval)
    end
290796
function setCallbackAsWatcherOf(callback, watchersSet) {
    if (!callback[WATCHER_IDENTIFIER]) {
        defineProperty(callback, WATCHER_IDENTIFIER, { watching: new Set() });

        defineProperty(callback, "stopWatchingAll", function(){
            callback[WATCHER_IDENTIFIER].watching.forEach(watcherList =>
                watcherList.delete(callback)
            );
            callback[WATCHER_IDENTIFIER].watching.clear();
        });
    }

    callback[WATCHER_IDENTIFIER].watching.add(watchersSet);
}
1038357
def isconnected(mask):
    

    nodes_to_check = list((np.where(mask[0, :])[0])[1:])
    seen = [True] + [False] * (len(mask) - 1)
    while nodes_to_check and not all(seen):
        node = nodes_to_check.pop()
        reachable = np.where(mask[node, :])[0]
        for i in reachable:
            if not seen[i]:
                nodes_to_check.append(i)
                seen[i] = True
    return all(seen)
568062
function threshold(event) {
      var settings = Glide.settings;

      if (MOUSE_EVENTS.indexOf(event.type) > -1) {
        return settings.dragThreshold;
      }

      return settings.swipeThreshold;
    }