Run pyupgrade to clean up Python 2 syntaxes

Update all .py source files by
 $ pyupgrade --py3-only $(git ls-files | grep ".py$")
to modernize the code according to Python 3 syntaxes.

Change-Id: Ic6336f745f65161bb05defca797480bc03f7fea7
This commit is contained in:
Takashi Kajinami 2024-10-19 23:34:41 +09:00
parent 4ce52b578e
commit d7b04cf441
3 changed files with 5 additions and 5 deletions

View File

@ -114,8 +114,8 @@ def main(argv=sys.argv):
lock = open(options.lockfile, 'a')
try:
fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
except IOError as e:
log.error('Could not lock %s. %s' % (options.lockfile, e))
except OSError as e:
log.error('Could not lock {}. {}'.format(options.lockfile, e))
return e.errno
lock.truncate(0)
@ -144,7 +144,7 @@ def main(argv=sys.argv):
sys.stderr.flush()
log.info('Completed phase %s' % phase)
except subprocess.CalledProcessError as e:
log.error("during %s phase. [%s]\n" % (phase, e))
log.error("during {} phase. [{}]\n".format(phase, e))
error_dir = os.path.join(BASE_DIR, 'error.d')
if os.path.exists(error_dir):
log.info('Calling error handlers.')

View File

@ -21,7 +21,7 @@ import testtools
class TestCmd(testtools.TestCase):
def setUp(self):
super(TestCmd, self).setUp()
super().setUp()
self.useFixture(fixtures.NestedTempfile())
self.base_dir = self.useFixture(fixtures.TempDir())
self.lockdir = self.useFixture(fixtures.TempDir())

View File

@ -22,7 +22,7 @@ from os_refresh_config import os_refresh_config
class TestMain(testtools.TestCase):
def setUp(self):
super(TestMain, self).setUp()
super().setUp()
self.useFixture(fixtures.NestedTempfile())
td = self.useFixture(fixtures.TempDir())
self.useFixture(