nodes: 0, module; 1, function_definition; 2, function_name:get_prs; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, expression_statement; 15, expression_statement; 16, if_statement; 17, expression_statement; 18, expression_statement; 19, comment:# Build API arguments, as necessary.; 20, if_statement; 21, if_statement; 22, if_statement; 23, comment:# Only pass the following API args if they're not the defaults listed.; 24, if_statement; 25, if_statement; 26, if_statement; 27, expression_statement; 28, expression_statement; 29, for_statement; 30, return_statement; 31, identifier:repo_name; 32, None; 33, identifier:profile; 34, string; 35, identifier:state; 36, string; 37, identifier:head; 38, None; 39, identifier:base; 40, None; 41, identifier:sort; 42, string; 43, identifier:direction; 44, string; 45, identifier:output; 46, string; 47, identifier:per_page; 48, None; 49, string; 50, assignment; 51, comparison_operator:repo_name is None; 52, block; 53, assignment; 54, assignment; 55, identifier:head; 56, block; 57, identifier:base; 58, block; 59, identifier:per_page; 60, block; 61, boolean_operator; 62, block; 63, boolean_operator; 64, block; 65, boolean_operator; 66, block; 67, assignment; 68, assignment; 69, identifier:pr_; 70, identifier:prs; 71, block; 72, identifier:ret; 73, string_content:github; 74, string_content:open; 75, string_content:created; 76, string_content:desc; 77, string_content:min; 78, string_content:Returns information for all pull requests in a given repository, based on
      the search options provided.
  
      .. versionadded:: 2017.7.0
  
      repo_name
          The name of the repository for which to list pull requests. This
          argument is required, either passed via the CLI, or defined in the
          configured profile. A ``repo_name`` passed as a CLI argument will
          override the ``repo_name`` defined in the configured profile, if
          provided.
  
      profile
          The name of the profile configuration to use. Defaults to ``github``.
  
      state
          Indicates the state of the pull requests to return. Can be either
          ``open``, ``closed``, or ``all``. Default is ``open``.
  
      head
          Filter pull requests by head user and branch name in the format of
          ``user:ref-name``. Example: ``'github:new-script-format'``. Default
          is ``None``.
  
      base
          Filter pulls by base branch name. Example: ``gh-pages``. Default is
          ``None``.
  
      sort
          What to sort results by. Can be either ``created``, ``updated``,
          ``popularity`` (comment count), or ``long-running`` (age, filtering
          by pull requests updated within the last month). Default is ``created``.
  
      direction
          The direction of the sort. Can be either ``asc`` or ``desc``. Default
          is ``desc``.
  
      output
          The amount of data returned by each pull request. Defaults to ``min``.
          Change to ``full`` to see all pull request output.
  
      per_page
          GitHub paginates data in their API calls. Use this value to increase or
          decrease the number of pull requests gathered from GitHub, per page. If
          not set, GitHub defaults are used. Maximum is 100.
  
      CLI Example:
  
      .. code-block:: bash
  
          salt myminion github.get_prs
          salt myminion github.get_prs base=2016.11; 79, identifier:org_name; 80, call; 81, identifier:repo_name; 82, None; 83, expression_statement; 84, identifier:action; 85, call; 86, identifier:args; 87, dictionary; 88, expression_statement; 89, expression_statement; 90, expression_statement; 91, identifier:state; 92, comparison_operator:state != 'open'; 93, expression_statement; 94, identifier:sort; 95, comparison_operator:sort != 'created'; 96, expression_statement; 97, identifier:direction; 98, comparison_operator:direction != 'desc'; 99, expression_statement; 100, identifier:ret; 101, dictionary; 102, identifier:prs; 103, call; 104, expression_statement; 105, if_statement; 106, identifier:_get_config_value; 107, argument_list; 108, assignment; 109, attribute; 110, argument_list; 111, assignment; 112, assignment; 113, assignment; 114, identifier:state; 115, string; 116, assignment; 117, identifier:sort; 118, string; 119, assignment; 120, identifier:direction; 121, string; 122, assignment; 123, identifier:_query; 124, argument_list; 125, assignment; 126, comparison_operator:output == 'full'; 127, block; 128, else_clause; 129, identifier:profile; 130, string; 131, identifier:repo_name; 132, call; 133, string; 134, identifier:join; 135, list; 136, subscript; 137, identifier:head; 138, subscript; 139, identifier:base; 140, subscript; 141, identifier:per_page; 142, string_content:open; 143, subscript; 144, identifier:state; 145, string_content:created; 146, subscript; 147, identifier:sort; 148, string_content:desc; 149, subscript; 150, identifier:direction; 151, identifier:profile; 152, keyword_argument; 153, keyword_argument; 154, keyword_argument; 155, identifier:pr_id; 156, call; 157, identifier:output; 158, string; 159, expression_statement; 160, block; 161, string_content:org_name; 162, identifier:_get_config_value; 163, argument_list; 164, string_content:/; 165, string; 166, identifier:org_name; 167, identifier:repo_name; 168, identifier:args; 169, string; 170, identifier:args; 171, string; 172, identifier:args; 173, string; 174, identifier:args; 175, string; 176, identifier:args; 177, string; 178, identifier:args; 179, string; 180, identifier:action; 181, identifier:action; 182, identifier:command; 183, string; 184, identifier:args; 185, identifier:args; 186, attribute; 187, argument_list; 188, string_content:full; 189, assignment; 190, expression_statement; 191, identifier:profile; 192, string; 193, string_content:repos; 194, string_content:head; 195, string_content:base; 196, string_content:per_page; 197, string_content:state; 198, string_content:sort; 199, string_content:direction; 200, string_content:pulls; 201, identifier:pr_; 202, identifier:get; 203, string; 204, subscript; 205, identifier:pr_; 206, assignment; 207, string_content:repo_name; 208, string_content:id; 209, identifier:ret; 210, identifier:pr_id; 211, subscript; 212, call; 213, identifier:ret; 214, identifier:pr_id; 215, identifier:_format_pr; 216, argument_list; 217, identifier:pr_
