Skip to content

Commit

Permalink
Revert "Remove NamedUser.contributions (#774)" (#865)
Browse files Browse the repository at this point in the history
This reverts commit a519e46.

NamedUser.contributions can be populated, so we should fill in the data.

Fixes #850
  • Loading branch information
s-t-e-v-e-n-k authored and sfdye committed Aug 15, 2018
1 parent a7c16c6 commit b91dee8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions github/NamedUser.py
Expand Up @@ -101,6 +101,14 @@ def company(self):
self._completeIfNotSet(self._company)
return self._company.value

@property
def contributions(self):
"""
:type: integer
"""
self._completeIfNotSet(self._contributions)
return self._contributions.value

@property
def created_at(self):
"""
Expand Down Expand Up @@ -563,6 +571,7 @@ def _initAttributes(self):
self._blog = github.GithubObject.NotSet
self._collaborators = github.GithubObject.NotSet
self._company = github.GithubObject.NotSet
self._contributions = github.GithubObject.NotSet
self._created_at = github.GithubObject.NotSet
self._disk_usage = github.GithubObject.NotSet
self._email = github.GithubObject.NotSet
Expand Down Expand Up @@ -607,6 +616,8 @@ def _useAttributes(self, attributes):
self._collaborators = self._makeIntAttribute(attributes["collaborators"])
if "company" in attributes: # pragma no branch
self._company = self._makeStringAttribute(attributes["company"])
if "contributions" in attributes: # pragma no branch
self._contributions = self._makeIntAttribute(attributes["contributions"])
if "created_at" in attributes: # pragma no branch
self._created_at = self._makeDatetimeAttribute(attributes["created_at"])
if "disk_usage" in attributes: # pragma no branch
Expand Down
2 changes: 1 addition & 1 deletion github/tests/Repository.py
Expand Up @@ -110,7 +110,7 @@ def testDelete(self):
repo.delete()

def testGetContributors(self):
self.assertListKeyEqual(self.repo.get_contributors(), lambda c: c.login, ["jacquev6"])
self.assertListKeyEqual(self.repo.get_contributors(), lambda c: (c.login, c.contributions), [("jacquev6", 355)])

def testCreateMilestone(self):
milestone = self.repo.create_milestone("Milestone created by PyGithub", state="open", description="Description created by PyGithub", due_on=datetime.date(2012, 6, 15))
Expand Down

0 comments on commit b91dee8

Please sign in to comment.