Returns the PullRequest as a PRInfo object
353080
def get_pr_info(requester, reponame, number):
    ""
    resp = requester.get(
        'https://api.github.com/repos/%s/pulls/%s' % (reponame, number))
    return PRInfo(resp.json())
887799
def request_fetch(self, user, repo, request, pull=False, force=False): #pragma: no cover
        '''
        '''
        raise NotImplementedError
1273323
def get_repo_info(loader, sha, prov_g):
    """"""
    user_repo = loader.getFullName()
    repo_title = loader.getRepoTitle()
    contact_name = loader.getContactName()
    contact_url = loader.getContactUrl()
    commit_list = loader.getCommitList()
    licence_url = loader.getLicenceURL()

    # Add the API URI as a used entity by the activity
    if prov_g:
        prov_g.add_used_entity(loader.getRepoURI())

    prev_commit = None
    next_commit = None
    version = sha if sha else commit_list[0]
    if commit_list.index(version) < len(commit_list) - 1:
        prev_commit = commit_list[commit_list.index(version) + 1]
    if commit_list.index(version) > 0:
        next_commit = commit_list[commit_list.index(version) - 1]

    info = {
        'version': version,
        'title': repo_title,
        'contact': {
            'name': contact_name,
            'url': contact_url
        },
        'license': {
            'name': 'License',
            'url': licence_url
        }
    }

    basePath = '/api/' + user_repo + '/'
    basePath += ('commit/' + sha + '/') if sha else ''

    return prev_commit, next_commit, info, basePath
136255
async function getPr(prNo) {
  if (!prNo) {
    return null;
  }
  const openPr = (await getOpenPrs())[prNo];
  if (openPr) {
    logger.debug('Returning from graphql open PR list');
    return openPr;
  }
  const closedPr = (await getClosedPrs())[prNo];
  if (closedPr) {
    logger.debug('Returning from graphql closed PR list');
    return closedPr;
  }
  logger.info(
    { prNo },
    'PR not found in open or closed PRs list - trying to fetch it directly'
  );
  const pr = (await get(
    `repos/${config.parentRepo || config.repository}/pulls/${prNo}`
  )).body;
  if (!pr) {
    return null;
  }
  // Harmonise PR values
  pr.displayNumber = `Pull Request #${pr.number}`;
  if (pr.state === 'open') {
    pr.branchName = pr.head ? pr.head.ref : undefined;
    pr.sha = pr.head ? pr.head.sha : undefined;
    if (pr.mergeable === true) {
      pr.canMerge = true;
    }
    if (pr.mergeable_state === 'dirty') {
      logger.debug({ prNo }, 'PR state is dirty so unmergeable');
      pr.isConflicted = true;
    }
    if (pr.commits === 1) {
      if (global.gitAuthor) {
        // Check against gitAuthor
        const commitAuthorEmail = (await get(
          `repos/${config.parentRepo ||
            config.repository}/pulls/${prNo}/commits`
        )).body[0].commit.author.email;
        if (commitAuthorEmail === global.gitAuthor.email) {
          logger.debug(
            { prNo },
            '1 commit matches configured gitAuthor so can rebase'
          );
          pr.canRebase = true;
        } else {
          logger.debug(
            { prNo },
            '1 commit and not by configured gitAuthor so cannot rebase'
          );
          pr.canRebase = false;
        }
      } else {
        logger.debug(
          { prNo },
          '1 commit and no configured gitAuthor so can rebase'
        );
        pr.canRebase = true;
      }
    } else {
      // Check if only one author of all commits
      logger.debug({ prNo }, 'Checking all commits');
      const prCommits = (await get(
        `repos/${config.parentRepo || config.repository}/pulls/${prNo}/commits`
      )).body;
      // Filter out "Update branch" presses
      const remainingCommits = prCommits.filter(commit => {
        const isWebflow =
          commit.committer && commit.committer.login === 'web-flow';
        if (!isWebflow) {
          // Not a web UI commit, so keep it
          return true;
        }
        const isUpdateBranch =
          commit.commit &&
          commit.commit.message &&
          commit.commit.message.startsWith("Merge branch 'master' into");
        if (isUpdateBranch) {
          // They just clicked the button
          return false;
        }
        // They must have done some other edit through the web UI
        return true;
      });
      if (remainingCommits.length <= 1) {
        pr.canRebase = true;
      }
    }
    const baseCommitSHA = await getBaseCommitSHA();
    if (!pr.base || pr.base.sha !== baseCommitSHA) {
      pr.isStale = true;
    }
  }
  return pr;
}
782903
async function getPrFiles(prNo) {
  logger.debug(`getPrFiles(${prNo})`);
  if (!prNo) {
    return [];
  }

  // GET /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/changes
  const values = await utils.accumulateValues(
    `./rest/api/1.0/projects/${config.projectKey}/repos/${
      config.repositorySlug
    }/pull-requests/${prNo}/changes?withComments=false`
  );
  return values.map(f => f.path.toString);
}
1169275
def get_pull_requests(self):
        ""
        g = self.github
        query = {'state': 'all'}
        if self.args.github_token:
            query['access_token'] = g['token']

        def f(pull):
            if self.args.ignore_closed:
                return (pull['state'] == 'opened' or
                        (pull['state'] == 'closed' and pull['merged_at']))
            else:
                return True
        pulls = filter(f,
                       self.get(g['url'] + "/repos/" + g['repo'] + "/pulls",
                                query, self.args.cache))
        return dict([(str(pull['number']), pull) for pull in pulls])
