Fixing lint errors. Fixes Issue 244.
Reviewed in https://codereview.appspot.com/7516043/
This commit is contained in:
@@ -25,23 +25,30 @@ __all__ = [
|
||||
'key2param',
|
||||
]
|
||||
|
||||
|
||||
# Standard library imports
|
||||
import copy
|
||||
import httplib2
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.nonmultipart import MIMENonMultipart
|
||||
import keyword
|
||||
import logging
|
||||
import mimetypes
|
||||
import os
|
||||
import re
|
||||
import uritemplate
|
||||
import urllib
|
||||
import urlparse
|
||||
import mimeparse
|
||||
import mimetypes
|
||||
|
||||
try:
|
||||
from urlparse import parse_qsl
|
||||
except ImportError:
|
||||
from cgi import parse_qsl
|
||||
|
||||
# Third-party imports
|
||||
import httplib2
|
||||
import mimeparse
|
||||
import uritemplate
|
||||
|
||||
# Local imports
|
||||
from apiclient.errors import HttpError
|
||||
from apiclient.errors import InvalidJsonError
|
||||
from apiclient.errors import MediaUploadSizeError
|
||||
@@ -55,11 +62,10 @@ from apiclient.model import JsonModel
|
||||
from apiclient.model import MediaModel
|
||||
from apiclient.model import RawModel
|
||||
from apiclient.schema import Schemas
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.nonmultipart import MIMENonMultipart
|
||||
from oauth2client.util import positional
|
||||
from oauth2client.util import _add_query_parameter
|
||||
from oauth2client.anyjson import simplejson
|
||||
from oauth2client.util import _add_query_parameter
|
||||
from oauth2client.util import positional
|
||||
|
||||
|
||||
# The client library requires a version of httplib2 that supports RETRIES.
|
||||
httplib2.RETRIES = 1
|
||||
@@ -79,10 +85,10 @@ BODY_PARAMETER_DEFAULT_VALUE = {
|
||||
'required': True,
|
||||
}
|
||||
MEDIA_BODY_PARAMETER_DEFAULT_VALUE = {
|
||||
'description': ('The filename of the media request body, or an instance '
|
||||
'of a MediaUpload object.'),
|
||||
'type': 'string',
|
||||
'required': False,
|
||||
'description': ('The filename of the media request body, or an instance '
|
||||
'of a MediaUpload object.'),
|
||||
'type': 'string',
|
||||
'required': False,
|
||||
}
|
||||
|
||||
# Parameters accepted by the stack, but not visible via discovery.
|
||||
|
||||
@@ -26,8 +26,6 @@ import logging
|
||||
import os
|
||||
import pickle
|
||||
import time
|
||||
import urllib
|
||||
import urlparse
|
||||
|
||||
from google.appengine.api import app_identity
|
||||
from google.appengine.api import memcache
|
||||
@@ -57,10 +55,6 @@ try:
|
||||
except ImportError:
|
||||
ndb = None
|
||||
|
||||
try:
|
||||
from urlparse import parse_qsl
|
||||
except ImportError:
|
||||
from cgi import parse_qsl
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -799,7 +793,7 @@ class OAuth2Decorator(object):
|
||||
if decorator._token_response_param and credentials.token_response:
|
||||
resp_json = simplejson.dumps(credentials.token_response)
|
||||
redirect_uri = util._add_query_parameter(
|
||||
redirect_uri, decorator._token_response_param, resp_json)
|
||||
redirect_uri, decorator._token_response_param, resp_json)
|
||||
|
||||
self.redirect(redirect_uri)
|
||||
|
||||
|
||||
@@ -94,6 +94,6 @@ class Error(unittest.TestCase):
|
||||
|
||||
def test_missing_reason(self):
|
||||
"""Test an empty dict with a missing resp.reason."""
|
||||
resp, content = fake_response('}NOT OK', {'status':'400'}, reason=None)
|
||||
resp, content = fake_response('}NOT OK', {'status': '400'}, reason=None)
|
||||
error = HttpError(resp, content)
|
||||
self.assertEqual(str(error), '<HttpError 400 "">')
|
||||
|
||||
@@ -144,10 +144,10 @@ class BasicCredentialsTests(unittest.TestCase):
|
||||
for status_code in REFRESH_STATUS_CODES:
|
||||
token_response = {'access_token': '1/3w', 'expires_in': 3600}
|
||||
http = HttpMockSequence([
|
||||
({'status': status_code}, ''),
|
||||
({'status': '200'}, simplejson.dumps(token_response)),
|
||||
({'status': '200'}, 'echo_request_headers'),
|
||||
])
|
||||
({'status': status_code}, ''),
|
||||
({'status': '200'}, simplejson.dumps(token_response)),
|
||||
({'status': '200'}, 'echo_request_headers'),
|
||||
])
|
||||
http = self.credentials.authorize(http)
|
||||
resp, content = http.request('http://example.com')
|
||||
self.assertEqual('Bearer 1/3w', content['Authorization'])
|
||||
|
||||
@@ -510,9 +510,9 @@ class DecoratorTests(unittest.TestCase):
|
||||
self.assertEqual('http://localhost/foo_path', parts[0])
|
||||
self.assertEqual(None, self.decorator.credentials)
|
||||
if self.decorator._token_response_param:
|
||||
response = parse_qs(parts[1])[self.decorator._token_response_param][0]
|
||||
self.assertEqual(Http2Mock.content,
|
||||
simplejson.loads(urllib.unquote(response)))
|
||||
response = parse_qs(parts[1])[self.decorator._token_response_param][0]
|
||||
self.assertEqual(Http2Mock.content,
|
||||
simplejson.loads(urllib.unquote(response)))
|
||||
|
||||
m.UnsetStubs()
|
||||
m.VerifyAll()
|
||||
|
||||
Reference in New Issue
Block a user