StatsParticipation.py
1 ############################ Copyrights and license ############################ 2 # # 3 # Copyright 2013 Vincent Jacques <vincent@vincent-jacques.net> # 4 # Copyright 2014 Vincent Jacques <vincent@vincent-jacques.net> # 5 # Copyright 2016 Peter Buckley <dx-pbuckley@users.noreply.github.com> # 6 # Copyright 2018 Wan Liuyang <tsfdye@gmail.com> # 7 # Copyright 2018 sfdye <tsfdye@gmail.com> # 8 # # 9 # This file is part of PyGithub. # 10 # http://pygithub.readthedocs.io/ # 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 from __future__ import annotations 27 28 from typing import Any 29 30 from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet 31 32 33 class StatsParticipation(NonCompletableGithubObject): 34 """ 35 This class represents StatsParticipations. The reference can be found here https://docs.github.com/en/rest/reference/repos#get-the-weekly-commit-count 36 """ 37 38 def _initAttributes(self) -> None: 39 self._all: Attribute[list[int]] = NotSet 40 self._owner: Attribute[list[int]] = NotSet 41 42 @property 43 def all(self) -> list[int]: 44 return self._all.value 45 46 @property 47 def owner(self) -> list[int]: 48 return self._owner.value 49 50 def _useAttributes(self, attributes: dict[str, Any]) -> None: 51 if "all" in attributes: # pragma no branch 52 self._all = self._makeListOfIntsAttribute(attributes["all"]) 53 if "owner" in attributes: # pragma no branch 54 self._owner = self._makeListOfIntsAttribute(attributes["owner"])