8000 Fix gist.history keyerrors by staticdev · Pull Request #1020 · sigmavirus24/github3.py · GitHub
[go: up one dir, main page]

Skip to content

Fix gist.history keyerrors #1020

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions docs/source/release-notes/2.0.0.rst
Original file line number Diff line number Diff line change
@@ -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
4DE1
Original file line number Diff line number Diff line change
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