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