diff --git a/fm-rest-api/fm/fm/db/api.py b/fm-rest-api/fm/fm/db/api.py index dcbbe959..52f49a23 100644 --- a/fm-rest-api/fm/fm/db/api.py +++ b/fm-rest-api/fm/fm/db/api.py @@ -9,6 +9,7 @@ Base classes for storage engines """ import abc +import six from oslo_config import cfg from oslo_db import api as db_api @@ -24,11 +25,10 @@ def get_instance(): return IMPL +@six.add_metaclass(abc.ABCMeta) class Connection(object): """Base class for storage system connections.""" - __metaclass__ = abc.ABCMeta - @abc.abstractmethod def __init__(self): """Constructor.""" diff --git a/python-fmclient/fmclient/fmclient/common/wrapping_formatters.py b/python-fmclient/fmclient/fmclient/common/wrapping_formatters.py index 874bc46c..5f1cfabb 100644 --- a/python-fmclient/fmclient/fmclient/common/wrapping_formatters.py +++ b/python-fmclient/fmclient/fmclient/common/wrapping_formatters.py @@ -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={}): - class ColumnStats: + class ColumnStats(object): def __init__(self, field, field_label, custom_formatter=None): self.field = field self.field_label = field_label diff --git a/python-fmclient/fmclient/fmclient/shell.py b/python-fmclient/fmclient/fmclient/shell.py index c9d3be8f..97aa5e71 100644 --- a/python-fmclient/fmclient/fmclient/shell.py +++ b/python-fmclient/fmclient/fmclient/shell.py @@ -8,6 +8,7 @@ Command-line interface for Fault Management """ +from __future__ import print_function import argparse import httplib2 import logging @@ -311,14 +312,14 @@ def main(): FmShell().main(sys.argv[1:]) except KeyboardInterrupt as e: - print >> sys.stderr, ('caught: %r, aborting' % (e)) + print('caught: %r, aborting' % (e), file=sys.stderr) sys.exit(0) except IOError as e: sys.exit(0) except Exception as e: - print >> sys.stderr, e + print(e, file=sys.stderr) sys.exit(1) diff --git a/tox.ini b/tox.ini index 516b0ed3..369605a5 100644 --- a/tox.ini +++ b/tox.ini @@ -44,9 +44,6 @@ commands = # H102 Apache 2.0 license header not found # H104 File contains nothing but comments # 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 # H306 imports not in alphabetical order # H401 docstring should not start with a space @@ -59,7 +56,7 @@ commands = # E501 skipped because some of the code files include templates # that end up quite wide 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-* # 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).