Bump pyupgrade target to 3.10+

... according to the versions currently supported.

Change-Id: Iae501ca85ea947c86cb10c2631ea265ef97741ed
Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
Takashi Kajinami
2025-10-05 19:44:50 +09:00
parent 93c9aa91e3
commit 7f3c0b99b7
5 changed files with 6 additions and 6 deletions

View File

@@ -26,4 +26,4 @@ repos:
rev: v3.20.0
hooks:
- id: pyupgrade
args: [--py3-only]
args: [--py310-plus]

View File

@@ -44,7 +44,7 @@ def _failure_translator():
except pymemcache_client.MemcacheUnexpectedCloseError as e:
utils.raise_with_cause(coordination.ToozConnectionError,
str(e), cause=e)
except (socket.timeout, OSError, socket.gaierror, socket.herror) as e:
except (TimeoutError, OSError, socket.gaierror, socket.herror) as e:
# TODO(harlowja): get upstream pymemcache to produce a better
# exception for these, using socket (vs. a memcache specific
# error) seems sorta not right and/or the best approach...

View File

@@ -53,7 +53,7 @@ _DIAGNOSTICS_ATTRS = tuple([
def _format_exception(e):
lines = [
"{}: {}".format(type(e).__name__, str(e).strip()),
f"{type(e).__name__}: {str(e).strip()}",
]
if hasattr(e, 'pgcode') and e.pgcode is not None:
lines.append("Error code: %s" % e.pgcode)
@@ -68,7 +68,7 @@ def _format_exception(e):
attr_value = getattr(e.diag, attr_name)
if attr_value is None:
continue
diagnostic_lines.append(" {} = {}".format(attr_name, attr_value))
diagnostic_lines.append(f" {attr_name} = {attr_value}")
if diagnostic_lines:
lines.append('Diagnostics:')
lines.extend(diagnostic_lines)

View File

@@ -71,7 +71,7 @@ def _handle_failures(n_tries=15):
class RedisLock(locking.Lock):
def __init__(self, coord, client, name, timeout):
name = "{}_{}_lock".format(coord.namespace, str(name))
name = f"{coord.namespace}_{str(name)}_lock"
super().__init__(name)
# NOTE(jd) Make sure we don't release and heartbeat at the same time by
# using a exclusive access lock (LP#1557593)

View File

@@ -432,7 +432,7 @@ class KazooDriver(coordination.CoordinationDriverCachedRunWatchers):
username = parsed_url.username
password = parsed_url.password
digest_auth = "{}:{}".format(username, password)
digest_auth = f"{username}:{password}"
digest_acl = security.make_digest_acl(username, password, all=True)
default_acl = (digest_acl,)
auth_data = [('digest', digest_auth)]