472521
async function getPr(prNo) {
  const pr = (await api.get(
    `/2.0/repositories/${config.repository}/pullrequests/${prNo}`
  )).body;

  // istanbul ignore if
  if (!pr) {
    return null;
  }

  const res = {
    displayNumber: `Pull Request #${pr.id}`,
    ...utils.prInfo(pr),
  };

  if (utils.prStates.open.includes(pr.state)) {
    res.isConflicted = await isPrConflicted(prNo);
    const commits = await utils.accumulateValues(pr.links.commits.href);
    if (commits.length === 1) {
      res.canRebase = true;
    }
  }
  if (await branchExists(pr.source.branch.name)) {
    res.isStale = await isBranchStale(pr.source.branch.name);
  }

  return res;
}
360576
def fetch_closed_pull_requests
      pull_requests = []
      options = { state: "closed" }

      page_i      = 0
      count_pages = calculate_pages(@client, "pull_requests", options)

      iterate_pages(@client, "pull_requests", options) do |new_pr|
        page_i += PER_PAGE_NUMBER
        log_string = "Fetching merged dates... #{page_i}/#{count_pages * PER_PAGE_NUMBER}"
        print_in_same_line(log_string)
        pull_requests.concat(new_pr)
      end
      print_empty_line

      Helper.log.info "Pull Request count: #{pull_requests.count}"
      pull_requests.map { |pull_request| stringify_keys_deep(pull_request.to_hash) }
    end
1219372
def pull_request(self, file):
        
        uri = "{api}/repos/{upstream}/pulls".format(
            api=self.github_api_url,
            upstream=self.upstream,
            path=file.path
        )
        params = {
          "title": "[Proxy] {message}".format(message=file.logs),
          "body": "",
          "head": "{origin}:{branch}".format(origin=self.origin.split("/")[0], branch=file.branch),
          "base": self.master_upstream
        }
        data = self.request("POST", uri, data=params)

        if data.status_code == 201:
            return json.loads(data.content.decode("utf-8"))["html_url"]
        else:
            reply = json.loads(data.content.decode("utf-8"))
            return self.ProxyError(
                data.status_code, reply["message"],
                step="pull_request", context={
                    "uri": uri,
                    "params": params
                }
            )
846362
def _extract_key_info(self, request):
        
        from scrapy.utils.request import request_fingerprint

        key_generator = request.meta.get('qiniu_key_generator')
        if key_generator:
            tmp = key_generator(request.url)
            bucket = tmp['bucket'] or self.bucket
            key = tmp['key']
        else:
            bucket = self.bucket
            key = '%s%s' % (self.key_prefix, request_fingerprint(request))

        return {'bucket': bucket, 'key': key}
1177877
def get(self, param=None, must=[APIKEY]):
        '''
        '''
        param = {} if param is None else param
        r = self.verify_param(param, must)
        if not r.is_succ():
            return r
        handle = CommonResultHandler(lambda rsp: {VERSION_V1:rsp.get(USER), VERSION_V2:rsp}[self.version()])
        return self.path('get.json').post(param, handle, r)
934579
async function getPrFiles(prNo) {
  logger.debug({ prNo }, 'getPrFiles');
  if (!prNo) {
    return [];
  }
  const files = (await get(
    `repos/${config.parentRepo || config.repository}/pulls/${prNo}/files`
  )).body;
  return files.map(f => f.filename);
}
1314649
def parse_request(self, request, parameters=None, fake_method=None):
        '''
        
        '''
        return (request.method,
                request.url,
                request.headers,
                request.form.copy())
1147836
def get(self, id=None, title=None):
        
        # Make sure the kwargs are kosher
        if id and title:
            raise ValueError("You can only retrieve a Project by id or \
                title, not by both")
        elif not id and not title:
            raise ValueError("You must provide an id or a title to \
                make a request.")
        # Pull the hits
        if id:
            hit_list = [i for i in self.all() if str(i.id) == str(id)]
        elif title:
            hit_list = [
                i for i in self.all() if
                i.title.lower().strip() == title.lower().strip()
            ]
        # Throw an error if there's more than one hit.
        if len(hit_list) > 1:
            raise DuplicateObjectError("There is more than one project that \
                matches your request.")
        # Try to pull the first hit
        try:
            return hit_list[0]
        except IndexError:
            # If it's not there, you know to throw this error.
            raise DoesNotExistError("The resource you've requested does not \
                exist or is unavailable without the proper credentials.")
464275
def get_privilege_information():
	
	# first call with zero length to determine what size buffer we need

	return_length = wintypes.DWORD()
	params = [
		get_process_token(),
		privilege.TOKEN_INFORMATION_CLASS.TokenPrivileges,
		None,
		0,
		return_length,
	]

	res = privilege.GetTokenInformation(*params)

	# assume we now have the necessary length in return_length

	buffer = ctypes.create_string_buffer(return_length.value)
	params[2] = buffer
	params[3] = return_length.value

	res = privilege.GetTokenInformation(*params)
	assert res > 0, "Error in second GetTokenInformation (%d)" % res

	privileges = ctypes.cast(
		buffer, ctypes.POINTER(privilege.TOKEN_PRIVILEGES)).contents
	return privileges
180724
def get_http_info_with_retriever(self, request, retriever):
        
        urlparts = urlparse.urlsplit(request.url)

        try:
            data = retriever(request)
        except Exception:
            data = {}

        return {
            'url': '{0}://{1}{2}'.format(
                urlparts.scheme, urlparts.netloc, urlparts.path),
            'query_string': urlparts.query,
            'method': request.method,
            'data': data,
            'cookies': request.cookies,
            'headers': request.headers,
            'env': {
                'REMOTE_ADDR': request.remote_addr,
            }
        }
1210425
function parseListRequest(req){
  var reqObj = {};
  reqObj.originalUrl = req.originalUrl;
  reqObj.uid = req.params.guid;
  reqObj.env = req.params.environment;
  reqObj.domain = req.params.domain;
  return reqObj;
}