Mercurial > repos > bcclaywell > argo_navis
comparison venv/lib/python2.7/site-packages/github/GistComment.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 GistComment(github.GithubObject.CompletableGithubObject): | |
33 """ | |
34 This class represents GistComments 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 created_at(self): | |
47 """ | |
48 :type: datetime.datetime | |
49 """ | |
50 self._completeIfNotSet(self._created_at) | |
51 return self._created_at.value | |
52 | |
53 @property | |
54 def id(self): | |
55 """ | |
56 :type: integer | |
57 """ | |
58 self._completeIfNotSet(self._id) | |
59 return self._id.value | |
60 | |
61 @property | |
62 def updated_at(self): | |
63 """ | |
64 :type: datetime.datetime | |
65 """ | |
66 self._completeIfNotSet(self._updated_at) | |
67 return self._updated_at.value | |
68 | |
69 @property | |
70 def url(self): | |
71 """ | |
72 :type: string | |
73 """ | |
74 self._completeIfNotSet(self._url) | |
75 return self._url.value | |
76 | |
77 @property | |
78 def user(self): | |
79 """ | |
80 :type: :class:`github.NamedUser.NamedUser` | |
81 """ | |
82 self._completeIfNotSet(self._user) | |
83 return self._user.value | |
84 | |
85 def delete(self): | |
86 """ | |
87 :calls: `DELETE /gists/:gist_id/comments/:id <http://developer.github.com/v3/gists/comments>`_ | |
88 :rtype: None | |
89 """ | |
90 headers, data = self._requester.requestJsonAndCheck( | |
91 "DELETE", | |
92 self.url | |
93 ) | |
94 | |
95 def edit(self, body): | |
96 """ | |
97 :calls: `PATCH /gists/:gist_id/comments/:id <http://developer.github.com/v3/gists/comments>`_ | |
98 :param body: string | |
99 :rtype: None | |
100 """ | |
101 assert isinstance(body, (str, unicode)), body | |
102 post_parameters = { | |
103 "body": body, | |
104 } | |
105 headers, data = self._requester.requestJsonAndCheck( | |
106 "PATCH", | |
107 self.url, | |
108 input=post_parameters | |
109 ) | |
110 self._useAttributes(data) | |
111 | |
112 def _initAttributes(self): | |
113 self._body = github.GithubObject.NotSet | |
114 self._created_at = github.GithubObject.NotSet | |
115 self._id = github.GithubObject.NotSet | |
116 self._updated_at = github.GithubObject.NotSet | |
117 self._url = github.GithubObject.NotSet | |
118 self._user = github.GithubObject.NotSet | |
119 | |
120 def _useAttributes(self, attributes): | |
121 if "body" in attributes: # pragma no branch | |
122 self._body = self._makeStringAttribute(attributes["body"]) | |
123 if "created_at" in attributes: # pragma no branch | |
124 self._created_at = self._makeDatetimeAttribute(attributes["created_at"]) | |
125 if "id" in attributes: # pragma no branch | |
126 self._id = self._makeIntAttribute(attributes["id"]) | |
127 if "updated_at" in attributes: # pragma no branch | |
128 self._updated_at = self._makeDatetimeAttribute(attributes["updated_at"]) | |
129 if "url" in attributes: # pragma no branch | |
130 self._url = self._makeStringAttribute(attributes["url"]) | |
131 if "user" in attributes: # pragma no branch | |
132 self._user = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["user"]) |