Bump pyupgrade target to 3.10+
... according to the versions currently supported. Change-Id: I5bc8dc9af97a3930eeed4226b1acc2f6520e6527 Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
@@ -30,4 +30,4 @@ repos:
|
||||
rev: v3.20.0
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args: [--py3-only]
|
||||
args: [--py310-plus]
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable
|
||||
import enum
|
||||
import importlib
|
||||
import logging
|
||||
from typing import Any
|
||||
from typing import Callable
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from . import exceptions
|
||||
|
||||
@@ -63,7 +63,7 @@ def _dont_use_this():
|
||||
|
||||
def _dump_frame(f, frame_chapter):
|
||||
co = f.f_code
|
||||
print(" {} Frame: {}".format(frame_chapter, co.co_name))
|
||||
print(f" {frame_chapter} Frame: {co.co_name}")
|
||||
print(" File: %s" % (co.co_filename))
|
||||
print(" Captured at line number: %s" % (f.f_lineno))
|
||||
co_locals = set(co.co_varnames)
|
||||
@@ -94,7 +94,7 @@ def _dump_frame(f, frame_chapter):
|
||||
def _detailed_dump_frames(f, thread_index):
|
||||
i = 0
|
||||
while f is not None:
|
||||
_dump_frame(f, "{}.{}".format(thread_index, i + 1))
|
||||
_dump_frame(f, f"{thread_index}.{i + 1}")
|
||||
f = f.f_back
|
||||
i += 1
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ def onready(notify_socket, timeout):
|
||||
with contextlib.closing(sock):
|
||||
try:
|
||||
msg = sock.recv(512)
|
||||
except socket.timeout:
|
||||
except TimeoutError:
|
||||
return 2
|
||||
if b'READY=1' == msg:
|
||||
return 0
|
||||
|
||||
@@ -42,7 +42,7 @@ class BackdoorSocketPathTest(base.ServiceBaseTestCase):
|
||||
self.config(backdoor_socket="/tmp/my_special_socket-{pid}")
|
||||
listen_mock.side_effect = mock.Mock()
|
||||
path = eventlet_backdoor.initialize_if_enabled(self.conf)
|
||||
expected_path = "/tmp/my_special_socket-{}".format(os.getpid())
|
||||
expected_path = f"/tmp/my_special_socket-{os.getpid()}"
|
||||
self.assertEqual(expected_path, path)
|
||||
|
||||
@mock.patch.object(eventlet, 'spawn')
|
||||
|
||||
@@ -27,7 +27,7 @@ class SystemdTestCase(test_base.BaseTestCase):
|
||||
def test__abstractify(self):
|
||||
sock_name = '@fake_socket'
|
||||
res = systemd._abstractify(sock_name)
|
||||
self.assertEqual('\0{}'.format(sock_name[1:]), res)
|
||||
self.assertEqual(f'\0{sock_name[1:]}', res)
|
||||
|
||||
@mock.patch.object(os, 'getenv', return_value='@fake_socket')
|
||||
def _test__sd_notify(self, getenv_mock, unset_env=False):
|
||||
|
||||
@@ -275,7 +275,7 @@ class TestWSGIServer(WsgiTestCase):
|
||||
def requesting(host, port, ca_certs=None, method="POST",
|
||||
content_type="application/x-www-form-urlencoded",
|
||||
address_familly=socket.AF_INET):
|
||||
frame = bytes("{verb} / HTTP/1.1\r\n\r\n".format(verb=method), "utf-8")
|
||||
frame = bytes(f"{method} / HTTP/1.1\r\n\r\n", "utf-8")
|
||||
with socket.socket(address_familly, socket.SOCK_STREAM) as sock:
|
||||
if ca_certs:
|
||||
with eventlet.wrap_ssl(sock, ca_certs=ca_certs) as wrappedSocket:
|
||||
|
||||
Reference in New Issue
Block a user