Mercurial > repos > bcclaywell > argo_navis
comparison venv/lib/python2.7/site-packages/github/IssueComment.py @ 0:d67268158946 draft
planemo upload commit a3f181f5f126803c654b3a66dd4e83a48f7e203b
| author | bcclaywell |
|---|---|
| date | Mon, 12 Oct 2015 17:43:33 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:d67268158946 |
|---|---|
| 1 # -*- coding: utf-8 -*- | |
| 2 | |
| 3 # ########################## Copyrights and license ############################ | |
| 4 # # | |
| 5 # Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> # | |
| 6 # Copyright 2012 Zearin <zearin@gonk.net> # | |
| 7 # Copyright 2013 AKFish <akfish@gmail.com> # | |
| 8 # Copyright 2013 Michael Stead <michael.stead@gmail.com> # | |
| 9 # Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> # | |
| 10 # # | |
| 11 # This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ # | |
| 12 # # | |
| 13 # PyGithub is free software: you can redistribute it and/or modify it under # | |
| 14 # the terms of the GNU Lesser General Public License as published by the Free # | |
| 15 # Software Foundation, either version 3 of the License, or (at your option) # | |
| 16 # any later version. # | |
| 17 # # | |
| 18 # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # | |
| 19 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # | |
| 20 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # | |
| 21 # details. # | |
| 22 # # | |
| 23 # You should have received a copy of the GNU Lesser General Public License # | |
| 24 # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. # | |
| 25 # # | |
| 26 # ############################################################################## | |
| 27 | |
| 28 import github.GithubObject | |
| 29 | |
| 30 import github.NamedUser | |
| 31 | |
| 32 | |
| 33 class IssueComment(github.GithubObject.CompletableGithubObject): | |
| 34 """ | |
| 35 This class represents IssueComments as returned for example by http://developer.github.com/v3/todo | |
| 36 """ | |
| 37 | |
| 38 @property | |
| 39 def body(self): | |
| 40 """ | |
| 41 :type: string | |
| 42 """ | |
| 43 self._completeIfNotSet(self._body) | |
| 44 return self._body.value | |
| 45 | |
| 46 @property | |
| 47 def created_at(self): | |
| 48 """ | |
| 49 :type: datetime.datetime | |
| 50 """ | |
| 51 self._completeIfNotSet(self._created_at) | |
| 52 return self._created_at.value | |
| 53 | |
| 54 @property | |
| 55 def id(self): | |
| 56 """ | |
| 57 :type: integer | |
| 58 """ | |
| 59 self._completeIfNotSet(self._id) | |
| 60 return self._id.value | |
| 61 | |
| 62 @property | |
| 63 def issue_url(self): | |
| 64 """ | |
| 65 :type: string | |
| 66 """ | |
| 67 self._completeIfNotSet(self._issue_url) | |
| 68 return self._issue_url.value | |
| 69 | |
| 70 @property | |
| 71 def updated_at(self): | |
| 72 """ | |
| 73 :type: datetime.datetime | |
| 74 """ | |
| 75 self._completeIfNotSet(self._updated_at) | |
| 76 return self._updated_at.value | |
| 77 | |
| 78 @property | |
| 79 def url(self): | |
| 80 """ | |
| 81 :type: string | |
| 82 """ | |
| 83 self._completeIfNotSet(self._url) | |
| 84 return self._url.value | |
| 85 | |
| 86 @property | |
| 87 def html_url(self): | |
| 88 """ | |
| 89 :type: string | |
| 90 """ | |
| 91 self._completeIfNotSet(self._html_url) | |
| 92 return self._html_url.value | |
| 93 | |
| 94 @property | |
| 95 def user(self): | |
| 96 """ | |
| 97 :type: :class:`github.NamedUser.NamedUser` | |
| 98 """ | |
| 99 self._completeIfNotSet(self._user) | |
| 100 return self._user.value | |
| 101 | |
| 102 def delete(self): | |
| 103 """ | |
| 104 :calls: `DELETE /repos/:owner/:repo/issues/comments/:id <http://developer.github.com/v3/issues/comments>`_ | |
| 105 :rtype: None | |
| 106 """ | |
| 107 headers, data = self._requester.requestJsonAndCheck( | |
| 108 "DELETE", | |
| 109 self.url | |
| 110 ) | |
| 111 | |
| 112 def edit(self, body): | |
| 113 """ | |
| 114 :calls: `PATCH /repos/:owner/:repo/issues/comments/:id <http://developer.github.com/v3/issues/comments>`_ | |
| 115 :param body: string | |
| 116 :rtype: None | |
| 117 """ | |
| 118 assert isinstance(body, (str, unicode)), body | |
| 119 post_parameters = { | |
| 120 "body": body, | |
| 121 } | |
| 122 headers, data = self._requester.requestJsonAndCheck( | |
| 123 "PATCH", | |
| 124 self.url, | |
| 125 input=post_parameters | |
| 126 ) | |
| 127 self._useAttributes(data) | |
| 128 | |
| 129 def _initAttributes(self): | |
| 130 self._body = github.GithubObject.NotSet | |
| 131 self._created_at = github.GithubObject.NotSet | |
| 132 self._id = github.GithubObject.NotSet | |
| 133 self._issue_url = github.GithubObject.NotSet | |
| 134 self._updated_at = github.GithubObject.NotSet | |
| 135 self._url = github.GithubObject.NotSet | |
| 136 self._html_url = github.GithubObject.NotSet | |
| 137 self._user = github.GithubObject.NotSet | |
| 138 | |
| 139 def _useAttributes(self, attributes): | |
| 140 if "body" in attributes: # pragma no branch | |
| 141 self._body = self._makeStringAttribute(attributes["body"]) | |
| 142 if "created_at" in attributes: # pragma no branch | |
| 143 self._created_at = self._makeDatetimeAttribute(attributes["created_at"]) | |
| 144 if "id" in attributes: # pragma no branch | |
| 145 self._id = self._makeIntAttribute(attributes["id"]) | |
| 146 if "issue_url" in attributes: # pragma no branch | |
| 147 self._issue_url = self._makeStringAttribute(attributes["issue_url"]) | |
| 148 if "updated_at" in attributes: # pragma no branch | |
| 149 self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"]) | |
| 150 if "url" in attributes: # pragma no branch | |
| 151 self._url = self._makeStringAttribute(attributes["url"]) | |
| 152 if "html_url" in attributes: # pragma no branch | |
| 153 self._html_url = self._makeStringAttribute(attributes["html_url"]) | |
| 154 if "user" in attributes: # pragma no branch | |
| 155 self._user = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"]) |
