Fix pep8 E265 warning of hacking 0.10
Fix the warning E265 "block comment should start with '# '" added in pep 1.5. Change-Id: Ib57282e958be9c7cddffc7bca34fbbf1d4c460fd
This commit is contained in:
parent
a77cd04149
commit
a0db56dcde
@ -401,7 +401,7 @@ def direct_put_object(node, part, account, container, name, contents,
|
||||
headers['Content-Length'] = '0'
|
||||
if isinstance(contents, basestring):
|
||||
contents = [contents]
|
||||
#Incase the caller want to insert an object with specific age
|
||||
# Incase the caller want to insert an object with specific age
|
||||
add_ts = 'X-Timestamp' not in headers
|
||||
|
||||
if content_length is None:
|
||||
|
@ -67,7 +67,7 @@ def is_server_error(status):
|
||||
# List of HTTP status codes
|
||||
|
||||
###############################################################################
|
||||
## 1xx Informational
|
||||
# 1xx Informational
|
||||
###############################################################################
|
||||
|
||||
HTTP_CONTINUE = 100
|
||||
@ -77,7 +77,7 @@ HTTP_CHECKPOINT = 103
|
||||
HTTP_REQUEST_URI_TOO_LONG = 122
|
||||
|
||||
###############################################################################
|
||||
## 2xx Success
|
||||
# 2xx Success
|
||||
###############################################################################
|
||||
|
||||
HTTP_OK = 200
|
||||
@ -91,7 +91,7 @@ HTTP_MULTI_STATUS = 207 # WebDAV
|
||||
HTTP_IM_USED = 226
|
||||
|
||||
###############################################################################
|
||||
## 3xx Redirection
|
||||
# 3xx Redirection
|
||||
###############################################################################
|
||||
|
||||
HTTP_MULTIPLE_CHOICES = 300
|
||||
@ -105,7 +105,7 @@ HTTP_TEMPORARY_REDIRECT = 307
|
||||
HTTP_RESUME_INCOMPLETE = 308
|
||||
|
||||
###############################################################################
|
||||
## 4xx Client Error
|
||||
# 4xx Client Error
|
||||
###############################################################################
|
||||
|
||||
HTTP_BAD_REQUEST = 400
|
||||
@ -141,7 +141,7 @@ HTTP_BLOCKED_BY_WINDOWS_PARENTAL_CONTROLS = 450
|
||||
HTTP_CLIENT_CLOSED_REQUEST = 499
|
||||
|
||||
###############################################################################
|
||||
## 5xx Server Error
|
||||
# 5xx Server Error
|
||||
###############################################################################
|
||||
|
||||
HTTP_INTERNAL_SERVER_ERROR = 500
|
||||
|
@ -704,7 +704,7 @@ class Server(object):
|
||||
pid = self.spawn(conf_file, **kwargs)
|
||||
except OSError as e:
|
||||
if e.errno == errno.ENOENT:
|
||||
#TODO(clayg): should I check if self.cmd exists earlier?
|
||||
# TODO(clayg): should I check if self.cmd exists earlier?
|
||||
print(_("%s does not exist") % self.cmd)
|
||||
break
|
||||
else:
|
||||
|
@ -410,7 +410,7 @@ class KeystoneAuth(object):
|
||||
user_id, user_name = env_identity['user']
|
||||
referrers, roles = swift_acl.parse_acl(getattr(req, 'acl', None))
|
||||
|
||||
#allow OPTIONS requests to proceed as normal
|
||||
# allow OPTIONS requests to proceed as normal
|
||||
if req.method == 'OPTIONS':
|
||||
return
|
||||
|
||||
@ -526,7 +526,7 @@ class KeystoneAuth(object):
|
||||
except ValueError:
|
||||
return HTTPNotFound(request=req)
|
||||
|
||||
#allow OPTIONS requests to proceed as normal
|
||||
# allow OPTIONS requests to proceed as normal
|
||||
if req.method == 'OPTIONS':
|
||||
return
|
||||
|
||||
|
@ -340,7 +340,7 @@ class ReconMiddleware(object):
|
||||
elif rcheck == 'replication' and rtype in all_rtypes:
|
||||
content = self.get_replication_info(rtype)
|
||||
elif rcheck == 'replication' and rtype is None:
|
||||
#handle old style object replication requests
|
||||
# handle old style object replication requests
|
||||
content = self.get_replication_info('object')
|
||||
elif rcheck == "devices":
|
||||
content = self.get_device_info()
|
||||
|
@ -531,7 +531,7 @@ class TempAuth(object):
|
||||
return None
|
||||
|
||||
if req.method == 'OPTIONS':
|
||||
#allow OPTIONS requests to proceed as normal
|
||||
# allow OPTIONS requests to proceed as normal
|
||||
self.logger.debug("Allow OPTIONS request.")
|
||||
return None
|
||||
|
||||
|
@ -423,7 +423,7 @@ class HTMLViewer(object):
|
||||
plt.yticks(y_pos, nfls)
|
||||
plt.xlabel(names[metric_selected])
|
||||
plt.title('Profile Statistics (by %s)' % names[metric_selected])
|
||||
#plt.gcf().tight_layout(pad=1.2)
|
||||
# plt.gcf().tight_layout(pad=1.2)
|
||||
with tempfile.TemporaryFile() as profile_img:
|
||||
plt.savefig(profile_img, format='png', dpi=300)
|
||||
profile_img.seek(0)
|
||||
|
@ -569,9 +569,9 @@ class FallocateWrapper(object):
|
||||
self.func_name = 'posix_fallocate'
|
||||
self.fallocate = noop_libc_function
|
||||
return
|
||||
## fallocate is preferred because we need the on-disk size to match
|
||||
## the allocated size. Older versions of sqlite require that the
|
||||
## two sizes match. However, fallocate is Linux only.
|
||||
# fallocate is preferred because we need the on-disk size to match
|
||||
# the allocated size. Older versions of sqlite require that the
|
||||
# two sizes match. However, fallocate is Linux only.
|
||||
for func in ('fallocate', 'posix_fallocate'):
|
||||
self.func_name = func
|
||||
self.fallocate = load_libc_function(func, log_error=False)
|
||||
|
@ -208,7 +208,7 @@ class Connection(object):
|
||||
def http_connect(self):
|
||||
self.connection = self.conn_class(self.storage_host,
|
||||
port=self.storage_port)
|
||||
#self.connection.set_debuglevel(3)
|
||||
# self.connection.set_debuglevel(3)
|
||||
|
||||
def make_path(self, path=None, cfg=None):
|
||||
if path is None:
|
||||
@ -334,7 +334,7 @@ class Connection(object):
|
||||
|
||||
self.connection = self.conn_class(self.storage_host,
|
||||
port=self.storage_port)
|
||||
#self.connection.set_debuglevel(3)
|
||||
# self.connection.set_debuglevel(3)
|
||||
self.connection.putrequest('PUT', path)
|
||||
for key, value in headers.items():
|
||||
self.connection.putheader(key, value)
|
||||
|
@ -1403,7 +1403,7 @@ class TestFile(Base):
|
||||
self.assertTrue(file_item.read(hdrs=hdrs) == data, range_string)
|
||||
|
||||
def testRangedGetsWithLWSinHeader(self):
|
||||
#Skip this test until webob 1.2 can tolerate LWS in Range header.
|
||||
# Skip this test until webob 1.2 can tolerate LWS in Range header.
|
||||
file_length = 10000
|
||||
file_item = self.env.container.file(Utils.create_name())
|
||||
data = file_item.write_random(file_length)
|
||||
@ -1478,8 +1478,8 @@ class TestFile(Base):
|
||||
self.assert_status(501)
|
||||
|
||||
# bad request types
|
||||
#for req in ('LICK', 'GETorHEAD_base', 'container_info',
|
||||
# 'best_response'):
|
||||
# for req in ('LICK', 'GETorHEAD_base', 'container_info',
|
||||
# 'best_response'):
|
||||
for req in ('LICK', 'GETorHEAD_base'):
|
||||
self.env.account.conn.make_request(req)
|
||||
self.assert_status(405)
|
||||
|
@ -77,7 +77,7 @@ class TestReplicatorSync(test_db_replicator.TestReplicatorSync):
|
||||
# add a row to "local" db
|
||||
broker.put_container('/a/c', time.time(), 0, 0, 0,
|
||||
POLICIES.default.idx)
|
||||
#replicate
|
||||
# replicate
|
||||
daemon = replicator.AccountReplicator({})
|
||||
|
||||
def _rsync_file(db_file, remote_file, **kwargs):
|
||||
|
@ -387,7 +387,7 @@ class TestReconCommands(unittest.TestCase):
|
||||
res_account = 'Invalid: http://127.0.0.1:6012/ is account-server'
|
||||
valid = "1/1 hosts ok, 0 error[s] while checking hosts."
|
||||
|
||||
#Test for object server type - default
|
||||
# Test for object server type - default
|
||||
with nested(*patches):
|
||||
self.recon.server_type_check(hosts)
|
||||
|
||||
@ -396,7 +396,7 @@ class TestReconCommands(unittest.TestCase):
|
||||
self.assertTrue(res_account in output.splitlines())
|
||||
stdout.truncate(0)
|
||||
|
||||
#Test ok for object server type - default
|
||||
# Test ok for object server type - default
|
||||
with nested(*patches):
|
||||
self.recon.server_type_check([hosts[0]])
|
||||
|
||||
@ -404,7 +404,7 @@ class TestReconCommands(unittest.TestCase):
|
||||
self.assertTrue(valid in output.splitlines())
|
||||
stdout.truncate(0)
|
||||
|
||||
#Test for account server type
|
||||
# Test for account server type
|
||||
with nested(*patches):
|
||||
self.recon.server_type = 'account'
|
||||
self.recon.server_type_check(hosts)
|
||||
@ -414,7 +414,7 @@ class TestReconCommands(unittest.TestCase):
|
||||
self.assertTrue(res_object in output.splitlines())
|
||||
stdout.truncate(0)
|
||||
|
||||
#Test ok for account server type
|
||||
# Test ok for account server type
|
||||
with nested(*patches):
|
||||
self.recon.server_type = 'account'
|
||||
self.recon.server_type_check([hosts[2]])
|
||||
@ -423,7 +423,7 @@ class TestReconCommands(unittest.TestCase):
|
||||
self.assertTrue(valid in output.splitlines())
|
||||
stdout.truncate(0)
|
||||
|
||||
#Test for container server type
|
||||
# Test for container server type
|
||||
with nested(*patches):
|
||||
self.recon.server_type = 'container'
|
||||
self.recon.server_type_check(hosts)
|
||||
@ -433,7 +433,7 @@ class TestReconCommands(unittest.TestCase):
|
||||
self.assertTrue(res_object in output.splitlines())
|
||||
stdout.truncate(0)
|
||||
|
||||
#Test ok for container server type
|
||||
# Test ok for container server type
|
||||
with nested(*patches):
|
||||
self.recon.server_type = 'container'
|
||||
self.recon.server_type_check([hosts[1]])
|
||||
|
@ -96,7 +96,7 @@ class TestAccountQuota(unittest.TestCase):
|
||||
environ={'REQUEST_METHOD': 'PUT',
|
||||
'swift.cache': cache})
|
||||
res = req.get_response(app)
|
||||
#Response code of 200 because authentication itself is not done here
|
||||
# Response code of 200 because authentication itself is not done here
|
||||
self.assertEquals(res.status_int, 200)
|
||||
|
||||
def test_no_quotas(self):
|
||||
|
@ -1,4 +1,4 @@
|
||||
#-*- coding:utf-8 -*-
|
||||
# coding: utf-8
|
||||
# Copyright (c) 2013 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -774,11 +774,11 @@ class TestReconSuccess(TestCase):
|
||||
self.assertEquals(rv, unmounted_resp)
|
||||
|
||||
def test_get_diskusage(self):
|
||||
#posix.statvfs_result(f_bsize=4096, f_frsize=4096, f_blocks=1963185,
|
||||
# f_bfree=1113075, f_bavail=1013351,
|
||||
# f_files=498736,
|
||||
# f_ffree=397839, f_favail=397839, f_flag=0,
|
||||
# f_namemax=255)
|
||||
# posix.statvfs_result(f_bsize=4096, f_frsize=4096, f_blocks=1963185,
|
||||
# f_bfree=1113075, f_bavail=1013351,
|
||||
# f_files=498736,
|
||||
# f_ffree=397839, f_favail=397839, f_flag=0,
|
||||
# f_namemax=255)
|
||||
statvfs_content = (4096, 4096, 1963185, 1113075, 1013351, 498736,
|
||||
397839, 397839, 0, 255)
|
||||
du_resp = [{'device': 'canhazdrive1', 'avail': 4150685696,
|
||||
@ -815,9 +815,9 @@ class TestReconSuccess(TestCase):
|
||||
self.mockos.ismount_output = True
|
||||
|
||||
def fake_lstat(*args, **kwargs):
|
||||
#posix.lstat_result(st_mode=1, st_ino=2, st_dev=3, st_nlink=4,
|
||||
# st_uid=5, st_gid=6, st_size=7, st_atime=8,
|
||||
# st_mtime=9, st_ctime=10)
|
||||
# posix.lstat_result(st_mode=1, st_ino=2, st_dev=3, st_nlink=4,
|
||||
# st_uid=5, st_gid=6, st_size=7, st_atime=8,
|
||||
# st_mtime=9, st_ctime=10)
|
||||
return stat_result((1, 2, 3, 4, 5, 6, 7, 8, 9, 10))
|
||||
|
||||
def fake_exists(*args, **kwargs):
|
||||
@ -867,7 +867,7 @@ class TestReconMiddleware(unittest.TestCase):
|
||||
os.listdir = self.fake_list
|
||||
self.app = recon.ReconMiddleware(FakeApp(), {'object_recon': "true"})
|
||||
os.listdir = self.real_listdir
|
||||
#self.app.object_recon = True
|
||||
# self.app.object_recon = True
|
||||
self.app.get_mem = self.frecon.fake_mem
|
||||
self.app.get_load = self.frecon.fake_load
|
||||
self.app.get_async_info = self.frecon.fake_async
|
||||
@ -927,21 +927,21 @@ class TestReconMiddleware(unittest.TestCase):
|
||||
|
||||
def test_recon_get_replication_all(self):
|
||||
get_replication_resp = ['{"replicationtest": "1"}']
|
||||
#test account
|
||||
# test account
|
||||
req = Request.blank('/recon/replication/account',
|
||||
environ={'REQUEST_METHOD': 'GET'})
|
||||
resp = self.app(req.environ, start_response)
|
||||
self.assertEquals(resp, get_replication_resp)
|
||||
self.assertEquals(self.frecon.fake_replication_rtype, 'account')
|
||||
self.frecon.fake_replication_rtype = None
|
||||
#test container
|
||||
# test container
|
||||
req = Request.blank('/recon/replication/container',
|
||||
environ={'REQUEST_METHOD': 'GET'})
|
||||
resp = self.app(req.environ, start_response)
|
||||
self.assertEquals(resp, get_replication_resp)
|
||||
self.assertEquals(self.frecon.fake_replication_rtype, 'container')
|
||||
self.frecon.fake_replication_rtype = None
|
||||
#test object
|
||||
# test object
|
||||
req = Request.blank('/recon/replication/object',
|
||||
environ={'REQUEST_METHOD': 'GET'})
|
||||
resp = self.app(req.environ, start_response)
|
||||
|
@ -4298,7 +4298,7 @@ class TestAuditLocationGenerator(unittest.TestCase):
|
||||
else:
|
||||
return orig_listdir(path)
|
||||
|
||||
#Check Raise on Bad partition
|
||||
# Check Raise on Bad partition
|
||||
tmpdir = mkdtemp()
|
||||
data = os.path.join(tmpdir, "drive", "data")
|
||||
os.makedirs(data)
|
||||
@ -4315,7 +4315,7 @@ class TestAuditLocationGenerator(unittest.TestCase):
|
||||
self.assertRaises(OSError, audit)
|
||||
rmtree(tmpdir)
|
||||
|
||||
#Check Raise on Bad Suffix
|
||||
# Check Raise on Bad Suffix
|
||||
tmpdir = mkdtemp()
|
||||
data = os.path.join(tmpdir, "drive", "data")
|
||||
os.makedirs(data)
|
||||
@ -4334,7 +4334,7 @@ class TestAuditLocationGenerator(unittest.TestCase):
|
||||
self.assertRaises(OSError, audit)
|
||||
rmtree(tmpdir)
|
||||
|
||||
#Check Raise on Bad Hash
|
||||
# Check Raise on Bad Hash
|
||||
tmpdir = mkdtemp()
|
||||
data = os.path.join(tmpdir, "drive", "data")
|
||||
os.makedirs(data)
|
||||
@ -4358,14 +4358,14 @@ class TestAuditLocationGenerator(unittest.TestCase):
|
||||
logger = FakeLogger()
|
||||
data = os.path.join(tmpdir, "drive", "data")
|
||||
os.makedirs(data)
|
||||
#Create a file, that represents a non-dir drive
|
||||
# Create a file, that represents a non-dir drive
|
||||
open(os.path.join(tmpdir, 'asdf'), 'w')
|
||||
locations = utils.audit_location_generator(
|
||||
tmpdir, "data", mount_check=False, logger=logger
|
||||
)
|
||||
self.assertEqual(list(locations), [])
|
||||
self.assertEqual(1, len(logger.get_lines_for_level('warning')))
|
||||
#Test without the logger
|
||||
# Test without the logger
|
||||
locations = utils.audit_location_generator(
|
||||
tmpdir, "data", mount_check=False
|
||||
)
|
||||
@ -4376,7 +4376,7 @@ class TestAuditLocationGenerator(unittest.TestCase):
|
||||
logger = FakeLogger()
|
||||
data = os.path.join(tmpdir, "drive", "data")
|
||||
os.makedirs(data)
|
||||
#Create a file, that represents a non-dir drive
|
||||
# Create a file, that represents a non-dir drive
|
||||
open(os.path.join(tmpdir, 'asdf'), 'w')
|
||||
locations = utils.audit_location_generator(
|
||||
tmpdir, "data", mount_check=True, logger=logger
|
||||
@ -4384,7 +4384,7 @@ class TestAuditLocationGenerator(unittest.TestCase):
|
||||
self.assertEqual(list(locations), [])
|
||||
self.assertEqual(2, len(logger.get_lines_for_level('warning')))
|
||||
|
||||
#Test without the logger
|
||||
# Test without the logger
|
||||
locations = utils.audit_location_generator(
|
||||
tmpdir, "data", mount_check=True
|
||||
)
|
||||
@ -4416,7 +4416,7 @@ class TestAuditLocationGenerator(unittest.TestCase):
|
||||
logger = FakeLogger()
|
||||
data = os.path.join(tmpdir, "drive", "data")
|
||||
os.makedirs(data)
|
||||
#Create a file, that represents a non-dir drive
|
||||
# Create a file, that represents a non-dir drive
|
||||
open(os.path.join(tmpdir, 'asdf'), 'w')
|
||||
partition = os.path.join(data, "partition1")
|
||||
os.makedirs(partition)
|
||||
|
@ -994,8 +994,8 @@ class TestContainerBroker(unittest.TestCase):
|
||||
'/snakes', Timestamp(0).internal, 0,
|
||||
'text/plain', 'd41d8cd98f00b204e9800998ecf8427e')
|
||||
|
||||
#def list_objects_iter(self, limit, marker, prefix, delimiter,
|
||||
# path=None, format=None):
|
||||
# def list_objects_iter(self, limit, marker, prefix, delimiter,
|
||||
# path=None, format=None):
|
||||
listing = broker.list_objects_iter(100, None, None, '/pets/f', '/')
|
||||
self.assertEquals([row[0] for row in listing],
|
||||
['/pets/fish/', '/pets/fish_info.txt'])
|
||||
|
@ -1,4 +1,4 @@
|
||||
#-*- coding:utf-8 -*-
|
||||
# coding: utf-8
|
||||
# Copyright (c) 2010-2012 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
@ -4905,7 +4905,7 @@ class TestObjectController(unittest.TestCase):
|
||||
req.account = 'a'
|
||||
controller.object_name = 'o'
|
||||
set_http_connect(200, 200, 200, 200, 200, 201, 201, 201,
|
||||
#act cont objc objc objc obj obj obj
|
||||
# act cont objc objc objc obj obj obj
|
||||
timestamps=('1', '1', '1', '3', '2', '4', '4',
|
||||
'4'))
|
||||
self.app.memcache.store = {}
|
||||
@ -4925,7 +4925,7 @@ class TestObjectController(unittest.TestCase):
|
||||
req.account = 'a'
|
||||
controller.object_name = 'o'
|
||||
set_http_connect(200, 200, 200, 200, 200, 200, 200, 201, 201, 201,
|
||||
#act cont acct cont objc objc objc obj obj obj
|
||||
# act cont acct cont objc objc objc obj obj obj
|
||||
timestamps=('1', '1', '1', '1', '3', '2', '1',
|
||||
'4', '4', '4'))
|
||||
self.app.memcache.store = {}
|
||||
@ -9085,7 +9085,7 @@ class TestProxyObjectPerformance(unittest.TestCase):
|
||||
# Small, fast for testing
|
||||
obj_len = 2 * 64 * 1024
|
||||
# Use 1 GB or more for measurements
|
||||
#obj_len = 2 * 512 * 1024 * 1024
|
||||
# obj_len = 2 * 512 * 1024 * 1024
|
||||
self.path = '/v1/a/c/o.large'
|
||||
fd.write('PUT %s HTTP/1.1\r\n'
|
||||
'Host: localhost\r\n'
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
#-*- coding:utf-8 -*-
|
||||
# coding: utf-8
|
||||
# Copyright (c) 2013 OpenStack Foundation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
Loading…
Reference in New Issue
Block a user