Fix pep8 job to pass with latest hacking lib

Change-Id: I7e389766f2c1e23921677ddea4cdd0aa60034c19
This commit is contained in:
Andrey Kurilin 2024-01-03 15:12:53 +01:00
parent 46afd01f5f
commit 00652f87a9
7 changed files with 7 additions and 7 deletions

View File

@ -627,7 +627,7 @@ class LockedDict(dict):
obj = dict(obj)
for k, v in obj.items():
obj[k] = unlock(v)
elif type(obj) == tuple:
elif isinstance(obj, tuple):
obj = tuple([unlock(v) for v in obj])
return obj
return copy.deepcopy(unlock(self), memo=memo)

View File

@ -147,7 +147,7 @@ class NumberValidator(validation.Validator):
if self.integer_only:
# NOTE(boris-42): Force check that passed value is not float, this
# is important cause int(float_numb) won't raise exception
if type(value) == float:
if isinstance(value, float):
return self.fail("%(name)s is %(val)s which hasn't int type"
% {"name": self.param_name, "val": value})
num_func = int

View File

@ -914,7 +914,7 @@ def validate_output(output_type, output):
proper_type = _OUTPUT_SCHEMA["key_types"][key]
if not isinstance(output[key], proper_type):
if type(proper_type) == tuple:
if isinstance(proper_type, tuple):
return ("Value of %(name)s output %(key)s has wrong type "
"'%(actual_type)s', should be in %(types)r"
% {"name": output_type,

View File

@ -131,7 +131,7 @@ class ServiceMeta(type):
def __init__(cls, name, bases, namespaces):
super(ServiceMeta, cls).__init__(name, bases, namespaces)
bases = [c for c in cls.__bases__ if type(c) == ServiceMeta]
bases = [c for c in cls.__bases__ if isinstance(c, ServiceMeta)]
if not bases:
# nothing to check
return

View File

@ -178,7 +178,7 @@ class SLA(plugin.Plugin, validation.ValidatablePluginMixin,
"""
def validate_type(self, other):
if type(self) != type(other):
if type(self) is not type(other):
raise TypeError(
"Error merging SLAs of types %s, %s. Only SLAs of the same "
"type could be merged." % (type(self), type(other)))

View File

@ -196,7 +196,7 @@ class CliUtilsTestCase(test.TestCase):
@ddt.unpack
def test_pretty_float_formatter(self, obj, args, expected=None):
formatter = cliutils.pretty_float_formatter(*args)
if type(expected) == type and issubclass(expected, Exception):
if type(expected) is type and issubclass(expected, Exception):
self.assertRaises(expected, formatter, obj)
else:
self.assertEqual(expected, formatter(obj))

View File

@ -170,7 +170,7 @@ class HookExecutorTestCase(test.TestCase):
self.assertEqual(
[{
"config": self.conf["hooks"][0],
"results":[
"results": [
{
"triggered_by": {"event_type": "time", "value": 2},
"started_at": fakes.FakeTimer().timestamp(),