Update to flake8 instead of pep8.
Change-Id: I3d4a31111c3044da06611405ce80f208ef8a0ce3
This commit is contained in:
parent
d5e96e7747
commit
de2e5aa462
@ -161,7 +161,6 @@ class Auditor(object):
|
|||||||
marker = ''
|
marker = ''
|
||||||
results = True
|
results = True
|
||||||
while results:
|
while results:
|
||||||
node_id = node['id']
|
|
||||||
try:
|
try:
|
||||||
conn = http_connect(node['ip'], node['port'],
|
conn = http_connect(node['ip'], node['port'],
|
||||||
node['device'], part, 'GET',
|
node['device'], part, 'GET',
|
||||||
@ -310,34 +309,39 @@ class Auditor(object):
|
|||||||
self.pool.waitall()
|
self.pool.waitall()
|
||||||
|
|
||||||
def print_stats(self):
|
def print_stats(self):
|
||||||
|
|
||||||
|
def _print_stat(name, stat):
|
||||||
|
# Right align stat name in a field of 18 characters
|
||||||
|
print "{0:>18}: {1}".format(name, stat)
|
||||||
|
|
||||||
print
|
print
|
||||||
print " Accounts checked: %d" % self.accounts_checked
|
_print_stat("Accounts checked", self.accounts_checked)
|
||||||
if self.account_not_found:
|
if self.account_not_found:
|
||||||
print " Missing Replicas: %d" % self.account_not_found
|
_print_stat("Missing Replicas", self.account_not_found)
|
||||||
if self.account_exceptions:
|
if self.account_exceptions:
|
||||||
print " Exceptions: %d" % self.account_exceptions
|
_print_stat("Exceptions", self.account_exceptions)
|
||||||
if self.account_container_mismatch:
|
if self.account_container_mismatch:
|
||||||
print "Container mismatch: %d" % self.account_container_mismatch
|
_print_stat("Container mismatch", self.account_container_mismatch)
|
||||||
if self.account_object_mismatch:
|
if self.account_object_mismatch:
|
||||||
print " Object mismatch: %d" % self.account_object_mismatch
|
_print_stat("Object mismatch", self.account_object_mismatch)
|
||||||
print
|
print
|
||||||
print "Containers checked: %d" % self.containers_checked
|
_print_stat("Containers checked", self.containers_checked)
|
||||||
if self.container_not_found:
|
if self.container_not_found:
|
||||||
print " Missing Replicas: %d" % self.container_not_found
|
_print_stat("Missing Replicas", self.container_not_found)
|
||||||
if self.container_exceptions:
|
if self.container_exceptions:
|
||||||
print " Exceptions: %d" % self.container_exceptions
|
_print_stat("Exceptions", self.container_exceptions)
|
||||||
if self.container_count_mismatch:
|
if self.container_count_mismatch:
|
||||||
print " Count mismatch: %d" % self.container_count_mismatch
|
_print_stat("Count mismatch", self.container_count_mismatch)
|
||||||
if self.container_obj_mismatch:
|
if self.container_obj_mismatch:
|
||||||
print " Object mismatch: %d" % self.container_obj_mismatch
|
_print_stat("Object mismatch", self.container_obj_mismatch)
|
||||||
print
|
print
|
||||||
print " Objects checked: %d" % self.objects_checked
|
_print_stat("Objects checked", self.objects_checked)
|
||||||
if self.object_not_found:
|
if self.object_not_found:
|
||||||
print " Missing Replicas: %d" % self.object_not_found
|
_print_stat("Missing Replicas", self.object_not_found)
|
||||||
if self.object_exceptions:
|
if self.object_exceptions:
|
||||||
print " Exceptions: %d" % self.object_exceptions
|
_print_stat("Exceptions", self.object_exceptions)
|
||||||
if self.object_checksum_mismatch:
|
if self.object_checksum_mismatch:
|
||||||
print " MD5 Mismatch: %d" % self.object_checksum_mismatch
|
_print_stat("MD5 Mismatch", self.object_checksum_mismatch)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import os
|
|
||||||
import traceback
|
import traceback
|
||||||
from ConfigParser import ConfigParser
|
from ConfigParser import ConfigParser
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import os
|
|
||||||
from ConfigParser import ConfigParser
|
from ConfigParser import ConfigParser
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
from sys import exit, stdout, stderr
|
from sys import exit, stdout, stderr
|
||||||
|
@ -44,7 +44,7 @@ def get_devices(device_dir, logger):
|
|||||||
device['block_device'] = block_device
|
device['block_device'] = block_device
|
||||||
try:
|
try:
|
||||||
device_num = os.stat(block_device).st_rdev
|
device_num = os.stat(block_device).st_rdev
|
||||||
except OSError, e:
|
except OSError:
|
||||||
# If we can't stat the device, then something weird is going on
|
# If we can't stat the device, then something weird is going on
|
||||||
logger.error("Error: Could not stat %s!" %
|
logger.error("Error: Could not stat %s!" %
|
||||||
block_device)
|
block_device)
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import cPickle as pickle
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import optparse
|
import optparse
|
||||||
import os
|
|
||||||
import signal
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -91,8 +91,8 @@ swift-ring-builder <builder_file>
|
|||||||
if d is not None))
|
if d is not None))
|
||||||
zones = len(set((d['region'], d['zone']) for d in builder.devs
|
zones = len(set((d['region'], d['zone']) for d in builder.devs
|
||||||
if d is not None))
|
if d is not None))
|
||||||
dev_count = len([d for d in builder.devs
|
dev_count = len([dev for dev in builder.devs
|
||||||
if d is not None])
|
if dev is not None])
|
||||||
balance = builder.get_balance()
|
balance = builder.get_balance()
|
||||||
print '%d partitions, %.6f replicas, %d regions, %d zones, ' \
|
print '%d partitions, %.6f replicas, %d regions, %d zones, ' \
|
||||||
'%d devices, %.02f balance' % (builder.parts, builder.replicas,
|
'%d devices, %.02f balance' % (builder.parts, builder.replicas,
|
||||||
|
@ -183,9 +183,9 @@ def cors_validation(func):
|
|||||||
expose_headers.append(header.lower())
|
expose_headers.append(header.lower())
|
||||||
if cors_info.get('expose_headers'):
|
if cors_info.get('expose_headers'):
|
||||||
expose_headers.extend(
|
expose_headers.extend(
|
||||||
[a.strip()
|
[header_line.strip()
|
||||||
for a in cors_info['expose_headers'].split(' ')
|
for header_line in cors_info['expose_headers'].split(' ')
|
||||||
if a.strip()])
|
if header_line.strip()])
|
||||||
resp.headers['Access-Control-Expose-Headers'] = \
|
resp.headers['Access-Control-Expose-Headers'] = \
|
||||||
', '.join(expose_headers)
|
', '.join(expose_headers)
|
||||||
|
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
|
# Install bounded pep8/pyflakes first, then let flake8 install
|
||||||
|
pep8==1.4.5
|
||||||
|
pyflakes==0.7.2
|
||||||
|
flake8==2.0
|
||||||
|
|
||||||
coverage
|
coverage
|
||||||
nose
|
nose
|
||||||
nosexcover
|
nosexcover
|
||||||
openstack.nose_plugin
|
openstack.nose_plugin
|
||||||
nosehtmloutput
|
nosehtmloutput
|
||||||
pep8==1.3.3
|
|
||||||
sphinx>=1.1.2
|
sphinx>=1.1.2
|
||||||
mock>=0.8.0
|
mock>=0.8.0
|
||||||
|
11
tox.ini
11
tox.ini
@ -18,13 +18,18 @@ commands = nosetests test/unit {posargs}
|
|||||||
downloadcache = ~/cache/pip
|
downloadcache = ~/cache/pip
|
||||||
|
|
||||||
[testenv:pep8]
|
[testenv:pep8]
|
||||||
deps = pep8==1.3.3
|
|
||||||
commands =
|
commands =
|
||||||
pep8 --repeat --show-source --exclude=.venv,.tox,dist,doc,test .
|
flake8
|
||||||
pep8 --repeat --show-pep8 --show-source --filename=swift* bin
|
flake8 --filename=swift* bin
|
||||||
|
|
||||||
[testenv:cover]
|
[testenv:cover]
|
||||||
setenv = NOSE_WITH_COVERAGE=1
|
setenv = NOSE_WITH_COVERAGE=1
|
||||||
|
|
||||||
[testenv:venv]
|
[testenv:venv]
|
||||||
commands = {posargs}
|
commands = {posargs}
|
||||||
|
|
||||||
|
[flake8]
|
||||||
|
ignore = H
|
||||||
|
builtins = _
|
||||||
|
exclude = .venv,.tox,dist,doc,test,*egg
|
||||||
|
show-source = True
|
||||||
|
Loading…
Reference in New Issue
Block a user