pull requests accepted
187490
private function eventsAreEqual($e1, $e2)
    {
        // events aren't equal if they have different classes
        if (get_class($e1) != get_class($e2)) {
            return false;
        }

        // compare their values..
        $reflection = new \ReflectionClass($e1);

        $fields = array_map(function ($property) {
            return $property->name;
        }, $reflection->getProperties());

        $allMatch = true;

        foreach ($fields as $field) {
            // compare the single field across both events
            $property = new \ReflectionProperty(get_class($e1), $field);
            $property->setAccessible(true);
            $e1Value = $property->getValue($e1);
            $e2Value = $property->getValue($e2);

            if (is_array($e1Value)) {
                // this part isn't done, jsut copied, think it through
                for ($i = 0; $i < count($e1Value); $i++) {
                    $setMatches = $this->compareProperties($e1, $e1Value[$i], $e2Value[$i], $property);
                    if ( ! $setMatches) {
                        $allMatch = false;
                    }
                }
            } else {
                $setMatches = $this->compareProperties($e1, $e1Value, $e2Value, $property);
                if ( ! $setMatches) {
                    $allMatch = false;
                }
            }
        }

        return $allMatch;
    }
313529
def request(params={})
      normalize_parameters params
      raise UnmetRequirementsError, "Required parameters: #{requirements}" \
        unless meets_requirements? params
      credentials = pull_credentials params
      pairs = pull_url_pairs params
      request = construct_request expand_url(pairs), params, credentials
      yield request if block_given?
      request
    end
134561
function(url, args, options) {
            return Requests._execute(url, options, {
                method: "GET",
                params: args
            });
        }
327163
function chain_requests(ml, url) {
  return (batches) => {
    let promise = new Promise((resolve, reject) => resolve(new MonkeyLearnResponse()));

    // attach requests for all the batches sequentially to the original promise and return _that_
    return batches.reduce((promise, batch) =>
      promise.then((response) =>

        request(ml, {
          url: url,
          method: 'POST',
          body: batch,
          parse_response: false
        })

        .then(raw_response => {
          response._add_raw_response(raw_response);
          return response;
        })

        .catch(error => {
          if (error.hasOwnProperty('response')) {
            response._add_raw_response(error.response);
            error.response = response;
          } else {
            // if it's not a MonkeyLearn Error (so, some other js runtime error),
            // return as-is but add the response
            // not the cleanest solution but I don't want the error to lose the context
            error.response = response;
            error.error_code = '';
          }
          throw error;
        })
      )
    , promise)
  }
}
559772
def _requests(self, url, method='GET', headers=None, params=None, data=None, errors=None):

        '''  '''

        title = '%s._requests' % self.__class__.__name__
    
    # import dependencies
        from time import time
        import requests

    # validate access token
        if not self._access_token:
            self.access_token()
            if self.retrieve_details:
                self._get_products()
    
    # refresh token
        current_time = time()
        if current_time > self.expires_at:
            self.access_token()
            if self.retrieve_details:
                self._get_products()

    # construct request kwargs
        request_kwargs = {
            'url': url,
            'headers': { 
                'Authorization': 'Bearer %s' % self._access_token,
                'Accept': 'application/json;v=2'
            },
            'params': {},
            'data': {}
        }
        if headers:
            request_kwargs['headers'].update(headers)
        if params:
            request_kwargs['params'].update(params)
        if data:
            request_kwargs['data'].update(data)

    # send request
        if method == 'POST':
            try:
                response = requests.post(**request_kwargs)
            except Exception:
                if self.requests_handler:
                    request_kwargs['method'] = 'POST'
                    request_object = requests.Request(**request_kwargs)
                    return self.requests_handler(request_object)
                else:
                    raise
        elif method == 'GET':
            try:
                response = requests.get(**request_kwargs)
            except Exception:
                if self.requests_handler:
                    request_kwargs['method'] = 'GET'
                    request_object = requests.Request(**request_kwargs)
                    return self.requests_handler(request_object)
                else:
                    raise
        else:
            raise ValueError('%s(method='') must be either GET or POST' % title)

    # handle response
        response_details = self.response_handler.handle(response, errors)
        
        return response_details
321120
def get_pull_request(project, num, auth=False):
    
    url = "https://api.github.com/repos/{project}/pulls/{num}".format(project=project, num=num)
    if auth:
        header = make_auth_header()
    else:
        header = None
    response = requests.get(url, headers=header)
    response.raise_for_status()
    return json.loads(response.text, object_hook=Obj)
690565
private static function parse_contributors_from_pull_requests( $pull_requests ) {
		$contributors = array();
		foreach ( $pull_requests as $pull_request ) {
			if ( ! empty( $pull_request->user ) ) {
				$contributors[ $pull_request->user->html_url ] = $pull_request->user->login;
			}
		}
		return $contributors;
	}
