diff --git a/github/GithubObject.py b/github/GithubObject.py index 60a71aae..9049235e 100644 --- a/github/GithubObject.py +++ b/github/GithubObject.py @@ -324,7 +324,7 @@ class GithubObject: def _initAttributes(self) -> None: raise NotImplementedError("BUG: Not Implemented _initAttributes") - def _useAttributes(self, attributes: Dict[str, Any]) -> None: + def _useAttributes(self, attributes: Any) -> None: raise NotImplementedError("BUG: Not Implemented _useAttributes") def _completeIfNeeded(self) -> None: diff --git a/github/StatsCodeFrequency.py b/github/StatsCodeFrequency.py index 65555d3e..660a1ba7 100755 --- a/github/StatsCodeFrequency.py +++ b/github/StatsCodeFrequency.py @@ -23,44 +23,37 @@ # along with PyGithub. If not, see . # # # ################################################################################ +from __future__ import annotations -from typing import Any, Dict +from datetime import datetime -import github.GithubObject +from github.GithubObject import Attribute, NonCompletableGithubObject, NotSet -class StatsCodeFrequency(github.GithubObject.NonCompletableGithubObject): +class StatsCodeFrequency(NonCompletableGithubObject): """ - This class represents statistics of StatsCodeFrequencies. The reference can be found here https://docs.github.com/en/rest/reference/repos#get-the-weekly-commit-activity + This class represents statistics of StatsCodeFrequencies. + The reference can be found here https://docs.github.com/en/rest/metrics/statistics?apiVersion=2022-11-28#get-the-weekly-commit-activity """ + def _initAttributes(self) -> None: + self._week: Attribute[datetime] = NotSet + self._additions: Attribute[int] = NotSet + self._deletions: Attribute[int] = NotSet + @property - def week(self): - """ - :type: datetime.datetime - """ + def week(self) -> datetime: return self._week.value @property - def additions(self): - """ - :type: int - """ + def additions(self) -> int: return self._additions.value @property - def deletions(self): - """ - :type: int - """ + def deletions(self) -> int: return self._deletions.value - def _initAttributes(self) -> None: - self._week = github.GithubObject.NotSet - self._additions = github.GithubObject.NotSet - self._deletions = github.GithubObject.NotSet - - def _useAttributes(self, attributes: Dict[str, Any]) -> None: + def _useAttributes(self, attributes: tuple[int, int, int]) -> None: self._week = self._makeTimestampAttribute(attributes[0]) self._additions = self._makeIntAttribute(attributes[1]) self._deletions = self._makeIntAttribute(attributes[2]) diff --git a/github/StatsCodeFrequency.pyi b/github/StatsCodeFrequency.pyi deleted file mode 100644 index 670c7307..00000000 --- a/github/StatsCodeFrequency.pyi +++ /dev/null @@ -1,11 +0,0 @@ -from datetime import datetime - -from github.GithubObject import NonCompletableGithubObject - -class StatsCodeFrequency(NonCompletableGithubObject): - @property - def additions(self) -> int: ... - @property - def deletions(self) -> int: ... - @property - def week(self) -> datetime: ...