code: def get_prs(repo_name=None,
              profile='github',
              state='open',
              head=None,
              base=None,
              sort='created',
              direction='desc',
              output='min',
              per_page=None):
      '''
      Returns information for all pull requests in a given repository, based on
      the search options provided.
  
      .. versionadded:: 2017.7.0
  
      repo_name
          The name of the repository for which to list pull requests. This
          argument is required, either passed via the CLI, or defined in the
          configured profile. A ``repo_name`` passed as a CLI argument will
          override the ``repo_name`` defined in the configured profile, if
          provided.
  
      profile
          The name of the profile configuration to use. Defaults to ``github``.
  
      state
          Indicates the state of the pull requests to return. Can be either
          ``open``, ``closed``, or ``all``. Default is ``open``.
  
      head
          Filter pull requests by head user and branch name in the format of
          ``user:ref-name``. Example: ``'github:new-script-format'``. Default
          is ``None``.
  
      base
          Filter pulls by base branch name. Example: ``gh-pages``. Default is
          ``None``.
  
      sort
          What to sort results by. Can be either ``created``, ``updated``,
          ``popularity`` (comment count), or ``long-running`` (age, filtering
          by pull requests updated within the last month). Default is ``created``.
  
      direction
          The direction of the sort. Can be either ``asc`` or ``desc``. Default
          is ``desc``.
  
      output
          The amount of data returned by each pull request. Defaults to ``min``.
          Change to ``full`` to see all pull request output.
  
      per_page
          GitHub paginates data in their API calls. Use this value to increase or
          decrease the number of pull requests gathered from GitHub, per page. If
          not set, GitHub defaults are used. Maximum is 100.
  
      CLI Example:
  
      .. code-block:: bash
  
          salt myminion github.get_prs
          salt myminion github.get_prs base=2016.11
      '''
      org_name = _get_config_value(profile, 'org_name')
      if repo_name is None:
          repo_name = _get_config_value(profile, 'repo_name')
  
      action = '/'.join(['repos', org_name, repo_name])
      args = {}
  
      # Build API arguments, as necessary.
      if head:
          args['head'] = head
      if base:
          args['base'] = base
      if per_page:
          args['per_page'] = per_page
  
      # Only pass the following API args if they're not the defaults listed.
      if state and state != 'open':
          args['state'] = state
      if sort and sort != 'created':
          args['sort'] = sort
      if direction and direction != 'desc':
          args['direction'] = direction
  
      ret = {}
      prs = _query(profile, action=action, command='pulls', args=args)
  
      for pr_ in prs:
          pr_id = pr_.get('id')
          if output == 'full':
              ret[pr_id] = pr_
          else:
              ret[pr_id] = _format_pr(pr_)
  
      return ret