Skip to content

Commit

Permalink
Merge pull request #1020 from sigmavirus24/fix-history-keyerrors
Browse files Browse the repository at this point in the history
Fix gist.history keyerrors
  • Loading branch information
sigmavirus24 committed Jan 12, 2021
2 parents 99c6515 + 2bf6380 commit 6572d75
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 6 additions & 2 deletions docs/source/release-notes/2.0.0.rst
@@ -1,4 +1,4 @@
2.0.0: 2020-01-06
2.0.0: 2020-01-10
-----------------

Features Added
Expand All @@ -10,6 +10,11 @@ Features Added
- Remove compatibility imports for Python 2.
- Remove dev-dependency for mock.

Bugs Fixed
``````````

* Key errors on Gist.history.

Removals
````````

Expand Down Expand Up @@ -56,4 +61,3 @@ Removals
- ``Organization#add_member`` add ``username`` to ``team``.
- ``Organization#events`` use ``Organization#public_events``
- ``Issue#assign`` use ``issues.issue.Issue.add_assignees``

12 changes: 6 additions & 6 deletions src/github3/gists/history.py
Expand Up @@ -43,24 +43,24 @@ class GistHistory(models.GitHubCore):
The number of deletions from the gist compared to the previous
revision.
.. attribute:: totoal
.. attribute:: total
The total number of changes to the gist compared to the previous
revision.
"""

def _update_attributes(self, history):
def _update_attributes(self, history) -> None:
self.url = self._api = history["url"]
self.version = history["version"]
self.user = users.ShortUser(history["user"], self)
self.change_status = history["change_status"]
self.additions = self.change_status["additions"]
self.deletions = self.change_status["deletions"]
self.additions = self.change_status.get("additions")
self.deletions = self.change_status.get("deletions")
self.total = self.change_status["total"]
self.committed_at = self._strptime(history["committed_at"])

def _repr(self):
return "<Gist History [{0}]>".format(self.version)
def _repr(self) -> str:
return f"<Gist History [{self.version}]>"

def gist(self):
"""Retrieve the gist at this version.
Expand Down

0 comments on commit 6572d75

Please sign in to comment.