Bump hacking

hacking 3.0.x is too old.

Change-Id: I33875c36dbbdb946841f8c583636ccdf88d3331f
This commit is contained in:
Takashi Kajinami 2024-01-27 22:58:18 +09:00
parent b6b9f043ff
commit 9f896ab03d
15 changed files with 40 additions and 54 deletions

View File

@ -508,8 +508,10 @@ def replication_load(options, args):
_check_upload_response_headers(headers, body)
updated.append(meta['id'])
except exc.HTTPConflict:
LOG.error(_LE(IMAGE_ALREADY_PRESENT_MESSAGE)
% image_uuid) # noqa
# NOTE(tkajinam): noqa does not work with multi-line,
# so split this interpolation to a separate line
msg = _LE(IMAGE_ALREADY_PRESENT_MESSAGE) % image_uuid
LOG.error(msg)
return updated

View File

@ -41,7 +41,7 @@ class WSMEModelTransformer(object):
for name in names:
value = getattr(db_entity, name, None)
if value is not None:
if type(value) == datetime:
if isinstance(value, datetime):
iso_datetime_value = timeutils.isotime(value)
values.update({name: iso_datetime_value})
else:

View File

@ -1028,8 +1028,8 @@ def _task_soft_delete(context):
tasks = DATA['tasks'].values()
for task in tasks:
if(task['owner'] == context.owner and task['deleted'] == False
and task['expires_at'] <= now):
if (task['owner'] == context.owner and task['deleted'] == False
and task['expires_at'] <= now):
task['deleted'] = True
task['deleted_at'] = timeutils.utcnow()

View File

