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:
parent
4ce52b578e
commit
d7b04cf441
os_refresh_config
@ -114,8 +114,8 @@ def main(argv=sys.argv):
|
|||||||
lock = open(options.lockfile, 'a')
|
lock = open(options.lockfile, 'a')
|
||||||
try:
|
try:
|
||||||
fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
||||||
except IOError as e:
|
except OSError as e:
|
||||||
log.error('Could not lock %s. %s' % (options.lockfile, e))
|
log.error('Could not lock {}. {}'.format(options.lockfile, e))
|
||||||
return e.errno
|
return e.errno
|
||||||
|
|
||||||
lock.truncate(0)
|
lock.truncate(0)
|
||||||
@ -144,7 +144,7 @@ def main(argv=sys.argv):
|
|||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
log.info('Completed phase %s' % phase)
|
log.info('Completed phase %s' % phase)
|
||||||
except subprocess.CalledProcessError as e:
|
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')
|
error_dir = os.path.join(BASE_DIR, 'error.d')
|
||||||
if os.path.exists(error_dir):
|
if os.path.exists(error_dir):
|
||||||
log.info('Calling error handlers.')
|
log.info('Calling error handlers.')
|
||||||
|
@ -21,7 +21,7 @@ import testtools
|
|||||||
class TestCmd(testtools.TestCase):
|
class TestCmd(testtools.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestCmd, self).setUp()
|
super().setUp()
|
||||||
self.useFixture(fixtures.NestedTempfile())
|
self.useFixture(fixtures.NestedTempfile())
|
||||||
self.base_dir = self.useFixture(fixtures.TempDir())
|
self.base_dir = self.useFixture(fixtures.TempDir())
|
||||||
self.lockdir = self.useFixture(fixtures.TempDir())
|
self.lockdir = self.useFixture(fixtures.TempDir())
|
||||||
|
@ -22,7 +22,7 @@ from os_refresh_config import os_refresh_config
|
|||||||
|
|
||||||
class TestMain(testtools.TestCase):
|
class TestMain(testtools.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestMain, self).setUp()
|
super().setUp()
|
||||||
self.useFixture(fixtures.NestedTempfile())
|
self.useFixture(fixtures.NestedTempfile())
|
||||||
td = self.useFixture(fixtures.TempDir())
|
td = self.useFixture(fixtures.TempDir())
|
||||||
self.useFixture(
|
self.useFixture(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user