503240
def getPullRequestComments(self, repo_user, repo_name, pull_number):
        
        return self.api.makeRequestAllPages(
            ['repos', repo_user, repo_name,
             'pulls', str(pull_number), 'comments'])
497831
def run!
      story = @configuration.story
      fail("Could not find story associated with branch") unless story
      Git.clean_working_tree?
      Git.push(story.branch_name, set_upstream: true)
      unless story.release?
        print "Creating pull-request on Github... "
        pull_request_params = story.params_for_pull_request.merge(project: @configuration.project)
        @configuration.github_client.create_pullrequest(pull_request_params)
        puts 'OK'
      end
      return 0
    end
1357362
function getPRsForRepo(repo) {
  print(['Fetching PRs for ', clc.yellow.bold(`${repo.owner.login}/${repo.name}`)], debug);
  return new Promise((resolve, reject) => {
    github.pullRequests.getAll({
      user: repo.owner.login,
      repo: repo.name,
      state: 'open'
    }, (err, prs) => {
      if (err) {
        return reject(err);
      }
      return resolve(prs.filter((pr) => {
        return pr && pr.head;
      }));
    });
  });
}
890485
function CurlApi (ids, callback, errback, waitFor) {
		var then, ctx;
		ctx = core.createContext(userCfg, undef, [].concat(ids));
		this['then'] = then = function (resolved, rejected) {
			when(ctx,
				// return the dependencies as arguments, not an array
				function (deps) {
					if (resolved) resolved.apply(undef, deps);
				},
				// just throw if the dev didn't specify an error handler
				function (ex) {
					if (rejected) rejected(ex); else throw ex;
				}
			);
			return this;
		};
		this['next'] = function (ids, cb, eb) {
			// chain api
			return new CurlApi(ids, cb, eb, ctx);
		};
		this['config'] = _config;
		if (callback || errback) then(callback, errback);
		when(waitFor, function () { core.getDeps(ctx); });
	}
288157
def create_pullrequest options
      project = options.fetch(:project)
      params = {
          :base => options.fetch(:base),
          :head => options.fetch(:head)
      }

      if options[:issue]
        params[:issue] = options[:issue]
      else
        params[:title] = options[:title] if options[:title]
        params[:body]  = options[:body]  if options[:body]
      end

      res = post "https://%s/repos/%s/%s/pulls" %
                     [api_host(project.host), project.owner, project.name], params

      res.error! unless res.success?
      res.data
    end
1271838
def get_pull_requests_commits(self, project, repository, pull_request_id):
        
        url = 'rest/api/1.0/projects/{project}/repos/{repository}/pull-requests/{pullRequestId}/commits'.format(
            project=project,
            repository=repository,
            pullRequestId=pull_request_id)
        params = {'start': 0}
        response = self.get(url, params=params)
        if 'values' not in response:
            return []
        commits_list = (response or {}).get('values')
        while not response.get('isLastPage'):
            params['start'] = response.get('nextPageStart')
            response = self.get(url, params=params)
            commits_list += (response or {}).get('values')
        return commits_list
433696
def get_pull_request_files(project, num, auth=False):
    """"""
    url = "https://api.github.com/repos/{project}/pulls/{num}/files".format(project=project, num=num)
    if auth:
        header = make_auth_header()
    else:
        header = None
    return get_paged_request(url, headers=header)
973549
def filter_merged_pull_requests(pull_requests)
      print "Fetching merged dates...\r" if options[:verbose]
      closed_pull_requests = @fetcher.fetch_closed_pull_requests

      pull_requests.each do |pr|
        fetched_pr = closed_pull_requests.find do |fpr|
          fpr["number"] == pr["number"]
        end
        if fetched_pr
          pr["merged_at"] = fetched_pr["merged_at"]
          closed_pull_requests.delete(fetched_pr)
        end
      end

      pull_requests.reject! do |pr|
        pr["merged_at"].nil?
      end

      pull_requests
    end
1293041
def get_pull_requests_changes(self, project, repository, pull_request_id):
        
        url = 'rest/api/1.0/projects/{project}/repos/{repository}/pull-requests/{pullRequestId}/changes'.format(
            project=project,
            repository=repository,
            pullRequestId=pull_request_id)
        params = {'start': 0}
        response = self.get(url, params=params)
        if 'values' not in response:
            return []
        changes_list = (response or {}).get('values')
        while not response.get('isLastPage'):
            params['start'] = response.get('nextPageStart')
            if params['start'] is None:
                log.warning('Too many changes in pull request. Changes list is incomplete.')
                break
            response = self.get(url, params=params)
            changes_list += (response or {}).get('values')
        return changes_list
1190795
def pull_from_origin(repo_path):
    """"""
    LOG.info("Pulling from origin at %s." % repo_path)
    command = GIT_PULL_CMD.format(repo_path)
    resp = envoy.run(command)
    if resp.status_code != 0:
        LOG.exception("Pull failed.")
        raise GitException(resp.std_err)
    else:
        LOG.info("Pull successful.")