Merge "Bump hacking version"

This commit is contained in:
Zuul 2023-12-18 21:20:36 +00:00 committed by Gerrit Code Review
commit 5e914c27a0
10 changed files with 17 additions and 21 deletions

View File

@ -24,7 +24,7 @@ repos:
- id: remove-tabs
exclude: '.*\.(svg)$'
- repo: https://opendev.org/openstack/hacking
rev: 6.0.1
rev: 6.1.0
hooks:
- id: hacking
additional_dependencies: []

View File

@ -3390,7 +3390,7 @@ class API:
"error_msg": str(exc)})
attr = 'task_state'
state = task_states.DELETING
if type(ex) == exception.InstanceNotFound:
if type(ex) is exception.InstanceNotFound:
attr = 'vm_state'
state = vm_states.DELETED
raise exception.InstanceInvalidState(attr=attr,

View File

@ -820,10 +820,10 @@ class MatchType(object):
self.wanttype = wanttype
def __eq__(self, other):
return type(other) == self.wanttype
return type(other) is self.wanttype
def __ne__(self, other):
return type(other) != self.wanttype
return type(other) is not self.wanttype
def __repr__(self):
return "<MatchType:" + str(self.wanttype) + ">"

View File

@ -2157,10 +2157,10 @@ class Connection(object):
def openAuth(uri, auth, flags=0):
if type(auth) != list:
if type(auth) is not list:
raise Exception("Expected a list for 'auth' parameter")
if type(auth[0]) != list:
if type(auth[0]) is not list:
raise Exception("Expected a function in 'auth[0]' parameter")
if not callable(auth[1]):

View File

@ -12918,7 +12918,7 @@ class ComputeAPIAggrTestCase(BaseTestCase):
self.aggr = aggr
def __eq__(self, other_aggr):
if type(self.aggr) != type(other_aggr):
if type(self.aggr) is not type(other_aggr):
return False
return self.aggr.id == other_aggr.id

View File

@ -7728,7 +7728,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
had_pci = 0
# care only about the PCI devices
for dev in cfg.devices:
if type(dev) == vconfig.LibvirtConfigGuestHostdevPCI:
if type(dev) is vconfig.LibvirtConfigGuestHostdevPCI:
had_pci += 1
self.assertEqual(dev.type, 'pci')
self.assertEqual(dev.managed, 'yes')
@ -13500,7 +13500,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
self.assertGreater(len(job_info_records), 0)
rec = job_info_records.pop(0)
if type(rec) == str:
if type(rec) is str:
if rec == "thread-finish":
finish_event.send()
elif rec == "domain-stop":
@ -14176,7 +14176,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
class AnyEventletEvent(object):
def __eq__(self, other):
return type(other) == eventlet.event.Event
return type(other) is eventlet.event.Event
mock_thread.assert_called_once_with(
drvr._live_migration_operation,

View File

@ -399,7 +399,7 @@ class VCPUTopologyTest(test.NoDBTestCase):
for topo_test in testdata:
image_meta = objects.ImageMeta.from_dict(topo_test["image"])
if type(topo_test["expect"]) == tuple:
if type(topo_test["expect"]) is tuple:
(preferred, maximum) = hw.get_cpu_topology_constraints(
topo_test["flavor"], image_meta)
@ -525,7 +525,7 @@ class VCPUTopologyTest(test.NoDBTestCase):
]
for topo_test in testdata:
if type(topo_test["expect"]) == list:
if type(topo_test["expect"]) is list:
actual = []
for topology in hw._get_possible_cpu_topologies(
topo_test["vcpus"],
@ -1001,7 +1001,7 @@ class NUMATopologyTest(test.NoDBTestCase):
cpu_policy = hw.get_cpu_policy_constraint(
testitem["flavor"], image_meta)
self.assertIsNone(cpu_policy)
elif type(testitem["expect"]) == type:
elif type(testitem["expect"]) is type:
self.assertRaises(testitem["expect"],
hw.get_cpu_policy_constraint,
testitem["flavor"],
@ -1990,7 +1990,7 @@ class NUMATopologyTest(test.NoDBTestCase):
topology = hw.numa_get_constraints(
testitem["flavor"], image_meta)
self.assertIsNone(topology)
elif type(testitem["expect"]) == type:
elif type(testitem["expect"]) is type:
self.assertRaises(testitem["expect"],
hw.numa_get_constraints,
testitem["flavor"],

View File

@ -269,7 +269,7 @@ class LibvirtConfigDomainCapsDevices(LibvirtConfigObject):
def _get_device(self, device_type):
for device in self.devices:
if type(device) == self.DEVICE_PARSERS.get(device_type):
if type(device) is self.DEVICE_PARSERS.get(device_type):
return device
return None

View File

@ -3114,7 +3114,7 @@ class LibvirtDriver(driver.ComputeDriver):
purge_props=False)
except (NotImplementedError, exception.ImageUnacceptable,
exception.Forbidden) as e:
if type(e) != NotImplementedError:
if type(e) is not NotImplementedError:
LOG.warning('Performing standard snapshot because direct '
'snapshot failed: %(error)s',
{'error': encodeutils.exception_to_unicode(e)})

View File

@ -1,8 +1,4 @@
# 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>=6.0.1,<=6.0.1 # Apache-2.0
hacking==6.1.0 # Apache-2.0
mypy>=0.761 # MIT
types-paramiko>=0.1.3 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0