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: Ic78f1a2f958530fe7e480c7043c604d9f0e978c3
This commit is contained in:
Andreas Jaeger 2020-03-31 13:34:23 +02:00
parent d307e8e6ed
commit e36c940ba7
6 changed files with 8 additions and 7 deletions

View File

@ -245,8 +245,8 @@ def format_parameter_file(param_files, template_file=None,
param_file = {}
for key, value in iter(params.items()):
param_file[key] = resolve_param_get_file(value,
template_base_url)
param_file[key] = resolve_param_get_file(value,
template_base_url)
return param_file

View File

@ -133,4 +133,4 @@ class SearchResource(command.Lister):
return (columns, result)
def _modify_query_string(self, query_string):
return query_string.replace('/', '\/')
return query_string.replace(r'/', r'\/')

View File

@ -87,7 +87,7 @@ class TestSearchResource(TestSearch):
def test_search_regexp_slashes_in_query_string(self):
"""Escape slashes in querystrings so not to be treated as regexp"""
self._test_search(["this/has/some/slashes"],
query={"query_string": {"query": "this\/has\/some\/slashes"}},
query={"query_string": {"query": r"this\/has\/some\/slashes"}},
_source=['id', 'name', 'updated_at'],
all_projects=False, type=None)

View File

@ -3,7 +3,7 @@
# process, which may cause wedges in the gate later.
# Hacking already pins down pep8, pyflakes and flake8
hacking>=1.1.0,<1.2.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
mock>=2.0.0 # BSD

View File

@ -42,7 +42,7 @@ def print_help(project, venv, root):
$ %(root)s/tools/with_venv.sh <your command>
"""
print help % dict(project=project, venv=venv, root=root)
print(help % dict(project=project, venv=venv, root=root))
def main(argv):
@ -70,5 +70,6 @@ def main(argv):
install.install_dependencies()
print_help(project, venv, root)
if __name__ == '__main__':
main(sys.argv)

View File

@ -65,7 +65,7 @@ commands =
make -C doc/build/pdf
[flake8]
ignore = E123,E126,E128,E241,E265,E713,H202,H405,H238
ignore = E123,E126,E128,E241,E265,E713,H202,H405,H238,W504
show-source = True
exclude=.venv,.git,.tox,dist,*lib/python*,*egg,build
max-complexity=20