mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-01 19:31:10 +00:00
First step of implementation of Repository.get_stats_xxx (#203)
This commit is contained in:
@@ -61,6 +61,7 @@ import github.Download
|
||||
import github.Permissions
|
||||
import github.Event
|
||||
import github.Legacy
|
||||
import github.StatsContributor
|
||||
|
||||
|
||||
class Repository(github.GithubObject.CompletableGithubObject):
|
||||
@@ -1690,6 +1691,75 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
None
|
||||
)
|
||||
|
||||
def get_stats_contributors(self):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/stats/contributors <http://developer.github.com/v3/repos/statistics/#get-contributors-list-with-additions-deletions-and-commit-counts>`_
|
||||
:rtype: None or list of :class:`github.StatsContributor.StatsContributor`
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
self.url + "/stats/contributors"
|
||||
)
|
||||
if data == {}:
|
||||
return None
|
||||
else:
|
||||
return [
|
||||
github.StatsContributor.StatsContributor(self._requester, headers, attributes, completed=True)
|
||||
for attributes in data
|
||||
]
|
||||
|
||||
def get_stats_commit_activity(self):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/stats/commit_activity <developer.github.com/v3/repos/statistics/#get-the-number-of-commits-per-hour-in-each-day>`_
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
self.url + "/stats/commit_activity"
|
||||
)
|
||||
if data == {}:
|
||||
return None
|
||||
else:
|
||||
return data # @todo Return something structured
|
||||
|
||||
def get_stats_code_frequency(self):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/stats/code_frequency <http://developer.github.com/v3/repos/statistics/#get-the-number-of-additions-and-deletions-per-week>`_
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
self.url + "/stats/code_frequency"
|
||||
)
|
||||
if data == {}:
|
||||
return None
|
||||
else:
|
||||
return data # @todo Return something structured
|
||||
|
||||
def get_stats_participation(self):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/stats/participation <http://developer.github.com/v3/repos/statistics/#get-the-weekly-commit-count-for-the-repo-owner-and-everyone-else>`_
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
self.url + "/stats/participation"
|
||||
)
|
||||
if data == {}:
|
||||
return None
|
||||
else:
|
||||
return data # @todo Return something structured
|
||||
|
||||
def get_stats_punch_card(self):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/stats/punch_card <http://developer.github.com/v3/repos/statistics/#get-the-number-of-commits-per-hour-in-each-day>`_
|
||||
"""
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
self.url + "/stats/punch_card"
|
||||
)
|
||||
if data == {}:
|
||||
return None
|
||||
else:
|
||||
return data # @todo Return something structured
|
||||
|
||||
def get_subscribers(self):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/subscribers <http://developer.github.com/v3/activity/watching>`_
|
||||
|
||||
Reference in New Issue
Block a user