GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — python-github2/github2/pull_requests.py at master · ask/python-github2 Expand file tree/ Copy pathpull_requests.pyMore file actions 113 lines (89 loc) · 4.55 KB / Copy pathpull_requests.pyFile metadata and controls113 lines (89 loc) · 4.55 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 # -*- coding: utf-8 -*- # Copyright (C) 2010-2012 Christopher MacGown <[email protected]> # Ionuț Arțăriși <[email protected]> # James Rowe <[email protected]> # Stéphane Angel <[email protected]> # # This file is part of python-github2, and is made available under the 3-clause # BSD license. See LICENSE for the full details. from github2.core import (BaseData, GithubCommand, Attribute, DateAttribute, repr_string) class PullRequest(BaseData): """Pull request container. .. versionadded:: 0.5.0 """ state = Attribute("The pull request state") base = Attribute("The base repo") head = Attribute("The head of the pull request") issue_user = Attribute("The user who created the pull request.") user = Attribute("The owner of the repo.") title = Attribute("The text of the pull request title.") body = Attribute("The text of the body.") position = Attribute("Floating point position of the pull request.") number = Attribute("Number of this request.") votes = Attribute("Number of votes for this request.") comments = Attribute("Number of comments made on this request.") diff_url = Attribute("The URL to the unified diff.") patch_url = Attribute("The URL to the downloadable patch.") labels = Attribute("A list of labels attached to the pull request.") html_url = Attribute("The URL to the pull request.") issue_created_at = DateAttribute("The date the issue for this pull " "request was opened.", format='iso') issue_updated_at = DateAttribute("The date the issue for this pull " "request was last updated.", format='iso') created_at = DateAttribute("The date when this pull request was created.", format='iso') updated_at = DateAttribute("The date when this pull request was last " "updated.", format='iso') closed_at = DateAttribute("The date when this pull request was closed", format='iso') discussion = Attribute("Discussion thread for the pull request.") mergeable = Attribute("Whether the pull request can be merge cleanly") def __repr__(self): return "<PullRequest: %s>" % repr_string(self.title) class PullRequests(GithubCommand): """GitHub API pull request functionality. .. versionadded:: 0.5.0 """ domain = "pulls" def create(self, project, base, head, title=None, body=None, issue=None): """Create a new pull request. Pull requests can be created from scratch, or attached to an existing issue. If an ``issue`` parameter is supplied the pull request is attached to that issue, else a new pull request is created. :param str project: the GitHub project to send the pull request to :param str base: branch changes should be pulled into :param str head: branch of the changes to be pulled :param str title: title for pull request :param str body: optional body for pull request :param str issue: existing issue to attach pull request to """ post_data = {"base": base, "head": head} if issue: post_data["issue"] = issue elif title: post_data["title"] = title if body: post_data["body"] = body else: raise TypeError("You must either specify a title for the " "pull request or an issue number to which the " "pull request should be attached.") pull_request_data = [("pull[%s]" % k, v) for k, v in post_data.items()] return self.get_value(project, post_data=dict(pull_request_data), filter="pull", datatype=PullRequest) def show(self, project, number): """Show a single pull request. :param str project: GitHub project :param int number: pull request number in the GitHub database """ return self.get_value(project, str(number), filter="pull", datatype=PullRequest) def list(self, project, state="open", page=1): """List all pull requests for a project. :param str project: GitHub project :param str state: can be either ``open`` or ``closed`` :param int page: optional page number """ return self.get_values(project, state, filter="pulls", datatype=PullRequest, page=page) |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |