diff --git a/github/InstallationAuthorization.py b/github/InstallationAuthorization.py index 6067de13..d0a47313 100644 --- a/github/InstallationAuthorization.py +++ b/github/InstallationAuthorization.py @@ -25,8 +25,6 @@ # # ################################################################################ -import datetime - import github.GithubObject import github.PaginatedList import github.NamedUser diff --git a/github/Invitation.py b/github/Invitation.py index f6deac32..6b66f388 100644 --- a/github/Invitation.py +++ b/github/Invitation.py @@ -24,8 +24,6 @@ # # ################################################################################ -import urllib - import github.GithubObject diff --git a/github/IssueEvent.py b/github/IssueEvent.py index a8d8abb2..e746ae0e 100644 --- a/github/IssueEvent.py +++ b/github/IssueEvent.py @@ -173,14 +173,6 @@ class IssueEvent(github.GithubObject.CompletableGithubObject): self._completeIfNotSet(self._rename) return self._rename.value - @property - def rename(self): - """ - :type: dict - """ - self._completeIfNotSet(self._rename) - return self._rename.value - @property def dismissed_review(self): """ diff --git a/github/MainClass.py b/github/MainClass.py index d6fca1cc..9d4dd68e 100644 --- a/github/MainClass.py +++ b/github/MainClass.py @@ -50,7 +50,6 @@ import datetime -import urllib import pickle import time import sys @@ -61,12 +60,10 @@ import urllib3 from Requester import Requester import AuthenticatedUser import NamedUser -import Organization import Gist import github.PaginatedList import Repository import Installation -import Legacy import License import Topic import github.GithubObject diff --git a/github/Organization.py b/github/Organization.py index d415f214..d3fdafd0 100644 --- a/github/Organization.py +++ b/github/Organization.py @@ -42,7 +42,6 @@ ################################################################################ import datetime -import json import github.GithubObject import github.PaginatedList diff --git a/github/PaginatedList.py b/github/PaginatedList.py index 3de289f6..20c2ddf8 100644 --- a/github/PaginatedList.py +++ b/github/PaginatedList.py @@ -42,8 +42,6 @@ try: except ImportError: from urlparse import parse_qs -import github.GithubObject - class PaginatedListBase: def __init__(self): diff --git a/github/Project.py b/github/Project.py index 83b4220e..e5653dc6 100644 --- a/github/Project.py +++ b/github/Project.py @@ -22,9 +22,6 @@ # # ################################################################################ -import datetime -import json - import github.GithubObject import github.ProjectColumn diff --git a/github/ProjectCard.py b/github/ProjectCard.py index 735ec3cb..f45a913c 100644 --- a/github/ProjectCard.py +++ b/github/ProjectCard.py @@ -22,8 +22,6 @@ # # ################################################################################ -import json - import github.GithubObject # NOTE: There is currently no way to get cards "in triage" for a project. diff --git a/github/ProjectColumn.py b/github/ProjectColumn.py index b96bc2a0..b00f6bac 100644 --- a/github/ProjectColumn.py +++ b/github/ProjectColumn.py @@ -22,8 +22,6 @@ # # ################################################################################ -import json - import github.GithubObject import github.Project import github.ProjectCard diff --git a/github/Rate.py b/github/Rate.py index 7e4f2dbf..e9fbe500 100644 --- a/github/Rate.py +++ b/github/Rate.py @@ -28,7 +28,6 @@ ################################################################################ import github.GithubObject -import datetime class Rate(github.GithubObject.NonCompletableGithubObject): diff --git a/github/Requester.py b/github/Requester.py index fe6fee9c..951940e3 100644 --- a/github/Requester.py +++ b/github/Requester.py @@ -325,7 +325,7 @@ class Requester: data = data.decode("utf-8") # pragma no cover (Covered by Issue142.testDecodeJson with Python 3) try: return json.loads(data) - except ValueError, e: + except ValueError: return {'data': data} def requestJson(self, verb, url, parameters=None, headers=None, input=None, cnx=None): diff --git a/scripts/fix_headers.py b/scripts/fix_headers.py index 08296ba4..eb2513dd 100755 --- a/scripts/fix_headers.py +++ b/scripts/fix_headers.py @@ -26,13 +26,11 @@ # # ################################################################################ -import fnmatch import os import subprocess -import itertools -eightySharps = "################################################################################" +eightySharps = "#"*80 def generateLicenseSection(filename): diff --git a/tests/CommitStatus.py b/tests/CommitStatus.py index 4bd93260..60baad67 100644 --- a/tests/CommitStatus.py +++ b/tests/CommitStatus.py @@ -32,7 +32,6 @@ import Framework -import github import datetime diff --git a/tests/ConditionalRequestUpdate.py b/tests/ConditionalRequestUpdate.py index 8418b91f..01ea2cf2 100644 --- a/tests/ConditionalRequestUpdate.py +++ b/tests/ConditionalRequestUpdate.py @@ -28,7 +28,6 @@ ################################################################################ import Framework -import github class ConditionalRequestUpdate(Framework.TestCase): diff --git a/tests/ContentFile.py b/tests/ContentFile.py index 328f9cd2..18b02805 100644 --- a/tests/ContentFile.py +++ b/tests/ContentFile.py @@ -32,9 +32,6 @@ import Framework -import github -import datetime - class ContentFile(Framework.TestCase): def setUp(self): diff --git a/tests/GitRelease.py b/tests/GitRelease.py index b05b9f06..bb861c64 100644 --- a/tests/GitRelease.py +++ b/tests/GitRelease.py @@ -38,7 +38,6 @@ import os import zipfile import datetime import Framework -from pprint import pprint class Release(Framework.TestCase): diff --git a/tests/GitReleaseAsset.py b/tests/GitReleaseAsset.py index c09ef336..0ba71ee5 100644 --- a/tests/GitReleaseAsset.py +++ b/tests/GitReleaseAsset.py @@ -26,7 +26,6 @@ import datetime import Framework -from pprint import pprint class ReleaseAsset(Framework.TestCase): diff --git a/tests/GithubIntegration.py b/tests/GithubIntegration.py index 538de031..28f13fdc 100644 --- a/tests/GithubIntegration.py +++ b/tests/GithubIntegration.py @@ -1,9 +1,9 @@ import jwt import json -import time +import time # NOQA import sys import unittest -import requests +import requests # NOQA import datetime from github.GithubObject import GithubObject diff --git a/tests/Issue139.py b/tests/Issue139.py index a9c8db86..bf9be293 100644 --- a/tests/Issue139.py +++ b/tests/Issue139.py @@ -26,7 +26,6 @@ ################################################################################ import Framework -import github class Issue139(Framework.TestCase): # https://github.com/jacquev6/PyGithub/issues/139 diff --git a/tests/Issue140.py b/tests/Issue140.py index 17945b2b..23935adf 100644 --- a/tests/Issue140.py +++ b/tests/Issue140.py @@ -26,7 +26,6 @@ ################################################################################ import Framework -import github class Issue140(Framework.TestCase): # https://github.com/jacquev6/PyGithub/issues/140 diff --git a/tests/Issue174.py b/tests/Issue174.py index a90560fe..852eb072 100644 --- a/tests/Issue174.py +++ b/tests/Issue174.py @@ -26,7 +26,6 @@ ################################################################################ import Framework -import github class Issue174(Framework.TestCase): diff --git a/tests/Issue214.py b/tests/Issue214.py index 2d2a94d7..1144c1d4 100644 --- a/tests/Issue214.py +++ b/tests/Issue214.py @@ -25,8 +25,6 @@ # # ################################################################################ -import github - import Framework diff --git a/tests/Issue216.py b/tests/Issue216.py index a1608ddf..6f734c1b 100644 --- a/tests/Issue216.py +++ b/tests/Issue216.py @@ -26,7 +26,6 @@ ################################################################################ import Framework -import github # Replay data forged by capitalizing headers from PaginatedList.setUp.txt and PaginatedList.testIteration.txt diff --git a/tests/Issue50.py b/tests/Issue50.py index b2dd2d9d..66bc1ab3 100644 --- a/tests/Issue50.py +++ b/tests/Issue50.py @@ -27,8 +27,6 @@ # # ################################################################################ -import github - import Framework diff --git a/tests/Issue87.py b/tests/Issue87.py index 1bd98dd7..93cab3b2 100644 --- a/tests/Issue87.py +++ b/tests/Issue87.py @@ -27,8 +27,6 @@ # # ################################################################################ -import github - import Framework diff --git a/tests/Issue937.py b/tests/Issue937.py index c92f82f7..d5d3fa19 100644 --- a/tests/Issue937.py +++ b/tests/Issue937.py @@ -23,7 +23,6 @@ ################################################################################ import Framework -import github class Issue937(Framework.TestCase): def setUp(self): @@ -35,4 +34,4 @@ class Issue937(Framework.TestCase): collaborators = self.repo.get_collaborators(affiliation='direct') self.assertListKeyEqual(collaborators, lambda u: u.login, ["hegde5"]) with self.assertRaises(AssertionError): - self.repo.get_collaborators(affiliation='invalid_option') \ No newline at end of file + self.repo.get_collaborators(affiliation='invalid_option') diff --git a/tests/Issue945.py b/tests/Issue945.py index 58e87806..ee758a74 100644 --- a/tests/Issue945.py +++ b/tests/Issue945.py @@ -24,8 +24,6 @@ import Framework -import github - class Issue945(Framework.TestCase): # https://github.com/PyGithub/PyGithub/issues/945 def setUp(self): diff --git a/tests/NamedUser.py b/tests/NamedUser.py index 9ac1ae99..6ac953c0 100644 --- a/tests/NamedUser.py +++ b/tests/NamedUser.py @@ -33,7 +33,6 @@ import Framework -import github import datetime diff --git a/tests/Notification.py b/tests/Notification.py index 04543094..84b623e2 100644 --- a/tests/Notification.py +++ b/tests/Notification.py @@ -30,8 +30,6 @@ import Framework -import datetime - class Notification(Framework.TestCase): def setUp(self): diff --git a/tests/PaginatedList.py b/tests/PaginatedList.py index f6a69365..978a0fdf 100644 --- a/tests/PaginatedList.py +++ b/tests/PaginatedList.py @@ -137,7 +137,7 @@ class PaginatedList(Framework.TestCase): def testCustomPerPageWithNoUrlParams(self): import CommitComment # Don't polute github.tests namespace, it would conflict with github.tests.CommitComment self.g.per_page = 100 - paginated_list = PaginatedListImpl( + PaginatedListImpl( CommitComment.CommitComment, self.repo._requester, self.repo.url + "/comments", diff --git a/tests/Repository.py b/tests/Repository.py index 09383929..b5832fbb 100644 --- a/tests/Repository.py +++ b/tests/Repository.py @@ -583,7 +583,7 @@ class Repository(Framework.TestCase): def testMergeWithConflict(self): with self.assertRaises(github.GithubException) as raisedexp: - commit = self.repo.merge("branchForBase", "branchForHead") + self.repo.merge("branchForBase", "branchForHead") self.assertEqual(raisedexp.exception.status, 409) self.assertEqual(raisedexp.exception.data, {"message": "Merge conflict"}) diff --git a/tests/RequiredPullRequestReviews.py b/tests/RequiredPullRequestReviews.py index 12a8df3f..aa253e1f 100644 --- a/tests/RequiredPullRequestReviews.py +++ b/tests/RequiredPullRequestReviews.py @@ -24,8 +24,6 @@ import Framework -import github - class RequiredPullRequestReviews(Framework.TestCase): def setUp(self): diff --git a/tests/RequiredStatusChecks.py b/tests/RequiredStatusChecks.py index 64e7aa9c..c1a7634f 100644 --- a/tests/RequiredStatusChecks.py +++ b/tests/RequiredStatusChecks.py @@ -24,8 +24,6 @@ import Framework -import github - class RequiredStatusChecks(Framework.TestCase): def setUp(self): diff --git a/tests/Retry.py b/tests/Retry.py index 3529caa6..79e6f284 100644 --- a/tests/Retry.py +++ b/tests/Retry.py @@ -75,10 +75,8 @@ class Retry(Framework.TestCase): self.assertEquals(repository.full_name, REPO_NAME) def testRaisesRetryErrorAfterMaxRetries(self): - try: - response = self.g.get_repo('PyGithub/PyGithub') - self.fail("RetryError should have been raised") - except requests.exceptions.RetryError: - self.assertEquals(len(httpretty.latest_requests), 4) - for request in httpretty.latest_requests: - self.assertEquals(request.path, '/repos/PyGithub/PyGithub') + with self.assertRaises(requests.exceptions.RetryError): + self.g.get_repo('PyGithub/PyGithub') + self.assertEquals(len(httpretty.latest_requests), 4) + for request in httpretty.latest_requests: + self.assertEquals(request.path, '/repos/PyGithub/PyGithub') diff --git a/tests/Time.py b/tests/Time.py index 53077321..ec9e808d 100644 --- a/tests/Time.py +++ b/tests/Time.py @@ -20,7 +20,7 @@ # # ################################################################################ -from datetime import datetime, timedelta, tzinfo +from datetime import timedelta, tzinfo class UTCtzinfo(tzinfo): def utcoffset(self, dt): diff --git a/tests/Traffic.py b/tests/Traffic.py index 6bde4396..38eed2f7 100644 --- a/tests/Traffic.py +++ b/tests/Traffic.py @@ -28,7 +28,6 @@ import Framework -import github import datetime class Traffic(Framework.TestCase):