Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.
Fix problems found.
MODIFY
doc/source/ext/gen_ref.py
doc/source/ext/gen_ref.py
@@ -53,6 +53,7 @@ def gen_ref(ver, title, names):
"signs": "=" * len(sec_title),
"pkg": pkg, "name": name})
+
gen_ref("", "Client Reference", {"client": "Client", "exc": "Exceptions"})
gen_ref("v1", "Version 1 API Reference",
{"stacks": "Stacks",

MODIFY
heatclient/common/event_utils.py
heatclient/common/event_utils.py
@@ -182,9 +182,9 @@ def poll_for_events(hc, stack_name, action=None, poll_period=5, marker=None,
if action:
stop_status = ('%s_FAILED' % action, '%s_COMPLETE' % action)
- stop_check = lambda a: a in stop_status
+ stop_check = lambda a: a in stop_status # noqa: E731
else:
- stop_check = lambda a: a.endswith('_COMPLETE') or a.endswith('_FAILED')
+ stop_check = lambda a: a.endswith('_COMPLETE') or a.endswith('_FAILED') # noqa E731
no_event_polls = 0
msg_template = _("\n Stack %(name)s %(status)s \n")

MODIFY
heatclient/common/template_format.py
heatclient/common/template_format.py
@@ -39,6 +39,8 @@ def _construct_yaml_str(self, node):
# Override the default string handling function
# to always return unicode objects
return self.construct_scalar(node)
+
+
yaml_loader.add_constructor(u'tag:yaml.org,2002:str', _construct_yaml_str)
# Unquoted dates like 2013-05-23 in yaml files get loaded as objects of type
# datetime.data which causes problems in API layer when being processed by

MODIFY
heatclient/shell.py
heatclient/shell.py
@@ -615,5 +615,6 @@ def main(args=None):
print(encodeutils.safe_encode(six.text_type(e)), file=sys.stderr)
sys.exit(1)
+
if __name__ == "__main__":
main()

MODIFY
heatclient/tests/unit/test_deployment_utils.py
heatclient/tests/unit/test_deployment_utils.py
@@ -291,9 +291,9 @@ class TempURLSignalTest(testtools.TestCase):
'[a-f0-9]{3}-[a-f0-9]{12}')
url = deployment_utils.create_temp_url(swift_client, 'bar', 60)
self.assertFalse(swift_client.post_account.called)
- regexp = ("http://fake-host.com:8080/v1/AUTH_demo/bar-%s"
- "/%s\?temp_url_sig=[0-9a-f]{40}&"
- "temp_url_expires=[0-9]{10}" % (uuid_pattern, uuid_pattern))
+ regexp = (r"http://fake-host.com:8080/v1/AUTH_demo/bar-%s"
+ r"/%s\?temp_url_sig=[0-9a-f]{40}&"
+ r"temp_url_expires=[0-9]{10}" % (uuid_pattern, uuid_pattern))
self.assertThat(url, matchers.MatchesRegex(regexp))
timeout = int(url.split('=')[-1])

MODIFY
heatclient/tests/unit/test_shell.py
heatclient/tests/unit/test_shell.py
@@ -557,7 +557,7 @@ class ShellTestNoMox(ShellTestNoMoxBase):
template_file = os.path.join(TEST_VAR_DIR, 'minimal.template')
self.shell_error('stack-create -f %s stack' % template_file,
- 'The Parameter \(key_name\) was not provided.',
+ r'The Parameter \(key_name\) was not provided.',
exception=exc.HTTPBadRequest)
def test_event_list(self):
@@ -2437,7 +2437,7 @@ class ShellTestUserPass(ShellBase):
'{',
'"output_key": "output2"',
'"description": "test output 2"',
- '"output_value": \[',
+ r'"output_value": \[',
'"output"',
'"value"',
'"2"',

MODIFY
heatclient/v1/shell.py
heatclient/v1/shell.py
@@ -728,7 +728,7 @@ def do_output_list(hc, args):
utils.print_list(outputs['outputs'], fields, formatters=formatters)
-@utils.arg('id', metavar='<NAME or ID>',
+@utils.arg('id', metavar='<NAME or ID>', # noqa: C901
help=_('Name or ID of stack to query.'))
@utils.arg('output', metavar='<OUTPUT NAME>', nargs='?', default=None,
help=_('Name of an output to display.'))

MODIFY
test-requirements.txt
test-requirements.txt
# process, which may cause wedges in the gate later.
# Hacking already pins down pep8, pyflakes and flake8
-hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
+hacking>=3.0,<3.1.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
requests-mock>=1.2.0 # Apache-2.0

Update hacking for Python3

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

Fix problems found.

Change-Id: I82c745f5b1236844deec4538be84037a64eebeee