tox: update pep8 parameters based on the latest Swift

This also fixes newly detected style errors.

Change-Id: Ib0c2241986415ec0246611c2155dc1d773399b3a
This commit is contained in:
MORITA Kazutaka
2014-08-02 01:37:34 +09:00
parent 941f58522b
commit 373e4158c7
9 changed files with 17 additions and 12 deletions

View File

@@ -25,6 +25,7 @@ XMLNS_XSI = 'http://www.w3.org/2001/XMLSchema-instance'
MAX_ACL_BODY_SIZE = 200 * 1024
def add_canonical_user(parent, tag, user, nsmap=None):
"""
Create an element for cannonical user.
@@ -91,10 +92,11 @@ def swift_acl_translate(acl, group='', user='', xml=False):
['HTTP_X_CONTAINER_READ',
'.r:*,.rlistings']]
#TODO: if there's a way to get group and user, this should work for
# TODO: if there's a way to get group and user, this should work for
# private:
#swift_acl['private'] = [['HTTP_X_CONTAINER_WRITE', group + ':' + user], \
# ['HTTP_X_CONTAINER_READ', group + ':' + user]]
# swift_acl['private'] = \
# [['HTTP_X_CONTAINER_WRITE', group + ':' + user], \
# ['HTTP_X_CONTAINER_READ', group + ':' + user]]
swift_acl['private'] = [['HTTP_X_CONTAINER_WRITE', '.'],
['HTTP_X_CONTAINER_READ', '.']]
if xml:

View File

@@ -23,6 +23,7 @@ from swift3.cfg import CONF
LOGGER = get_logger(CONF, log_route='swift3')
def bucket_operation(func=None, err_resp=None, err_msg=None):
"""
A decorator to ensure that the request is a bucket operation. If the
@@ -49,6 +50,7 @@ def bucket_operation(func=None, err_resp=None, err_msg=None):
else:
return _bucket_operation
def object_operation(func):
"""
A decorator to ensure that the request is an object operation. If the

View File

@@ -27,6 +27,7 @@ XMLNS_S3 = 'http://s3.amazonaws.com/doc/2006-03-01/'
LOGGER = get_logger(CONF, log_route='swift3')
class DocumentInvalid(S3Exception, lxml.etree.DocumentInvalid):
pass

View File

@@ -62,6 +62,7 @@ from swift3.response import ErrorResponse, InternalError, MethodNotAllowed, \
ResponseBase
from swift3.cfg import CONF
def validate_bucket_name(name):
"""
Validates the name of the bucket against S3 criteria,
@@ -104,7 +105,7 @@ class Swift3Middleware(object):
if isinstance(err_resp, InternalError):
self.logger.exception(err_resp)
resp = err_resp
except Exception, e:
except Exception as e:
self.logger.exception(e)
resp = InternalError(reason=e)

View File

@@ -17,6 +17,7 @@ import unittest
from swift3.cfg import Config
class TestSwift3Cfg(unittest.TestCase):
def test_config(self):
conf = Config(

View File

@@ -25,7 +25,6 @@ class TestSwift3Logging(Swift3TestCase):
def setUp(self):
super(TestSwift3Logging, self).setUp()
def test_object_logging_GET(self):
req = Request.blank('/bucket/object?logging',
environ={'REQUEST_METHOD': 'GET'},

View File

@@ -136,12 +136,10 @@ class TestSwift3Middleware(Swift3TestCase):
'response-content-encoding&response-content-language&'
'response-content-type&response-expires', {})
str1 = canonical_string('/', headers=
{'Content-Type': None,
'X-Amz-Something': 'test'})
str2 = canonical_string('/', headers=
{'Content-Type': '',
'X-Amz-Something': 'test'})
str1 = canonical_string('/', headers={'Content-Type': None,
'X-Amz-Something': 'test'})
str2 = canonical_string('/', headers={'Content-Type': '',
'X-Amz-Something': 'test'})
str3 = canonical_string('/', headers={'X-Amz-Something': 'test'})
self.assertEquals(str1, str2)

View File

@@ -15,6 +15,7 @@
import re
def camel_to_snake(camel):
return re.sub('(.)([A-Z])', r'\1_\2', camel).lower()

View File

@@ -54,6 +54,6 @@ downloadcache = ~/cache/pip
[flake8]
# follow the same style guidelines with swift
ignore = H
select = H102,H103,H201,H501,H903
select = F,E,W,H102,H103,H501,H903,H231
exclude = .venv,.git,.tox,dist,doc,*egg,build
show-source = True