Submits a watch action request.
 @param (see #watch)
 @param unwatch [Boolean] Whether the request should unwatch the pages or not.
 @return (see #watch)
430108
def watch_request(titles, unwatch = false)
      titles = titles.is_a?(Array) ? titles : [titles]
      params = {
        action: 'watch',
        titles: titles.shift(get_limited(titles.length, 50, 500)).join('|'),
        token: get_token('watch')
      }
      success_key = 'watched'
      if unwatch
        params[:unwatch] = 1
        success_key = 'unwatched'
      end

      post(params)['watch'].inject({}) do |result, entry|
        title = entry['title']
        if entry.key?(success_key)
          result[title] = entry.key?('missing') ? nil : true
        else
          result[title] = false
        end

        result
      end
    end
864027
def remove_watcher(self, issue, watcher):
        
        url = self._get_url('issue/' + str(issue) + '/watchers')
        params = {'username': watcher}
        result = self._session.delete(url, params=params)
        return result
886919
def clear_watch_restrictions(event, watch_type)
      return unless event.node_event?

      if watch_type
        logger.debug { "re-allowing #{watch_type.inspect} watches on path #{event.path.inspect}" }
        
        # we recieved a watch event for this path, now we allow code to set new watchers
        @outstanding_watches[watch_type].delete(event.path)
      end
    end
127111
def post(self, request, *args, **kwargs):
        
        return self.unsubscribe(request, *args, **kwargs)
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}
        )
978628
def cmd_watch(args):
    ''''''
    if len(args) == 0:
        mpstate.status.watch = None
        return
    mpstate.status.watch = args
    print("Watching %s" % mpstate.status.watch)
447380
def unblock(self, item: str) -> None:
        
        assert item is not None
        item = self._encode_item(item)
        watchlist_key = self.__redis_conf['watchlist_template'].format(item)
        blacklist_key = self.__redis_conf['blacklist_template'].format(item)
        connection = self.__get_connection()
        connection.delete(watchlist_key)
        connection.delete(blacklist_key)
        BlackRed.__release_connection(connection)
643396
def receive_optout_post(params, request)
      if request.post?
        [:action, :email, :sig].each { |key| return false unless params.has_key?(key) }

        return false unless params[:action] == 'optout'

        sig = params.delete(:sig)
        params.delete(:controller)
        sig == get_signature_hash(params, @secret)
      else
        false
      end
    end
352042
def handle_action
      timeline_item = find_timeline_item(self.glass_item_id)

      # TODO: Should we uniq these? When glass doesn't have connection, it will queue up
      # actions, so users might press the same one multiple times.
      user_actions.uniq.each do |user_action|
        type = user_action[:type] == "CUSTOM" ? user_action[:payload] : user_action[:type]
        json_to_return = self.reply_request_hash ? self.reply_request_hash : self.params
        timeline_item.send("handles_#{type.downcase}", json_to_return)
      end if user_actions
    end
153651
public function postUnwatch(Request $request)
    {
        $item = Item::findOrFail($request->input('item_id'));

        if (!Auth::user()->watching->contains($item)) {
            return redirect()->back()->withErrors(["You aren't watching this item."]);
        }

        Auth::user()->watching()->detach($item);

        return redirect()->back()->withStatus($item->name.' has been removed from your watched items.');
    }
972850
def execute_watch(self, id=None, body=None, params=None):
        
        return self.transport.perform_request(
            "PUT",
            _make_path("_watcher", "watch", id, "_execute"),
            params=params,
            body=body,
        )
1239813
public function postWatch(Request $request)
    {
        $item = Item::findOrFail($request->input('item_id'));

        if (Auth::user()->watching->contains($item)) {
            return redirect()->back()->withErrors(['You are already watching this item.']);
        }

        if (!$item->isActive()) {
            return redirect()->back()->withErrors(['You cannot watch an inactive item.']);
        }

        Auth::user()->watching()->save($item, [
            'added' => time(),
        ]);

        return redirect()->back()->withStatus($item->name.' has been added to your watched items.');
    }
1322862
def restricting_new_watches_for?(watch_type, path)
      synchronize do
        if set = @outstanding_watches[watch_type]
          return set.include?(path)
        end
      end

      false
    end
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;

        }
    });

}
121657
function unwatchFile(watcher, filename) {
    if (watcher) {
        watcher.close && watcher.close();
    } else {
        fs.unwatchFile(filename);
    }
}
865477
def stop_watch(self):
        

        if self.greenlet_watch:
            self.greenlet_watch.kill(block=False)
            self.greenlet_watch = None
791275
function watch(watchOptions) {

      var watcher = chokidar.watch(watchOptions.dirs, {
        ignoreInitial: true,
        ignored: /[/\\]\./
      });

      watcher.on('add', function(pathFile) {
        onWatcher(pathFile);
      });

      watcher.on('change', function(pathFile) {
        onWatcher(pathFile);
      });

      watcher.on('unlink', function(pathFile) {
        onWatcher(pathFile);
      });

      var updating = false;
      var queued = null;

      function onWatcher(pathFile) {

        if (updating) {
          queued = pathFile;
          return;
        }

        queued = null;
        updating = true;

        return Promise.resolve()
          .then(function() {
            return watchOptions.onFile(pathFile);
          })
          .then(function() {
            return Promise.delay(1000);
          })
          .then(function() {
            updating = false;
            if (queued) {
              return onWatcher(queued);
            }
          });
      }
    }