mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 10:51:14 +00:00
Clean up a lot of pyflakes warnings (#1153)
Clean up unused imports or unused variables to mostly silence pyflakes. We aren't quite yet in a place where we can run it via Travis, but baby steps.
This commit is contained in:
@@ -25,8 +25,6 @@
|
||||
# #
|
||||
################################################################################
|
||||
|
||||
import datetime
|
||||
|
||||
import github.GithubObject
|
||||
import github.PaginatedList
|
||||
import github.NamedUser
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
# #
|
||||
################################################################################
|
||||
|
||||
import urllib
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
|
||||
@@ -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):
|
||||
"""
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
################################################################################
|
||||
|
||||
import datetime
|
||||
import json
|
||||
|
||||
import github.GithubObject
|
||||
import github.PaginatedList
|
||||
|
||||
@@ -42,8 +42,6 @@ try:
|
||||
except ImportError:
|
||||
from urlparse import parse_qs
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
|
||||
class PaginatedListBase:
|
||||
def __init__(self):
|
||||
|
||||
@@ -22,9 +22,6 @@
|
||||
# #
|
||||
################################################################################
|
||||
|
||||
import datetime
|
||||
import json
|
||||
|
||||
import github.GithubObject
|
||||
import github.ProjectColumn
|
||||
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
# #
|
||||
################################################################################
|
||||
|
||||
import json
|
||||
|
||||
import github.GithubObject
|
||||
|
||||
# NOTE: There is currently no way to get cards "in triage" for a project.
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
# #
|
||||
################################################################################
|
||||
|
||||
import json
|
||||
|
||||
import github.GithubObject
|
||||
import github.Project
|
||||
import github.ProjectCard
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
################################################################################
|
||||
|
||||
import github.GithubObject
|
||||
import datetime
|
||||
|
||||
|
||||
class Rate(github.GithubObject.NonCompletableGithubObject):
|
||||
|
||||
+1
-1
@@ -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):
|
||||
|
||||
@@ -26,13 +26,11 @@
|
||||
# #
|
||||
################################################################################
|
||||
|
||||
import fnmatch
|
||||
import os
|
||||
import subprocess
|
||||
import itertools
|
||||
|
||||
|
||||
eightySharps = "################################################################################"
|
||||
eightySharps = "#"*80
|
||||
|
||||
|
||||
def generateLicenseSection(filename):
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
|
||||
import Framework
|
||||
|
||||
import github
|
||||
import datetime
|
||||
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
################################################################################
|
||||
|
||||
import Framework
|
||||
import github
|
||||
|
||||
|
||||
class ConditionalRequestUpdate(Framework.TestCase):
|
||||
|
||||
@@ -32,9 +32,6 @@
|
||||
|
||||
import Framework
|
||||
|
||||
import github
|
||||
import datetime
|
||||
|
||||
|
||||
class ContentFile(Framework.TestCase):
|
||||
def setUp(self):
|
||||
|
||||
@@ -38,7 +38,6 @@ import os
|
||||
import zipfile
|
||||
import datetime
|
||||
import Framework
|
||||
from pprint import pprint
|
||||
|
||||
|
||||
class Release(Framework.TestCase):
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
import datetime
|
||||
import Framework
|
||||
from pprint import pprint
|
||||
|
||||
|
||||
class ReleaseAsset(Framework.TestCase):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
################################################################################
|
||||
|
||||
import Framework
|
||||
import github
|
||||
|
||||
|
||||
class Issue139(Framework.TestCase): # https://github.com/jacquev6/PyGithub/issues/139
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
################################################################################
|
||||
|
||||
import Framework
|
||||
import github
|
||||
|
||||
|
||||
class Issue140(Framework.TestCase): # https://github.com/jacquev6/PyGithub/issues/140
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
################################################################################
|
||||
|
||||
import Framework
|
||||
import github
|
||||
|
||||
|
||||
class Issue174(Framework.TestCase):
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
# #
|
||||
################################################################################
|
||||
|
||||
import github
|
||||
|
||||
import Framework
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
################################################################################
|
||||
|
||||
import Framework
|
||||
import github
|
||||
|
||||
|
||||
# Replay data forged by capitalizing headers from PaginatedList.setUp.txt and PaginatedList.testIteration.txt
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
# #
|
||||
################################################################################
|
||||
|
||||
import github
|
||||
|
||||
import Framework
|
||||
|
||||
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
# #
|
||||
################################################################################
|
||||
|
||||
import github
|
||||
|
||||
import Framework
|
||||
|
||||
|
||||
|
||||
+1
-2
@@ -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')
|
||||
self.repo.get_collaborators(affiliation='invalid_option')
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
|
||||
import Framework
|
||||
|
||||
import github
|
||||
|
||||
|
||||
class Issue945(Framework.TestCase): # https://github.com/PyGithub/PyGithub/issues/945
|
||||
def setUp(self):
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
|
||||
import Framework
|
||||
|
||||
import github
|
||||
import datetime
|
||||
|
||||
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
|
||||
import Framework
|
||||
|
||||
import datetime
|
||||
|
||||
|
||||
class Notification(Framework.TestCase):
|
||||
def setUp(self):
|
||||
|
||||
@@ -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",
|
||||
|
||||
+1
-1
@@ -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"})
|
||||
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
|
||||
import Framework
|
||||
|
||||
import github
|
||||
|
||||
|
||||
class RequiredPullRequestReviews(Framework.TestCase):
|
||||
def setUp(self):
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
|
||||
import Framework
|
||||
|
||||
import github
|
||||
|
||||
|
||||
class RequiredStatusChecks(Framework.TestCase):
|
||||
def setUp(self):
|
||||
|
||||
+5
-7
@@ -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')
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
# #
|
||||
################################################################################
|
||||
|
||||
from datetime import datetime, timedelta, tzinfo
|
||||
from datetime import timedelta, tzinfo
|
||||
|
||||
class UTCtzinfo(tzinfo):
|
||||
def utcoffset(self, dt):
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
import Framework
|
||||
|
||||
import github
|
||||
import datetime
|
||||
|
||||
class Traffic(Framework.TestCase):
|
||||
|
||||
Reference in New Issue
Block a user