8000 Fix gist.history keyerrors · domdfcoding/github3.py@0f2b844 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0f2b844

Browse files
author
staticdev
committed
Fix gist.history keyerrors
1 parent 99c6515 commit 0f2b844

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

docs/source/release-notes/2.0.0.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
2.0.0: 2020-01-06
1+
2.0.0: 2020-01-10
22
-----------------
33

44
Features Added
@@ -10,6 +10,11 @@ Features Added
1010
- Remove compatibility imports for Python 2.
1111
- Remove dev-dependency for mock.
1212

13+
Bugs Fixed
14+
``````````
15+
16+
* Key errors on Gist.history.
17+
1318
Removals
1419
````````
1520

@@ -56,4 +61,3 @@ Removals
5661
- ``Organization#add_member`` add ``username`` to ``team``.
5762
- ``Organization#events`` use ``Organization#public_events``
5863
- ``Issue#assign`` use ``issues.issue.Issue.add_assignees``
59-

src/github3/gists/history.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,24 @@ class GistHistory(models.GitHubCore):
4343
The number of deletions from the gist compared to the previous
4444
revision.
4545
46-
.. attribute:: totoal
46+
.. attribute:: total
4747
4848
The total number of changes to the gist compared to the previous
4949
revision.
5050
"""
5151

52-
def _update_attributes(self, history):
52+
def _update_attributes(self, history) -> None:
5353
self.url = self._api = history["url"]
5454
self.version = history["version"]
5555
self.user = users.ShortUser(history["user"], self)
56-
self.change_status = history["change_status"]
57-
self.additions = self.change_status["additions"]
58-
self.deletions = self.change_status["deletions"]
59-
self.total = self.change_status["total"]
60-
self.committed_at = self._strptime(history["committed_at"])
61-
62-
def _repr(self):
63-
return "<Gist History [{0}]>".format(self.version)
56+
self.change_status = history.get("change_status")
57+
self.additions = self.change_status.get("additions")
58+
self.deletions = self.change_status.get("deletions")
59+
self.total = self.change_status.get("total")
60+
self.committed_at = self._strptime(history.get("committed_at"))
61+
62+
def _repr(self) -> str:
63+
return f"<Gist History [{self.version}]>"
6464

6565
def gist(self):
6666
"""Retrieve the gist at this version.

0 commit comments

Comments
 (0)
0