<commit_before># encoding: utf-8

module Github
  class Repos
    module Watching

      # List repo watchers
      #
      # = Examples
      #  @github = Github.new :user => 'user-name', :repo => 'repo-name'
      #  @github.repos.watchers
      #  @github.repos.watchers { |watcher| ... }
      #
      def watchers(user_name=nil, repo_name=nil, params={})
        _update_user_repo_params(user_name, repo_name)
        _validate_user_repo_params(user, repo) unless user? && repo?
        _normalize_params_keys(params)

        response = get("/repos/#{user}/#{repo}/watchers")
        return response unless block_given?
        response.each { |el| yield el }
      end

      # List repos being watched by a user
      #
      # = Examples
      #  @github = Github.new :user => 'user-name'
      #  @github.repos.watched
      #
      # List repos being watched by the authenticated user
      #
      # = Examples
      #  @github = Github.new :oauth_token => '...'
      #  @github.repos.watched
      #
      def watched(user_name=nil, params={})
        _update_user_repo_params(user_name)
        _normalize_params_keys(params)

        response = if user
          get("/users/#{user}/watched")
        else
          get("/user/watched")
        end
        return response unless block_given?
        response.each { |el| yield el }
      end

      # Check if you are watching a repository
      #
      # Returns <tt>true</tt> if this repo is watched by you, <tt>false</tt> otherwise
      # = Examples
      #  @github = Github.new
      #  @github.repos.watching? 'user-name', 'repo-name'
      #
      def watching?(user_name, repo_name, params={})
        _validate_presence_of user_name, repo_name
        _normalize_params_keys(params)
        get("/user/watched/#{user_name}/#{repo_name}")
        true
      rescue Github::ResourceNotFound
        false
      end

      # Watch a repository
      #
      # You need to be authenticated to watch a repository
      #
      # = Examples
      #  @github = Github.new
      #  @github.repos.start_watching 'user-name', 'repo-name'
      #
      def start_watching(user_name, repo_name, params={})
        _validate_presence_of user_name, repo_name
        _normalize_params_keys(params)
        put("/user/watched/#{user_name}/#{repo_name}")
      end

      # Stop watching a repository
      #
      # You need to be authenticated to stop watching a repository.
      # = Examples
      #  @github = Github.new
      #  @github.repos.start_watching 'user-name', 'repo-name'
      #
      def stop_watching(user_name, repo_name, params={})
        _validate_presence_of user_name, repo_name
        _normalize_params_keys(params)
        delete("/user/watched/#{user_name}/#{repo_name}")
      end

    end # Watching
  end # Repos
end # Github<commit_msg>Update parameters passing for request methods.<commit_after># encoding: utf-8

module Github
  class Repos
    module Watching

      # List repo watchers
      #
      # = Examples
      #  @github = Github.new :user => 'user-name', :repo => 'repo-name'
      #  @github.repos.watchers
      #  @github.repos.watchers { |watcher| ... }
      #
      def watchers(user_name=nil, repo_name=nil, params={})
        _update_user_repo_params(user_name, repo_name)
        _validate_user_repo_params(user, repo) unless user? && repo?
        _normalize_params_keys(params)

        response = get("/repos/#{user}/#{repo}/watchers", params)
        return response unless block_given?
        response.each { |el| yield el }
      end

      # List repos being watched by a user
      #
      # = Examples
      #  @github = Github.new :user => 'user-name'
      #  @github.repos.watched
      #
      # List repos being watched by the authenticated user
      #
      # = Examples
      #  @github = Github.new :oauth_token => '...'
      #  @github.repos.watched
      #
      def watched(user_name=nil, params={})
        _update_user_repo_params(user_name)
        _normalize_params_keys(params)

        response = if user
          get("/users/#{user}/watched", params)
        else
          get("/user/watched", params)
        end
        return response unless block_given?
        response.each { |el| yield el }
      end

      # Check if you are watching a repository
      #
      # Returns <tt>true</tt> if this repo is watched by you, <tt>false</tt> otherwise
      # = Examples
      #  @github = Github.new
      #  @github.repos.watching? 'user-name', 'repo-name'
      #
      def watching?(user_name, repo_name, params={})
        _validate_presence_of user_name, repo_name
        _normalize_params_keys(params)
        get("/user/watched/#{user_name}/#{repo_name}", params)
        true
      rescue Github::ResourceNotFound
        false
      end

      # Watch a repository
      #
      # You need to be authenticated to watch a repository
      #
      # = Examples
      #  @github = Github.new
      #  @github.repos.start_watching 'user-name', 'repo-name'
      #
      def start_watching(user_name, repo_name, params={})
        _validate_presence_of user_name, repo_name
        _normalize_params_keys(params)
        put("/user/watched/#{user_name}/#{repo_name}", params)
      end

      # Stop watching a repository
      #
      # You need to be authenticated to stop watching a repository.
      # = Examples
      #  @github = Github.new
      #  @github.repos.start_watching 'user-name', 'repo-name'
      #
      def stop_watching(user_name, repo_name, params={})
        _validate_presence_of user_name, repo_name
        _normalize_params_keys(params)
        delete("/user/watched/#{user_name}/#{repo_name}", params)
      end

    end # Watching
  end # Repos
end # Github
{'fraction_non_alphanumeric': 0.1105693888211736, 'fraction_numerical': 0.00034825004353125546, 'mean_word_length': 2.2251544076361593, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2114390', 'n_tokens_mistral': 1802, 'n_tokens_neox': 1770, 'n_words': 398}