From 3ee449fc57a6687a927474bf4fa49b9c9fbe5bb4 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 5 Oct 2025 19:32:22 +0900 Subject: [PATCH] Bump pyupgrade target to 3.10+ ... according to the versions currently supported. Change-Id: I435839b00f7e3fdfdee0874403b01f03d1b80e4c Signed-off-by: Takashi Kajinami --- .pre-commit-config.yaml | 2 +- oslo_concurrency/lockutils.py | 2 +- oslo_concurrency/processutils.py | 2 +- oslo_concurrency/tests/unit/test_processutils.py | 2 +- oslo_concurrency/watchdog.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9e37343..b5f7d99 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,4 +26,4 @@ repos: rev: v3.20.0 hooks: - id: pyupgrade - args: [--py3-only] + args: [--py310-plus] diff --git a/oslo_concurrency/lockutils.py b/oslo_concurrency/lockutils.py index 4685d80..07dfc76 100644 --- a/oslo_concurrency/lockutils.py +++ b/oslo_concurrency/lockutils.py @@ -195,7 +195,7 @@ def _get_lock_path(name, lock_file_prefix, lock_path=None): name = name.replace(os.sep, '_') if lock_file_prefix: sep = '' if lock_file_prefix.endswith('-') else '-' - name = '{}{}{}'.format(lock_file_prefix, sep, name) + name = f'{lock_file_prefix}{sep}{name}' local_lock_path = lock_path or CONF.oslo_concurrency.lock_path diff --git a/oslo_concurrency/processutils.py b/oslo_concurrency/processutils.py index d26856b..e5065d1 100644 --- a/oslo_concurrency/processutils.py +++ b/oslo_concurrency/processutils.py @@ -163,7 +163,7 @@ class ProcessLimits: for limit in self._LIMITS: val = getattr(self, limit) if val is not None: - args.append("{}={}".format(self._LIMITS[limit], val)) + args.append(f"{self._LIMITS[limit]}={val}") return args diff --git a/oslo_concurrency/tests/unit/test_processutils.py b/oslo_concurrency/tests/unit/test_processutils.py index 8ff1fd9..736b388 100644 --- a/oslo_concurrency/tests/unit/test_processutils.py +++ b/oslo_concurrency/tests/unit/test_processutils.py @@ -607,7 +607,7 @@ class FakeSshConnection: def exec_command(self, cmd, timeout=None): if timeout: - raise socket.timeout() + raise TimeoutError() stdout = FakeSshStream(self.out) stdout.setup_channel(self.rc) return (io.BytesIO(), diff --git a/oslo_concurrency/watchdog.py b/oslo_concurrency/watchdog.py index 01e98ba..6ab54e9 100644 --- a/oslo_concurrency/watchdog.py +++ b/oslo_concurrency/watchdog.py @@ -64,7 +64,7 @@ def watch(logger, action, level=logging.DEBUG, after=5.0): watch.start() def log(): - msg = "{} not completed after {:0.3f}s".format(action, watch.elapsed()) + msg = f"{action} not completed after {watch.elapsed():0.3f}s" logger.log(level, msg) timer = threading.Timer(after, log)