Mercurial > repos > bcclaywell > argo_navis
comparison venv/lib/python2.7/site-packages/github/StatsContributor.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 2013 Vincent Jacques <vincent@vincent-jacques.net> # | |
| 6 # # | |
| 7 # This file is part of PyGithub. http://jacquev6.github.com/PyGithub/ # | |
| 8 # # | |
| 9 # PyGithub is free software: you can redistribute it and/or modify it under # | |
| 10 # the terms of the GNU Lesser General Public License as published by the Free # | |
| 11 # Software Foundation, either version 3 of the License, or (at your option) # | |
| 12 # any later version. # | |
| 13 # # | |
| 14 # PyGithub is distributed in the hope that it will be useful, but WITHOUT ANY # | |
| 15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # | |
| 16 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # | |
| 17 # details. # | |
| 18 # # | |
| 19 # You should have received a copy of the GNU Lesser General Public License # | |
| 20 # along with PyGithub. If not, see <http://www.gnu.org/licenses/>. # | |
| 21 # # | |
| 22 # ############################################################################## | |
| 23 | |
| 24 import github.GithubObject | |
| 25 | |
| 26 import github.NamedUser | |
| 27 | |
| 28 | |
| 29 class StatsContributor(github.GithubObject.NonCompletableGithubObject): | |
| 30 """ | |
| 31 This class represents statistics of a contibutor. The reference can be found here http://developer.github.com/v3/repos/statistics/#get-contributors-list-with-additions-deletions-and-commit-counts | |
| 32 """ | |
| 33 | |
| 34 class Week(github.GithubObject.NonCompletableGithubObject): | |
| 35 """ | |
| 36 This class represents weekly statistics of a contibutor. | |
| 37 """ | |
| 38 | |
| 39 @property | |
| 40 def w(self): | |
| 41 """ | |
| 42 :type: datetime.datetime | |
| 43 """ | |
| 44 return self._w.value | |
| 45 | |
| 46 @property | |
| 47 def a(self): | |
| 48 """ | |
| 49 :type: int | |
| 50 """ | |
| 51 return self._a.value | |
| 52 | |
| 53 @property | |
| 54 def d(self): | |
| 55 """ | |
| 56 :type: int | |
| 57 """ | |
| 58 return self._d.value | |
| 59 | |
| 60 @property | |
| 61 def c(self): | |
| 62 """ | |
| 63 :type: int | |
| 64 """ | |
| 65 return self._c.value | |
| 66 | |
| 67 def _initAttributes(self): | |
| 68 self._w = github.GithubObject.NotSet | |
| 69 self._a = github.GithubObject.NotSet | |
| 70 self._d = github.GithubObject.NotSet | |
| 71 self._c = github.GithubObject.NotSet | |
| 72 | |
| 73 def _useAttributes(self, attributes): | |
| 74 if "w" in attributes: # pragma no branch | |
| 75 self._w = self._makeTimestampAttribute(attributes["w"]) | |
| 76 if "a" in attributes: # pragma no branch | |
| 77 self._a = self._makeIntAttribute(attributes["a"]) | |
| 78 if "d" in attributes: # pragma no branch | |
| 79 self._d = self._makeIntAttribute(attributes["d"]) | |
| 80 if "c" in attributes: # pragma no branch | |
| 81 self._c = self._makeIntAttribute(attributes["c"]) | |
| 82 | |
| 83 @property | |
| 84 def author(self): | |
| 85 """ | |
| 86 :type: :class:`github.NamedUser.NamedUser` | |
| 87 """ | |
| 88 return self._author.value | |
| 89 | |
| 90 @property | |
| 91 def total(self): | |
| 92 """ | |
| 93 :type: int | |
| 94 """ | |
| 95 return self._total.value | |
| 96 | |
| 97 @property | |
| 98 def weeks(self): | |
| 99 """ | |
| 100 :type: list of :class:`.Week` | |
| 101 """ | |
| 102 return self._weeks.value | |
| 103 | |
| 104 def _initAttributes(self): | |
| 105 self._author = github.GithubObject.NotSet | |
| 106 self._total = github.GithubObject.NotSet | |
| 107 self._weeks = github.GithubObject.NotSet | |
| 108 | |
| 109 def _useAttributes(self, attributes): | |
| 110 if "author" in attributes: # pragma no branch | |
| 111 self._author = self._makeClassAttribute(github.NamedUser.NamedUser, attributes["author"]) | |
| 112 if "total" in attributes: # pragma no branch | |
| 113 self._total = self._makeIntAttribute(attributes["total"]) | |
| 114 if "weeks" in attributes: # pragma no branch | |
| 115 self._weeks = self._makeListOfClassesAttribute(self.Week, attributes["weeks"]) |
