import only modules (flake8 H302)

Change-Id: I0fa6fc6bf9d51b60fa987a0040168f3f0ef78a4a
This commit is contained in:
Dolph Mathews 2013-05-23 15:09:14 -05:00 committed by Gerrit Code Review
parent c49066d02b
commit 0f6f386c74
6 changed files with 13 additions and 15 deletions

View File

@ -29,7 +29,7 @@ BufferedHTTPResponse.
"""
import time
from urllib import quote
import urllib
from eventlet.green import httplib
@ -130,7 +130,7 @@ def http_connect(ipaddr, port, device, partition, method, path,
:returns: HTTPConnection object
"""
path = quote('/' + device + '/' + str(partition) + path)
path = urllib.quote('/' + device + '/' + str(partition) + path)
return http_connect_raw(ipaddr, port, device, partition, method, path,
headers, query_string, ssl, key_file, cert_file)

View File

@ -21,11 +21,10 @@ from __future__ import absolute_import
import functools
import logging
import logging.config
import logging.handlers
import pprint
import traceback
from logging.handlers import SysLogHandler
from logging.handlers import WatchedFileHandler
# A list of things we want to replicate from logging.
# levels
@ -57,8 +56,8 @@ Formatter = logging.Formatter
# handlers
StreamHandler = logging.StreamHandler
WatchedFileHandler = WatchedFileHandler
SysLogHandler = SysLogHandler
WatchedFileHandler = logging.handlers.WatchedFileHandler
SysLogHandler = logging.handlers.SysLogHandler
def log_debug(f):

View File

@ -24,10 +24,9 @@ for the EC2 module for how to generate the required credentials.
"""
import base64
import hashlib
import hmac
from hashlib import sha1
from keystone.common import utils
from keystone.common import wsgi
from keystone import config
@ -51,7 +50,8 @@ class S3Controller(ec2.Ec2Controller):
def check_signature(self, creds_ref, credentials):
msg = base64.urlsafe_b64decode(str(credentials['token']))
key = str(creds_ref['secret'])
signed = base64.encodestring(hmac.new(key, msg, sha1).digest()).strip()
signed = base64.encodestring(
hmac.new(key, msg, hashlib.sha1).digest()).strip()
if not utils.auth_str_equal(credentials['signature'], signed):
raise exception.Unauthorized('Credential signature mismatch')

View File

@ -22,7 +22,7 @@ Starting point for routing EC2 requests.
"""
from urlparse import urlparse
import urlparse
from eventlet.green import httplib
import webob.dec
@ -73,7 +73,7 @@ class EC2Token(wsgi.Middleware):
# Disable 'has no x member' pylint error
# for httplib and urlparse
# pylint: disable-msg=E1101
o = urlparse(FLAGS.keystone_ec2_url)
o = urlparse.urlparse(FLAGS.keystone_ec2_url)
if o.scheme == 'http':
conn = httplib.HTTPConnection(o.netloc)
else:

View File

@ -16,7 +16,7 @@
import uuid
from keystone.contrib.s3.core import S3Controller
from keystone.contrib import s3
from keystone.contrib import ec2
from keystone import exception
@ -30,7 +30,7 @@ class S3ContribCore(test.TestCase):
self.load_backends()
self.ec2_api = ec2.Manager()
self.controller = S3Controller()
self.controller = s3.S3Controller()
def test_good_signature(self):
creds_ref = {'secret':

View File

@ -31,14 +31,13 @@ commands = {posargs}
[flake8]
show-source = true
# H302: import only modules
# H304: no relative imports.
# H306: imports not in alphabetical order
# H401: docstring should not start with a space
# H402: one line docstring needs punctuation
# H403: multi line docstring end on new line
# H404: multi line docstring should start with a summary
ignore = H302,H304,H306,H401,H402,H403,H404
ignore = H304,H306,H401,H402,H403,H404
builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools,vendor