# HG changeset patch
# User Laurent Peuch <cortex@worlddomination.be>
# Date 1670619038 -3600
#      Fri Dec 09 21:50:38 2022 +0100
# Node ID af8d213142675fff6fab871e1df1a783cae0391a
# Parent  dde488a18eb129c423502f87b8e059864a75fb16
feat: run pyupgrade

diff --git a/cubicweb_s3storage/migration/postcreate.py b/cubicweb_s3storage/migration/postcreate.py
--- a/cubicweb_s3storage/migration/postcreate.py
+++ b/cubicweb_s3storage/migration/postcreate.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 # copyright 2018-2022 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 # contact http://www.logilab.fr -- mailto:contact@logilab.fr
 #
diff --git a/cubicweb_s3storage/storages.py b/cubicweb_s3storage/storages.py
--- a/cubicweb_s3storage/storages.py
+++ b/cubicweb_s3storage/storages.py
@@ -44,7 +44,7 @@
     def _s3_client(cls):
         endpoint_url = os.environ.get("AWS_S3_ENDPOINT_URL")
         if endpoint_url:
-            cls.debug("Using custom S3 endpoint url {}".format(endpoint_url))
+            cls.debug(f"Using custom S3 endpoint url {endpoint_url}")
         return boto3.client("s3", endpoint_url=endpoint_url)
 
     def callback(self, source, cnx, value):
@@ -73,8 +73,7 @@
             # fs_importing allows to change S3 key saved in database
             entity._cw_dont_cache_attribute(attr, repo_side=True)
             key = entity.cw_edited[attr].getvalue()
-            if PY3:
-                key = key.decode("utf-8")
+            key = key.decode("utf-8")
             try:
                 return self.get_s3_object(entity._cw, key)
             except Exception:
@@ -204,7 +203,7 @@
         """
         try:
             rset = entity._cw.execute(
-                "Any stkey(D) WHERE X eid %s, X %s D" % (entity.eid, attr)
+                "Any stkey(D) WHERE X eid {}, X {} D".format(entity.eid, attr)
             )
         except NotImplementedError:
             # may occur when called from migrate_entity, ie. when the storage
@@ -212,8 +211,7 @@
             rset = None
         if rset and rset.rows[0][0]:
             key = rset.rows[0][0].getvalue()
-            if PY3:
-                key = key.decode("utf-8")
+            key = key.decode("utf-8")
             return key
         return None
 
diff --git a/cubicweb_s3storage/testing.py b/cubicweb_s3storage/testing.py
--- a/cubicweb_s3storage/testing.py
+++ b/cubicweb_s3storage/testing.py
@@ -1,9 +1,9 @@
 import boto3
-from mock import patch
+from unittest.mock import patch
 from moto import mock_s3
 
 
-class S3StorageTestMixin(object):
+class S3StorageTestMixin:
 
     s3_bucket = "test-bucket"
 
@@ -21,9 +21,9 @@
             s3_mock,
             patched_storage_s3_client,
         ]
-        super(S3StorageTestMixin, self).setUp()
+        super().setUp()
 
     def tearDown(self):
-        super(S3StorageTestMixin, self).tearDown()
+        super().tearDown()
         while self._mocks:
             self._mocks.pop().stop()
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -57,7 +57,7 @@
 for entry in ("__depends__",):  # "__recommends__"):
     requires.update(__pkginfo__.get(entry, {}))
 install_requires = [
-    "{0} {1}".format(d, v and v or "").strip() for d, v in requires.items()
+    "{} {}".format(d, v and v or "").strip() for d, v in requires.items()
 ]
 
 
diff --git a/test/test_s3storage.py b/test/test_s3storage.py
--- a/test/test_s3storage.py
+++ b/test/test_s3storage.py
@@ -1,6 +1,6 @@
 import re
 from contextlib import contextmanager
-from mock import patch
+from unittest.mock import patch
 
 from six import PY3
 
@@ -95,8 +95,7 @@
         self.s3_bucket.Versioning().enable()
         self.repo.vreg.config["s3-activate-object-versioning"] = True
         binstuff = "".join(chr(x) for x in range(256))
-        if PY3:
-            binstuff = binstuff.encode()
+        binstuff = binstuff.encode()
         with self.admin_access.client_cnx() as cnx:
             eid = create_image(cnx, binstuff).eid
             cnx.commit()
@@ -211,8 +210,7 @@
 
     def test_entity_retrieve(self):
         binstuff = "".join(chr(x) for x in range(256))
-        if PY3:
-            binstuff = binstuff.encode()
+        binstuff = binstuff.encode()
         with self.admin_access.client_cnx() as cnx:
             eid = create_image(cnx, binstuff).eid
             cnx.commit()