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