comparison venv/lib/python2.7/site-packages/github/PullRequestComment.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 # Copyright 2013 martinqt <m.ki2@laposte.net> #
11 # #
12 # This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ #
13 # #
14 # PyGithub is free software: you can redistribute it and/or modify it under #
15 # the terms of the GNU Lesser General Public License as published by the Free #
16 # Software Foundation, either version 3 of the License, or (at your option) #
17 # any later version. #
18 # #
19 # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY #
20 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS #
21 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more #
22 # details. #
23 # #
24 # You should have received a copy of the GNU Lesser General Public License #
25 # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
26 # #
27 # ##############################################################################
28
29 import github.GithubObject
30
31 import github.NamedUser
32
33
34 class PullRequestComment(github.GithubObject.CompletableGithubObject):
35 """
36 This class represents PullRequestComments. The reference can be found here http://developer.github.com/v3/pulls/comments/
37 """
38
39 @property
40 def body(self):
41 """
42 :type: string
43 """
44 self._completeIfNotSet(self._body)
45 return self._body.value
46
47 @property
48 def commit_id(self):
49 """
50 :type: string
51 """
52 self._completeIfNotSet(self._commit_id)
53 return self._commit_id.value
54
55 @property
56 def created_at(self):
57 """
58 :type: datetime.datetime
59 """
60 self._completeIfNotSet(self._created_at)
61 return self._created_at.value
62
63 @property
64 def diff_hunk(self):
65 """
66 :type: string
67 """
68 self._completeIfNotSet(self._diff_hunk)
69 return self._diff_hunk.value
70
71 @property
72 def id(self):
73 """
74 :type: integer
75 """
76 self._completeIfNotSet(self._id)
77 return self._id.value
78
79 @property
80 def original_commit_id(self):
81 """
82 :type: string
83 """
84 self._completeIfNotSet(self._original_commit_id)
85 return self._original_commit_id.value
86
87 @property
88 def original_position(self):
89 """
90 :type: integer
91 """
92 self._completeIfNotSet(self._original_position)
93 return self._original_position.value
94
95 @property
96 def path(self):
97 """
98 :type: string
99 """
100 self._completeIfNotSet(self._path)
101 return self._path.value
102
103 @property
104 def position(self):
105 """
106 :type: integer
107 """
108 self._completeIfNotSet(self._position)
109 return self._position.value
110
111 @property
112 def pull_request_url(self):
113 """
114 :type: string
115 """
116 self._completeIfNotSet(self._pull_request_url)
117 return self._pull_request_url.value
118
119 @property
120 def updated_at(self):
121 """
122 :type: datetime.datetime
123 """
124 self._completeIfNotSet(self._updated_at)
125 return self._updated_at.value
126
127 @property
128 def url(self):
129 """
130 :type: string
131 """
132 self._completeIfNotSet(self._url)
133 return self._url.value
134
135 @property
136 def html_url(self):
137 """
138 :type: string
139 """
140 self._completeIfNotSet(self._html_url)
141 return self._html_url.value
142
143 @property
144 def user(self):
145 """
146 :type: :class:`github.NamedUser.NamedUser`
147 """
148 self._completeIfNotSet(self._user)
149 return self._user.value
150
151 def delete(self):
152 """
153 :calls: `DELETE /repos/:owner/:repo/pulls/comments/:number <http://developer.github.com/v3/pulls/comments>`_
154 :rtype: None
155 """
156 headers, data = self._requester.requestJsonAndCheck(
157 "DELETE",
158 self.url
159 )
160
161 def edit(self, body):
162 """
163 :calls: `PATCH /repos/:owner/:repo/pulls/comments/:number <http://developer.github.com/v3/pulls/comments>`_
164 :param body: string
165 :rtype: None
166 """
167 assert isinstance(body, (str, unicode)), body
168 post_parameters = {
169 "body": body,
170 }
171 headers, data = self._requester.requestJsonAndCheck(
172 "PATCH",
173 self.url,
174 input=post_parameters
175 )
176 self._useAttributes(data)
177
178 def _initAttributes(self):
179 self._body = github.GithubObject.NotSet
180 self._commit_id = github.GithubObject.NotSet
181 self._created_at = github.GithubObject.NotSet
182 self._diff_hunk = github.GithubObject.NotSet
183 self._id = github.GithubObject.NotSet
184 self._original_commit_id = github.GithubObject.NotSet
185 self._original_position = github.GithubObject.NotSet
186 self._path = github.GithubObject.NotSet
187 self._position = github.GithubObject.NotSet
188 self._pull_request_url = github.GithubObject.NotSet
189 self._updated_at = github.GithubObject.NotSet
190 self._url = github.GithubObject.NotSet
191 self._html_url = github.GithubObject.NotSet
192 self._user = github.GithubObject.NotSet
193
194 def _useAttributes(self, attributes):
195 if "body" in attributes: # pragma no branch
196 self._body = self._makeStringAttribute(attributes["body"])
197 if "commit_id" in attributes: # pragma no branch
198 self._commit_id = self._makeStringAttribute(attributes["commit_id"])
199 if "created_at" in attributes: # pragma no branch
200 self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
201 if "diff_hunk" in attributes: # pragma no branch
202 self._diff_hunk = self._makeStringAttribute(attributes["diff_hunk"])
203 if "id" in attributes: # pragma no branch
204 self._id = self._makeIntAttribute(attributes["id"])
205 if "original_commit_id" in attributes: # pragma no branch
206 self._original_commit_id = self._makeStringAttribute(attributes["original_commit_id"])
207 if "original_position" in attributes: # pragma no branch
208 self._original_position = self._makeIntAttribute(attributes["original_position"])
209 if "path" in attributes: # pragma no branch
210 self._path = self._makeStringAttribute(attributes["path"])
211 if "position" in attributes: # pragma no branch
212 self._position = self._makeIntAttribute(attributes["position"])
213 if "pull_request_url" in attributes: # pragma no branch
214 self._pull_request_url = self._makeStringAttribute(attributes["pull_request_url"])
215 if "updated_at" in attributes: # pragma no branch
216 self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"])
217 if "url" in attributes: # pragma no branch
218 self._url = self._makeStringAttribute(attributes["url"])
219 if "html_url" in attributes: # pragma no branch
220 self._html_url = self._makeStringAttribute(attributes["html_url"])
221 if "user" in attributes: # pragma no branch
222 self._user = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"])