Enable Python3 Compatibility
Flake8 currently ignores the following errors: H233: Python 3.x incompatible use of print operator H236: Python 3.x incompatible __metaclass__ H238: Old style class declaration, use new style Enable them for python3 compability Change-Id: I8959f3a78ce683eb93a16234908662189dd7c8a5 Story: 2004515 Task: 29304 Signed-off-by: Eric Barrett <eric.barrett@windriver.com>
This commit is contained in:
parent
5e84b8a614
commit
8142803bfd
@ -9,6 +9,7 @@ Base classes for storage engines
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
|
import six
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_db import api as db_api
|
from oslo_db import api as db_api
|
||||||
@ -24,11 +25,10 @@ def get_instance():
|
|||||||
return IMPL
|
return IMPL
|
||||||
|
|
||||||
|
|
||||||
|
@six.add_metaclass(abc.ABCMeta)
|
||||||
class Connection(object):
|
class Connection(object):
|
||||||
"""Base class for storage system connections."""
|
"""Base class for storage system connections."""
|
||||||
|
|
||||||
__metaclass__ = abc.ABCMeta
|
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""Constructor."""
|
"""Constructor."""
|
||||||
|
@ -425,7 +425,7 @@ def wrapper_formatter_factory(ctx, field, formatter):
|
|||||||
|
|
||||||
|
|
||||||
def build_column_stats_for_best_guess_formatting(objs, fields, field_labels, custom_formatters={}):
|
def build_column_stats_for_best_guess_formatting(objs, fields, field_labels, custom_formatters={}):
|
||||||
class ColumnStats:
|
class ColumnStats(object):
|
||||||
def __init__(self, field, field_label, custom_formatter=None):
|
def __init__(self, field, field_label, custom_formatter=None):
|
||||||
self.field = field
|
self.field = field
|
||||||
self.field_label = field_label
|
self.field_label = field_label
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
Command-line interface for Fault Management
|
Command-line interface for Fault Management
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import argparse
|
import argparse
|
||||||
import httplib2
|
import httplib2
|
||||||
import logging
|
import logging
|
||||||
@ -311,14 +312,14 @@ def main():
|
|||||||
FmShell().main(sys.argv[1:])
|
FmShell().main(sys.argv[1:])
|
||||||
|
|
||||||
except KeyboardInterrupt as e:
|
except KeyboardInterrupt as e:
|
||||||
print >> sys.stderr, ('caught: %r, aborting' % (e))
|
print('caught: %r, aborting' % (e), file=sys.stderr)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print >> sys.stderr, e
|
print(e, file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
5
tox.ini
5
tox.ini
@ -44,9 +44,6 @@ commands =
|
|||||||
# H102 Apache 2.0 license header not found
|
# H102 Apache 2.0 license header not found
|
||||||
# H104 File contains nothing but comments
|
# H104 File contains nothing but comments
|
||||||
# H105 Don't use author tags
|
# H105 Don't use author tags
|
||||||
# H233 Python 3.x incompatible use of print operator
|
|
||||||
# H236 Python 3.x incompatible __metaclass__
|
|
||||||
# H238 old style class declaration, use new style
|
|
||||||
# H301 one import per line
|
# H301 one import per line
|
||||||
# H306 imports not in alphabetical order
|
# H306 imports not in alphabetical order
|
||||||
# H401 docstring should not start with a space
|
# H401 docstring should not start with a space
|
||||||
@ -59,7 +56,7 @@ commands =
|
|||||||
# E501 skipped because some of the code files include templates
|
# E501 skipped because some of the code files include templates
|
||||||
# that end up quite wide
|
# that end up quite wide
|
||||||
show-source = True
|
show-source = True
|
||||||
ignore = H102,H104,H105,H233,H236,H238,H301,H306,H401,H403,H404,H405,H702,H903,E123,E125,E501
|
ignore = H102,H104,H105,H301,H306,H401,H403,H404,H405,H702,H903,E123,E125,E501
|
||||||
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-*
|
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-*
|
||||||
# TODO: H106 Don’t put vim configuration in source files (off by default).
|
# TODO: H106 Don’t put vim configuration in source files (off by default).
|
||||||
# H203 Use assertIs(Not)None to check for None (off by default).
|
# H203 Use assertIs(Not)None to check for None (off by default).
|
||||||
|
Loading…
Reference in New Issue
Block a user