use f-strings in module utils (#10901)
Some checks are pending
EOL CI / EOL Sanity (Ⓐ2.17) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.17+py3.10) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.17+py3.12) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.17+py3.7) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+alpine319+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+alpine319+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+alpine319+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+fedora39+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+fedora39+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+fedora39+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+ubuntu2004+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+ubuntu2004+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+ubuntu2004+py:azp/posix/3/) (push) Waiting to run
nox / Run extra sanity tests (push) Waiting to run

* use f-strings in module utils

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

* remove unused imports

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Alexei Znamensky 2025-10-11 22:43:43 +13:00 committed by GitHub
commit b85e263466
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
51 changed files with 270 additions and 382 deletions

View file

@ -209,7 +209,7 @@ def wait_for_resource_creation_completion(oneandone_conn,
(resource_type != OneAndOneResources.server and resource_state.lower() == 'active')):
return
elif resource_state.lower() == 'failed':
raise Exception('%s creation failed for %s' % (resource_type, resource_id))
raise Exception(f'{resource_type} creation failed for {resource_id}')
elif resource_state.lower() in ('active',
'enabled',
'deploying',
@ -217,10 +217,10 @@ def wait_for_resource_creation_completion(oneandone_conn,
continue
else:
raise Exception(
'Unknown %s state %s' % (resource_type, resource_state))
f'Unknown {resource_type} state {resource_state}')
raise Exception(
'Timed out waiting for %s completion for %s' % (resource_type, resource_id))
f'Timed out waiting for {resource_type} completion for {resource_id}')
def wait_for_resource_deletion_completion(oneandone_conn,
@ -246,7 +246,7 @@ def wait_for_resource_deletion_completion(oneandone_conn,
_type = 'PRIVATENETWORK'
else:
raise Exception(
'Unsupported wait_for delete operation for %s resource' % resource_type)
f'Unsupported wait_for delete operation for {resource_type} resource')
for log in logs:
if (log['resource']['id'] == resource_id and
@ -255,4 +255,4 @@ def wait_for_resource_deletion_completion(oneandone_conn,
log['status']['state'] == 'OK'):
return
raise Exception(
'Timed out waiting for %s deletion for %s' % (resource_type, resource_id))
f'Timed out waiting for {resource_type} deletion for {resource_id}')