comparison venv/lib/python2.7/site-packages/github/GitCommit.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.GitAuthor
30 import github.GitTree
31
32
33 class GitCommit(github.GithubObject.CompletableGithubObject):
34 """
35 This class represents GitCommits as returned for example by http://developer.github.com/v3/todo
36 """
37
38 @property
39 def author(self):
40 """
41 :type: :class:`github.GitAuthor.GitAuthor`
42 """
43 self._completeIfNotSet(self._author)
44 return self._author.value
45
46 @property
47 def committer(self):
48 """
49 :type: :class:`github.GitAuthor.GitAuthor`
50 """
51 self._completeIfNotSet(self._committer)
52 return self._committer.value
53
54 @property
55 def html_url(self):
56 """
57 :type: string
58 """
59 self._completeIfNotSet(self._html_url)
60 return self._html_url.value
61
62 @property
63 def message(self):
64 """
65 :type: string
66 """
67 self._completeIfNotSet(self._message)
68 return self._message.value
69
70 @property
71 def parents(self):
72 """
73 :type: list of :class:`github.GitCommit.GitCommit`
74 """
75 self._completeIfNotSet(self._parents)
76 return self._parents.value
77
78 @property
79 def sha(self):
80 """
81 :type: string
82 """
83 self._completeIfNotSet(self._sha)
84 return self._sha.value
85
86 @property
87 def tree(self):
88 """
89 :type: :class:`github.GitTree.GitTree`
90 """
91 self._completeIfNotSet(self._tree)
92 return self._tree.value
93
94 @property
95 def url(self):
96 """
97 :type: string
98 """
99 self._completeIfNotSet(self._url)
100 return self._url.value
101
102 @property
103 def _identity(self):
104 return self.sha
105
106 def _initAttributes(self):
107 self._author = github.GithubObject.NotSet
108 self._committer = github.GithubObject.NotSet
109 self._html_url = github.GithubObject.NotSet
110 self._message = github.GithubObject.NotSet
111 self._parents = github.GithubObject.NotSet
112 self._sha = github.GithubObject.NotSet
113 self._tree = github.GithubObject.NotSet
114 self._url = github.GithubObject.NotSet
115
116 def _useAttributes(self, attributes):
117 if "author" in attributes: # pragma no branch
118 self._author = self._makeClassAttribute(github.GitAuthor.GitAuthor, attributes["author"])
119 if "committer" in attributes: # pragma no branch
120 self._committer = self._makeClassAttribute(github.GitAuthor.GitAuthor, attributes["committer"])
121 if "html_url" in attributes: # pragma no branch
122 self._html_url = self._makeStringAttribute(attributes["html_url"])
123 if "message" in attributes: # pragma no branch
124 self._message = self._makeStringAttribute(attributes["message"])
125 if "parents" in attributes: # pragma no branch
126 self._parents = self._makeListOfClassesAttribute(GitCommit, attributes["parents"])
127 if "sha" in attributes: # pragma no branch
128 self._sha = self._makeStringAttribute(attributes["sha"])
129 if "tree" in attributes: # pragma no branch
130 self._tree = self._makeClassAttribute(github.GitTree.GitTree, attributes["tree"])
131 if "url" in attributes: # pragma no branch
132 self._url = self._makeStringAttribute(attributes["url"])