Update hacking for Python3

The repo is Python 3 now, so update hacking to version 2.0 which
supports Python 3.

Fix problems found.

Update local hacking checks for new flake8.

Change-Id: I5cb9b15a3391bf32bb6e43958f8f6ffbcd6bcf07
This commit is contained in:
Andreas Jaeger 2020-03-30 08:14:51 +02:00
parent 242fead1ac
commit 787a6ac607
7 changed files with 15 additions and 10 deletions

View File

@ -22,6 +22,7 @@ _ROOT = os.path.abspath(os.path.dirname(__file__))
def get_resource(path):
return os.path.join(_ROOT, 'data', path)
version_info = pbr.version.VersionInfo('python-muranoclient')
try:

View File

@ -743,6 +743,7 @@ class DummyYaqlYamlLoader(yaml.SafeLoader):
"""Constructor that treats !yaql as string."""
pass
DummyYaqlYamlLoader.add_constructor(
u'!yaql', DummyYaqlYamlLoader.yaml_constructors[u'tag:yaml.org,2002:str'])
@ -750,6 +751,7 @@ DummyYaqlYamlLoader.add_constructor(
class YaqlYamlLoader(yaml.SafeLoader):
pass
# workaround for PyYAML bug: http://pyyaml.org/ticket/221
resolvers = {}
for k, v in yaml.SafeLoader.yaml_implicit_resolvers.items():
@ -761,6 +763,7 @@ def yaql_constructor(loader, node):
value = loader.construct_scalar(node)
return YaqlExpression(value)
YaqlYamlLoader.add_constructor(u'!yaql', yaql_constructor)
YaqlYamlLoader.add_implicit_resolver(u'!yaql', YaqlExpression, None)

View File

@ -25,6 +25,7 @@ def _set_up_yaql():
}
return yaql.YaqlFactory().create(options=legacy_engine_options)
YAQL = _set_up_yaql()
@ -46,7 +47,7 @@ class YaqlExpression(object):
def match(expr):
if not isinstance(expr, six.string_types):
return False
if re.match('^[\s\w\d.:]*$', expr):
if re.match(r'^[\s\w\d.:]*$', expr):
return False
try:
YAQL(expr)

View File

@ -35,7 +35,7 @@ class YaqlExpression(object):
def match(expr):
if not isinstance(expr, six.string_types):
return False
if re.match('^[\s\w\d.:]*$', expr):
if re.match(r'^[\s\w\d.:]*$', expr):
return False
try:
yaql.parse(expr)

View File

@ -97,7 +97,7 @@ class Controller(object):
:param artifact_id: ID of the artifact to modify.
:param remove_props: List of property names to remove
:param \*\*kwargs: Artifact attribute names and their new values.
:param **kwargs: Artifact attribute names and their new values.
"""
type_name, type_version = self._check_type_params(type_name,
type_version)

View File

@ -153,9 +153,9 @@ class ShellCommandTest(ShellTest):
def test_help(self):
required = [
'.*?^usage: murano',
'.*?^\s+package-create\s+Create an application package.',
'.*?^See "murano help COMMAND" for help on a specific command',
r'.*?^usage: murano',
r'.*?^\s+package-create\s+Create an application package.',
r'.*?^See "murano help COMMAND" for help on a specific command',
]
stdout, stderr = self.shell('help')
for r in required:
@ -174,9 +174,9 @@ class ShellCommandTest(ShellTest):
def test_help_no_options(self):
required = [
'.*?^usage: murano',
'.*?^\s+package-create\s+Create an application package',
'.*?^See "murano help COMMAND" for help on a specific command',
r'.*?^usage: murano',
r'.*?^\s+package-create\s+Create an application package',
r'.*?^See "murano help COMMAND" for help on a specific command',
]
stdout, stderr = self.shell('')
for r in required:

View File

@ -1,7 +1,7 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
hacking>=2.0,<2.1.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD