diff options
| author | Dolph Mathews <dolph.mathews@gmail.com> | 2013-05-23 15:09:14 -0500 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-05-24 01:24:49 +0000 |
| commit | 0f6f386c74754bc2e94a177d00d74bc074eba2fd (patch) | |
| tree | 6a74fbaa67bbd60afc2bd871c91ca199b15f8583 | |
| parent | c49066d02b7b4913500ed34d7df5dcabd86c75e8 (diff) | |
| download | keystone-0f6f386c74754bc2e94a177d00d74bc074eba2fd.tar.gz keystone-0f6f386c74754bc2e94a177d00d74bc074eba2fd.tar.xz keystone-0f6f386c74754bc2e94a177d00d74bc074eba2fd.zip | |
import only modules (flake8 H302)
Change-Id: I0fa6fc6bf9d51b60fa987a0040168f3f0ef78a4a
| -rw-r--r-- | keystone/common/bufferedhttp.py | 4 | ||||
| -rw-r--r-- | keystone/common/logging.py | 7 | ||||
| -rw-r--r-- | keystone/contrib/s3/core.py | 6 | ||||
| -rw-r--r-- | keystone/middleware/ec2_token.py | 4 | ||||
| -rw-r--r-- | tests/test_contrib_s3_core.py | 4 | ||||
| -rw-r--r-- | tox.ini | 3 |
6 files changed, 13 insertions, 15 deletions
diff --git a/keystone/common/bufferedhttp.py b/keystone/common/bufferedhttp.py index 97334849..00efe79b 100644 --- a/keystone/common/bufferedhttp.py +++ b/keystone/common/bufferedhttp.py @@ -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) diff --git a/keystone/common/logging.py b/keystone/common/logging.py index 9d8bee88..8c036f02 100644 --- a/keystone/common/logging.py +++ b/keystone/common/logging.py @@ -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): diff --git a/keystone/contrib/s3/core.py b/keystone/contrib/s3/core.py index 56e10ca4..44b038d4 100644 --- a/keystone/contrib/s3/core.py +++ b/keystone/contrib/s3/core.py @@ -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') diff --git a/keystone/middleware/ec2_token.py b/keystone/middleware/ec2_token.py index daac10aa..7cd007c7 100644 --- a/keystone/middleware/ec2_token.py +++ b/keystone/middleware/ec2_token.py @@ -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: diff --git a/tests/test_contrib_s3_core.py b/tests/test_contrib_s3_core.py index 0dceefbf..40d8d54c 100644 --- a/tests/test_contrib_s3_core.py +++ b/tests/test_contrib_s3_core.py @@ -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': @@ -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 |
