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:
@@ -26,4 +26,4 @@ repos:
|
|||||||
rev: v3.20.0
|
rev: v3.20.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: pyupgrade
|
- id: pyupgrade
|
||||||
args: [--py3-only]
|
args: [--py310-plus]
|
||||||
|
@@ -44,7 +44,7 @@ def _failure_translator():
|
|||||||
except pymemcache_client.MemcacheUnexpectedCloseError as e:
|
except pymemcache_client.MemcacheUnexpectedCloseError as e:
|
||||||
utils.raise_with_cause(coordination.ToozConnectionError,
|
utils.raise_with_cause(coordination.ToozConnectionError,
|
||||||
str(e), cause=e)
|
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
|
# TODO(harlowja): get upstream pymemcache to produce a better
|
||||||
# exception for these, using socket (vs. a memcache specific
|
# exception for these, using socket (vs. a memcache specific
|
||||||
# error) seems sorta not right and/or the best approach...
|
# error) seems sorta not right and/or the best approach...
|
||||||
|
@@ -53,7 +53,7 @@ _DIAGNOSTICS_ATTRS = tuple([
|
|||||||
|
|
||||||
def _format_exception(e):
|
def _format_exception(e):
|
||||||
lines = [
|
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:
|
if hasattr(e, 'pgcode') and e.pgcode is not None:
|
||||||
lines.append("Error code: %s" % e.pgcode)
|
lines.append("Error code: %s" % e.pgcode)
|
||||||
@@ -68,7 +68,7 @@ def _format_exception(e):
|
|||||||
attr_value = getattr(e.diag, attr_name)
|
attr_value = getattr(e.diag, attr_name)
|
||||||
if attr_value is None:
|
if attr_value is None:
|
||||||
continue
|
continue
|
||||||
diagnostic_lines.append(" {} = {}".format(attr_name, attr_value))
|
diagnostic_lines.append(f" {attr_name} = {attr_value}")
|
||||||
if diagnostic_lines:
|
if diagnostic_lines:
|
||||||
lines.append('Diagnostics:')
|
lines.append('Diagnostics:')
|
||||||
lines.extend(diagnostic_lines)
|
lines.extend(diagnostic_lines)
|
||||||
|
@@ -71,7 +71,7 @@ def _handle_failures(n_tries=15):
|
|||||||
|
|
||||||
class RedisLock(locking.Lock):
|
class RedisLock(locking.Lock):
|
||||||
def __init__(self, coord, client, name, timeout):
|
def __init__(self, coord, client, name, timeout):
|
||||||
name = "{}_{}_lock".format(coord.namespace, str(name))
|
name = f"{coord.namespace}_{str(name)}_lock"
|
||||||
super().__init__(name)
|
super().__init__(name)
|
||||||
# NOTE(jd) Make sure we don't release and heartbeat at the same time by
|
# NOTE(jd) Make sure we don't release and heartbeat at the same time by
|
||||||
# using a exclusive access lock (LP#1557593)
|
# using a exclusive access lock (LP#1557593)
|
||||||
|
@@ -432,7 +432,7 @@ class KazooDriver(coordination.CoordinationDriverCachedRunWatchers):
|
|||||||
username = parsed_url.username
|
username = parsed_url.username
|
||||||
password = parsed_url.password
|
password = parsed_url.password
|
||||||
|
|
||||||
digest_auth = "{}:{}".format(username, password)
|
digest_auth = f"{username}:{password}"
|
||||||
digest_acl = security.make_digest_acl(username, password, all=True)
|
digest_acl = security.make_digest_acl(username, password, all=True)
|
||||||
default_acl = (digest_acl,)
|
default_acl = (digest_acl,)
|
||||||
auth_data = [('digest', digest_auth)]
|
auth_data = [('digest', digest_auth)]
|
||||||
|
Reference in New Issue
Block a user