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:
Eric Barrett 2019-06-04 11:37:09 -04:00
parent 5e84b8a614
commit 8142803bfd
4 changed files with 7 additions and 9 deletions

View File

@ -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."""

View File

@ -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

View File

@ -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)

View File

@ -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 Dont put vim configuration in source files (off by default).
# H203 Use assertIs(Not)None to check for None (off by default).