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 = ''
|
||||
results = True
|
||||
while results:
|
||||
node_id = node['id']
|
||||
try:
|
||||
conn = http_connect(node['ip'], node['port'],
|
||||
node['device'], part, 'GET',
|
||||
@ -310,34 +309,39 @@ class Auditor(object):
|
||||
self.pool.waitall()
|
||||
|
||||
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 " Accounts checked: %d" % self.accounts_checked
|
||||
_print_stat("Accounts checked", self.accounts_checked)
|
||||
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:
|
||||
print " Exceptions: %d" % self.account_exceptions
|
||||
_print_stat("Exceptions", self.account_exceptions)
|
||||
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:
|
||||
print " Object mismatch: %d" % self.account_object_mismatch
|
||||
_print_stat("Object mismatch", self.account_object_mismatch)
|
||||
print
|
||||
print "Containers checked: %d" % self.containers_checked
|
||||
_print_stat("Containers checked", self.containers_checked)
|
||||
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:
|
||||
print " Exceptions: %d" % self.container_exceptions
|
||||
_print_stat("Exceptions", self.container_exceptions)
|
||||
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:
|
||||
print " Object mismatch: %d" % self.container_obj_mismatch
|
||||
_print_stat("Object mismatch", self.container_obj_mismatch)
|
||||
print
|
||||
print " Objects checked: %d" % self.objects_checked
|
||||
_print_stat("Objects checked", self.objects_checked)
|
||||
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:
|
||||
print " Exceptions: %d" % self.object_exceptions
|
||||
_print_stat("Exceptions", self.object_exceptions)
|
||||
if self.object_checksum_mismatch:
|
||||
print " MD5 Mismatch: %d" % self.object_checksum_mismatch
|
||||
_print_stat("MD5 Mismatch", self.object_checksum_mismatch)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -14,7 +14,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import os
|
||||
import traceback
|
||||
from ConfigParser import ConfigParser
|
||||
from cStringIO import StringIO
|
||||
|
@ -14,7 +14,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import os
|
||||
from ConfigParser import ConfigParser
|
||||
from optparse import OptionParser
|
||||
from sys import exit, stdout, stderr
|
||||
|
@ -44,7 +44,7 @@ def get_devices(device_dir, logger):
|
||||
device['block_device'] = block_device
|
||||
try:
|
||||
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
|
||||
logger.error("Error: Could not stat %s!" %
|
||||
block_device)
|
||||
|
@ -15,7 +15,6 @@
|
||||
# limitations under the License.
|
||||
|
||||
import sys
|
||||
import cPickle as pickle
|
||||
from datetime import datetime
|
||||
from hashlib import md5
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import optparse
|
||||
import os
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
@ -91,8 +91,8 @@ swift-ring-builder <builder_file>
|
||||
if d is not None))
|
||||
zones = len(set((d['region'], d['zone']) for d in builder.devs
|
||||
if d is not None))
|
||||
dev_count = len([d for d in builder.devs
|
||||
if d is not None])
|
||||
dev_count = len([dev for dev in builder.devs
|
||||
if dev is not None])
|
||||
balance = builder.get_balance()
|
||||
print '%d partitions, %.6f replicas, %d regions, %d zones, ' \
|
||||
'%d devices, %.02f balance' % (builder.parts, builder.replicas,
|
||||
|
@ -183,9 +183,9 @@ def cors_validation(func):
|
||||
expose_headers.append(header.lower())
|
||||
if cors_info.get('expose_headers'):
|
||||
expose_headers.extend(
|
||||
[a.strip()
|
||||
for a in cors_info['expose_headers'].split(' ')
|
||||
if a.strip()])
|
||||
[header_line.strip()
|
||||
for header_line in cors_info['expose_headers'].split(' ')
|
||||
if header_line.strip()])
|
||||
resp.headers['Access-Control-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
|
||||
nose
|
||||
nosexcover
|
||||
openstack.nose_plugin
|
||||
nosehtmloutput
|
||||
pep8==1.3.3
|
||||
sphinx>=1.1.2
|
||||
mock>=0.8.0
|
||||
|
11
tox.ini
11
tox.ini
@ -18,13 +18,18 @@ commands = nosetests test/unit {posargs}
|
||||
downloadcache = ~/cache/pip
|
||||
|
||||
[testenv:pep8]
|
||||
deps = pep8==1.3.3
|
||||
commands =
|
||||
pep8 --repeat --show-source --exclude=.venv,.tox,dist,doc,test .
|
||||
pep8 --repeat --show-pep8 --show-source --filename=swift* bin
|
||||
flake8
|
||||
flake8 --filename=swift* bin
|
||||
|
||||
[testenv:cover]
|
||||
setenv = NOSE_WITH_COVERAGE=1
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
[flake8]
|
||||
ignore = H
|
||||
builtins = _
|
||||
exclude = .venv,.tox,dist,doc,test,*egg
|
||||
show-source = True
|
||||
|
Loading…
Reference in New Issue
Block a user