@ -392,7 +392,7 @@ def _paginate_query(query, model, limit, sort_keys, marker=None,
# the actual primary key, rather than assuming its id
LOG.warning(_LW('Id not in sort_keys; is sort_keys unique?'))
assert(not (sort_dir and sort_dirs)) # nosec
assert (not (sort_dir and sort_dirs)) # nosec
# nosec: This function runs safely if the assertion fails.
# Default the sort direction to ascending
@ -403,7 +403,7 @@ def _paginate_query(query, model, limit, sort_keys, marker=None,
if sort_dirs is None:
sort_dirs = [sort_dir] * len(sort_keys)
assert(len(sort_dirs) == len(sort_keys)) # nosec
assert (len(sort_dirs) == len(sort_keys)) # nosec
# nosec: This function runs safely if the assertion fails.
if len(sort_dirs) < len(sort_keys):
sort_dirs += [sort_dir] * (len(sort_keys) - len(sort_dirs))

View File

@ -95,7 +95,7 @@ def no_translate_debug_logs(logical_line, filename):
if max([name in filename for name in dirs]):
if logical_line.startswith("LOG.debug(_("):
yield(0, "G319: Don't translate debug level logs")
yield (0, "G319: Don't translate debug level logs")
@core.flake8ext
@ -105,7 +105,7 @@ def check_no_contextlib_nested(logical_line):
"nested for more information.")
if ("with contextlib.nested(" in logical_line or
"with nested(" in logical_line):
yield(0, msg)
yield (0, msg)
@core.flake8ext

View File

@ -167,8 +167,8 @@ def format_image_notification(image):
def format_image_member_notification(image_member):
"""Given a glance.domain.ImageMember object, return a dictionary of relevant
notification information.
"""Given a glance.domain.ImageMember object, return a dictionary of
relevant notification information.
"""
return {
'image_id': image_member.image_id,

View File

@ -83,7 +83,7 @@ ADMIN_OR_PROJECT_READER_OR_SHARED_MEMBER = (
f'role:reader and (project_id:%(project_id)s or {IMAGE_MEMBER_CHECK})'
)
ADMIN = f'rule:context_is_admin'
ADMIN = 'rule:context_is_admin'
rules = [
policy.RuleDefault(name='default', check_str='',

View File

@ -2256,7 +2256,7 @@ class VisibilityTests(object):
is_public=False)
self.assertEqual(8, len(images))
for i in images:
self.assertTrue(i['visibility'] in ['shared', 'private'])
self.assertIn(i['visibility'], ['shared', 'private'])
def test_unknown_admin_is_public_none(self):
images = self.db_api.image_get_all(self.admin_none_context)
@ -2310,8 +2310,7 @@ class VisibilityTests(object):
is_public=False)
self.assertEqual(9, len(images))
for i in images:
self.assertTrue(i['visibility']
in ['shared', 'private', 'community'])
self.assertIn(i['visibility'], ['shared', 'private', 'community'])
def test_known_admin_is_public_none(self):
images = self.db_api.image_get_all(self.admin_context)
@ -2429,8 +2428,7 @@ class VisibilityTests(object):
self.assertEqual(3, len(images))
for i in images:
self.assertEqual(i['owner'], self.tenant1)
self.assertTrue(i['visibility']
in ['private', 'shared', 'community'])
self.assertIn(i['visibility'], ['private', 'shared', 'community'])
def test_tenant1_is_public_none(self):
images = self.db_api.image_get_all(self.tenant1_context)

View File

@ -155,7 +155,7 @@ class TestMetadefObjects(metadef_base.MetadefFunctionalTestBase):
'description',
])
for key, value in expected_metadata_object.items():
if(key in checked_values):
if key in checked_values:
self.assertEqual(metadata_object[key], value, key)
# Complex key values - properties
for key, value in (

View File

@ -112,7 +112,7 @@ class TestMetadefResourceTypes(metadef_base.MetadefFunctionalTestBase):
u'properties_target',
])
for key, value in expected_metadef_resource_types.items():
if(key in checked_values):
if key in checked_values:
self.assertEqual(
resource_type['resource_type_associations'][0][key],
value, key)

View File

@ -86,7 +86,7 @@ class TestMetadefTags(metadef_base.MetadefFunctionalTestBase):
'name'
])
for key, value in expected_metadata_tag.items():
if(key in checked_values):
if key in checked_values:
self.assertEqual(metadata_tag[key], value, key)
# Try to create a duplicate metadata tag

View File

@ -112,7 +112,7 @@ class TestTaskExecutor(test_utils.BaseTestCase):
def test_task_fail_upload(self):
with mock.patch.object(image_import, 'set_image_data') as import_mock:
import_mock.side_effect = IOError
import_mock.side_effect = IOError # noqa
self.task_repo.get.return_value = self.task
self.executor.begin_processing(self.task.task_id)

View File

@ -702,9 +702,9 @@ class TestTaskNotifications(utils.BaseTestCase):
self.fail('Notification contained location field.')
# Verify newly added fields 'image_id', 'user_id' and
# 'request_id' are not part of notification yet
self.assertTrue('image_id' not in output_log['payload'])
self.assertTrue('user_id' not in output_log['payload'])
self.assertTrue('request_id' not in output_log['payload'])
self.assertNotIn('image_id', output_log['payload'])
self.assertNotIn('user_id', output_log['payload'])
self.assertNotIn('request_id', output_log['payload'])
def test_task_create_notification_disabled(self):
self.config(disabled_notifications=['task.create'])
@ -737,9 +737,9 @@ class TestTaskNotifications(utils.BaseTestCase):
self.fail('Notification contained location field.')
# Verify newly added fields 'image_id', 'user_id' and
# 'request_id' are not part of notification yet
self.assertTrue('image_id' not in output_log['payload'])
self.assertTrue('user_id' not in output_log['payload'])
self.assertTrue('request_id' not in output_log['payload'])
self.assertNotIn('image_id', output_log['payload'])
self.assertNotIn('user_id', output_log['payload'])
self.assertNotIn('request_id', output_log['payload'])
def test_task_delete_notification_disabled(self):
self.config(disabled_notifications=['task.delete'])
@ -758,15 +758,9 @@ class TestTaskNotifications(utils.BaseTestCase):
self.assertEqual('INFO', output_log['notification_type'])
self.assertEqual('task.run', output_log['event_type'])
self.assertEqual(self.task.task_id, output_log['payload']['id'])
self.assertFalse(
self.task.image_id in output_log['payload']
)
self.assertFalse(
self.task.user_id in output_log['payload']
)
self.assertFalse(
self.task.request_id in output_log['payload']
)
self.assertNotIn(self.task.image_id, output_log['payload'])
self.assertNotIn(self.task.user_id, output_log['payload'])
self.assertNotIn(self.task.request_id, output_log['payload'])
def test_task_run_notification_disabled(self):
self.config(disabled_notifications=['task.run'])
@ -787,9 +781,9 @@ class TestTaskNotifications(utils.BaseTestCase):
self.assertEqual(self.task.task_id, output_log['payload']['id'])
# Verify newly added fields 'image_id', 'user_id' and
# 'request_id' are not part of notification yet
self.assertTrue('image_id' not in output_log['payload'])
self.assertTrue('user_id' not in output_log['payload'])
self.assertTrue('request_id' not in output_log['payload'])
self.assertNotIn('image_id', output_log['payload'])
self.assertNotIn('user_id', output_log['payload'])
self.assertNotIn('request_id', output_log['payload'])
def test_task_processing_notification_disabled(self):
self.config(disabled_notifications=['task.processing'])
@ -808,9 +802,9 @@ class TestTaskNotifications(utils.BaseTestCase):
self.assertEqual(self.task.task_id, output_log['payload']['id'])
# Verify newly added fields 'image_id', 'user_id' and
# 'request_id' are not part of notification yet
self.assertTrue('image_id' not in output_log['payload'])
self.assertTrue('user_id' not in output_log['payload'])
self.assertTrue('request_id' not in output_log['payload'])
self.assertNotIn('image_id', output_log['payload'])
self.assertNotIn('user_id', output_log['payload'])
self.assertNotIn('request_id', output_log['payload'])
def test_task_success_notification_disabled(self):
self.config(disabled_notifications=['task.processing', 'task.success'])
@ -829,9 +823,9 @@ class TestTaskNotifications(utils.BaseTestCase):
self.assertEqual(self.task.task_id, output_log['payload']['id'])
# Verify newly added fields 'image_id', 'user_id' and
# 'request_id' are not part of notification yet
self.assertTrue('image_id' not in output_log['payload'])
self.assertTrue('user_id' not in output_log['payload'])
self.assertTrue('request_id' not in output_log['payload'])
self.assertNotIn('image_id', output_log['payload'])
self.assertNotIn('user_id', output_log['payload'])
self.assertNotIn('request_id', output_log['payload'])
def test_task_failure_notification_disabled(self):
self.config(disabled_notifications=['task.failure'])

View File

@ -1,7 +1,3 @@
# 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.
pbr>=3.1.1 # Apache-2.0
defusedxml>=0.6.0 # PSF

View File

@ -1,9 +1,5 @@
# 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 already pins down pep8, pyflakes and flake8
hacking>=3.0.1,<3.1.0 # Apache-2.0
hacking>=6.1.0,<6.2.0 # Apache-2.0
# Needed for testing
coverage!=4.4,>=4.0 # Apache-2.0