Skip to content

Commit f7b648f

Browse files
author
Daniel Hermes
committed
Fixing lint errors. Fixes Issue 244.
Reviewed in https://codereview.appspot.com/7516043/
1 parent 1024403 commit f7b648f

5 files changed

Lines changed: 27 additions & 27 deletions

File tree

apiclient/discovery.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,30 @@
2525
'key2param',
2626
]
2727

28+
29+
# Standard library imports
2830
import copy
29-
import httplib2
31+
from email.mime.multipart import MIMEMultipart
32+
from email.mime.nonmultipart import MIMENonMultipart
3033
import keyword
3134
import logging
35+
import mimetypes
3236
import os
3337
import re
34-
import uritemplate
3538
import urllib
3639
import urlparse
37-
import mimeparse
38-
import mimetypes
3940

4041
try:
4142
from urlparse import parse_qsl
4243
except ImportError:
4344
from cgi import parse_qsl
4445

46+
# Third-party imports
47+
import httplib2
48+
import mimeparse
49+
import uritemplate
50+
51+
# Local imports
4552
from apiclient.errors import HttpError
4653
from apiclient.errors import InvalidJsonError
4754
from apiclient.errors import MediaUploadSizeError
@@ -55,11 +62,10 @@
5562
from apiclient.model import MediaModel
5663
from apiclient.model import RawModel
5764
from apiclient.schema import Schemas
58-
from email.mime.multipart import MIMEMultipart
59-
from email.mime.nonmultipart import MIMENonMultipart
60-
from oauth2client.util import positional
61-
from oauth2client.util import _add_query_parameter
6265
from oauth2client.anyjson import simplejson
66+
from oauth2client.util import _add_query_parameter
67+
from oauth2client.util import positional
68+
6369

6470
# The client library requires a version of httplib2 that supports RETRIES.
6571
httplib2.RETRIES = 1
@@ -79,10 +85,10 @@
7985
'required': True,
8086
}
8187
MEDIA_BODY_PARAMETER_DEFAULT_VALUE = {
82-
'description': ('The filename of the media request body, or an instance '
83-
'of a MediaUpload object.'),
84-
'type': 'string',
85-
'required': False,
88+
'description': ('The filename of the media request body, or an instance '
89+
'of a MediaUpload object.'),
90+
'type': 'string',
91+
'required': False,
8692
}
8793

8894
# Parameters accepted by the stack, but not visible via discovery.

oauth2client/appengine.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
import os
2727
import pickle
2828
import time
29-
import urllib
30-
import urlparse
3129

3230
from google.appengine.api import app_identity
3331
from google.appengine.api import memcache
@@ -57,10 +55,6 @@
5755
except ImportError:
5856
ndb = None
5957

60-
try:
61-
from urlparse import parse_qsl
62-
except ImportError:
63-
from cgi import parse_qsl
6458

6559
logger = logging.getLogger(__name__)
6660

@@ -799,7 +793,7 @@ def get(self):
799793
if decorator._token_response_param and credentials.token_response:
800794
resp_json = simplejson.dumps(credentials.token_response)
801795
redirect_uri = util._add_query_parameter(
802-
redirect_uri, decorator._token_response_param, resp_json)
796+
redirect_uri, decorator._token_response_param, resp_json)
803797

804798
self.redirect(redirect_uri)
805799

tests/test_errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,6 @@ def test_non_json(self):
9494

9595
def test_missing_reason(self):
9696
"""Test an empty dict with a missing resp.reason."""
97-
resp, content = fake_response('}NOT OK', {'status':'400'}, reason=None)
97+
resp, content = fake_response('}NOT OK', {'status': '400'}, reason=None)
9898
error = HttpError(resp, content)
9999
self.assertEqual(str(error), '<HttpError 400 "">')

tests/test_oauth2client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ def test_token_refresh_success(self):
144144
for status_code in REFRESH_STATUS_CODES:
145145
token_response = {'access_token': '1/3w', 'expires_in': 3600}
146146
http = HttpMockSequence([
147-
({'status': status_code}, ''),
148-
({'status': '200'}, simplejson.dumps(token_response)),
149-
({'status': '200'}, 'echo_request_headers'),
150-
])
147+
({'status': status_code}, ''),
148+
({'status': '200'}, simplejson.dumps(token_response)),
149+
({'status': '200'}, 'echo_request_headers'),
150+
])
151151
http = self.credentials.authorize(http)
152152
resp, content = http.request('http://example.com')
153153
self.assertEqual('Bearer 1/3w', content['Authorization'])

tests/test_oauth2client_appengine.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,9 +510,9 @@ def test_required(self):
510510
self.assertEqual('http://localhost/foo_path', parts[0])
511511
self.assertEqual(None, self.decorator.credentials)
512512
if self.decorator._token_response_param:
513-
response = parse_qs(parts[1])[self.decorator._token_response_param][0]
514-
self.assertEqual(Http2Mock.content,
515-
simplejson.loads(urllib.unquote(response)))
513+
response = parse_qs(parts[1])[self.decorator._token_response_param][0]
514+
self.assertEqual(Http2Mock.content,
515+
simplejson.loads(urllib.unquote(response)))
516516

517517
m.UnsetStubs()
518518
m.VerifyAll()

0 commit comments

Comments
 (0)