10000 Merge pull request #1020 from sigmavirus24/fix-history-keyerrors · staticdev/github4.py@6572d75 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on May 22, 2021. It is now read-only.

Commit 6572d75

Browse files
authored
Merge pull request sigmavirus24#1020 from sigmavirus24/fix-history-keyerrors
Fix gist.history keyerrors
2 parents 99c6515 + 2bf6380 commit 6572d75

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
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: 6 additions & 6 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)
5656
self.change_status = history["change_status"]
57-
self.additions = self.change_status["additions"]
58-
self.deletions = self.change_status["deletions"]
57+
self.additions = self.change_status.get("additions")
58+
self.deletions = self.change_status.get("deletions")
5959
self.total = self.change_status["total"]
6060
self.committed_at = self._strptime(history["committed_at"])
6161

62-
def _repr(self):
63-
return "<Gist History [{0}]>".format(self.version)
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