mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 10:51:14 +00:00
Merge StatsCodeFrequency type stub back to source (#2638)
Co-authored-by: Enrico Minack <github@enrico.minack.dev>
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -23,44 +23,37 @@
|
||||
# along with PyGithub. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
################################################################################
|
||||
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])
|
||||
|
||||
@@ -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: ...
|
||||
Reference in New Issue
Block a user