pre-commit: Migrate pyupgrade to ruff

Change-Id: Ic50d2a5e0bc9dcdfe29f382607135cab510cd396
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane
2024-09-12 17:57:14 +01:00
parent fc6852cd94
commit f98006ca9d
79 changed files with 753 additions and 1190 deletions

View File

@@ -307,7 +307,7 @@ class BaseAPI(KeystoneSession):
except ks_exceptions.NotFound:
kwargs = {attr: value}
try:
ret = self.find_one("/%s/detail" % (path), **kwargs)
ret = self.find_one(f"/{path}/detail", **kwargs)
except ks_exceptions.NotFound:
msg = _("%s not found") % value
raise exceptions.NotFound(msg)

View File

@@ -256,10 +256,7 @@ class APIv1(api.BaseAPI):
# object's name in the container.
object_name_str = name if name else object
full_url = "{}/{}".format(
urllib.parse.quote(container),
urllib.parse.quote(object_name_str),
)
full_url = f"{urllib.parse.quote(container)}/{urllib.parse.quote(object_name_str)}"
with open(object, 'rb') as f:
response = self.create(
full_url,
@@ -293,8 +290,7 @@ class APIv1(api.BaseAPI):
return
self.delete(
"%s/%s"
% (urllib.parse.quote(container), urllib.parse.quote(object))
f"{urllib.parse.quote(container)}/{urllib.parse.quote(object)}"
)
def object_list(
@@ -395,8 +391,7 @@ class APIv1(api.BaseAPI):
response = self._request(
'GET',
"%s/%s"
% (urllib.parse.quote(container), urllib.parse.quote(object)),
f"{urllib.parse.quote(container)}/{urllib.parse.quote(object)}",
stream=True,
)
if response.status_code == 200:
@@ -431,8 +426,7 @@ class APIv1(api.BaseAPI):
headers = self._set_properties(properties, 'X-Object-Meta-%s')
if headers:
self.create(
"%s/%s"
% (urllib.parse.quote(container), urllib.parse.quote(object)),
f"{urllib.parse.quote(container)}/{urllib.parse.quote(object)}",
headers=headers,
)
@@ -455,8 +449,7 @@ class APIv1(api.BaseAPI):
headers = self._unset_properties(properties, 'X-Remove-Object-Meta-%s')
if headers:
self.create(
"%s/%s"
% (urllib.parse.quote(container), urllib.parse.quote(object)),
f"{urllib.parse.quote(container)}/{urllib.parse.quote(object)}",
headers=headers,
)
@@ -480,8 +473,7 @@ class APIv1(api.BaseAPI):
response = self._request(
'HEAD',
"%s/%s"
% (urllib.parse.quote(container), urllib.parse.quote(object)),
f"{urllib.parse.quote(container)}/{urllib.parse.quote(object)}",
)
data = {