Update hacking for Python3

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

Fix problems found by updated hacking version.

Change-Id: I8d4a0fc1b7c4e0c1e474a707aa900d09181ba11f
This commit is contained in:
Andreas Jaeger 2020-03-28 20:07:19 +01:00 committed by Andreas Jaeger
parent d5b61d1065
commit d57a5f39ed
4 changed files with 10 additions and 7 deletions

View File

@ -2,7 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration # of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later. # process, which may cause wedges in the gate later.
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 coverage!=4.4,>=4.0 # Apache-2.0
python-subunit>=1.0.0 # Apache-2.0/BSD python-subunit>=1.0.0 # Apache-2.0/BSD
oslotest>=1.10.0 # Apache-2.0 oslotest>=1.10.0 # Apache-2.0

View File

@ -72,13 +72,15 @@ commands =
# #
# H404 skipped on purpose per jay pipes discussion. # H404 skipped on purpose per jay pipes discussion.
# #
# W504 line break after binary operator
#
# Due to the upgrade to hacking 0.9.2 the following checking are # Due to the upgrade to hacking 0.9.2 the following checking are
# ignored on purpose for the moment and should be re-enabled. # ignored on purpose for the moment and should be re-enabled.
# H106: Dont put vim configuration in source files # H106: Dont put vim configuration in source files
# H203: Use assertIs(Not)None to check for None # H203: Use assertIs(Not)None to check for None
show-source = True show-source = True
ignore = E123,E125,E126,E127,E128,E251,E265,H302,H405,H904,H404 ignore = E123,E125,E126,E127,E128,E251,E265,H302,H405,H904,H404,W504
enable-extensions=H106,H203 enable-extensions=H106,H203
builtins = _ builtins = _
exclude=.venv,.git,.tox,dist,*lib/python*,*egg,build exclude=.venv,.git,.tox,dist,*lib/python*,*egg,build

View File

@ -39,6 +39,7 @@ def get_binary_name():
"""Grab the name of the binary we're running in.""" """Grab the name of the binary we're running in."""
return os.path.basename(inspect.stack()[-1][1])[:16] return os.path.basename(inspect.stack()[-1][1])[:16]
binary_name = get_binary_name() binary_name = get_binary_name()

View File

@ -287,11 +287,11 @@ def get_representor_port(pf_ifname, vf_num):
# the PCI func number of pf_ifname. # the PCI func number of pf_ifname.
rep_parent_pf_func = _parse_pf_number(phys_port_name) rep_parent_pf_func = _parse_pf_number(phys_port_name)
if rep_parent_pf_func is not None: if rep_parent_pf_func is not None:
ifname_pf_func = _get_pf_func(pf_ifname) ifname_pf_func = _get_pf_func(pf_ifname)
if ifname_pf_func is None: if ifname_pf_func is None:
continue continue
if int(rep_parent_pf_func) != int(ifname_pf_func): if int(rep_parent_pf_func) != int(ifname_pf_func):
continue continue
representor_num = _parse_vf_number(phys_port_name) representor_num = _parse_vf_number(phys_port_name)
# Note: representor_num can be 0, referring to VF0 # Note: representor_num can be 0, referring to VF0