]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
fully update to flake8 6.1.0
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 24 Nov 2023 21:27:03 +0000 (16:27 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 24 Nov 2023 21:34:45 +0000 (16:34 -0500)
I updated flake8 in pre-commit a few days ago but forgot to do it in
tox.

this flake seems to be picking inside of f-strings, which black does
not fix, so fix these manually.

Change-Id: I9a641a99e280fbba9d893a6f1f051b5039d5d4eb

15 files changed:
lib/sqlalchemy/dialects/mssql/base.py
lib/sqlalchemy/dialects/postgresql/base.py
lib/sqlalchemy/dialects/postgresql/pg8000.py
lib/sqlalchemy/engine/base.py
lib/sqlalchemy/engine/reflection.py
lib/sqlalchemy/orm/loading.py
lib/sqlalchemy/orm/persistence.py
lib/sqlalchemy/orm/strategy_options.py
test/dialect/mssql/test_reflection.py
test/dialect/oracle/test_reflection.py
test/engine/test_pool.py
test/orm/test_query.py
test/perf/many_table_reflection.py
test/sql/test_insert_exec.py
tox.ini

index 687de04e4d3da4cd0d2d8d567d2beece7f94b9d1..80734d60619ff4db64cb75cbd21c6fc69cc4bae3 100644 (file)
@@ -1551,8 +1551,8 @@ class MSUUid(sqltypes.Uuid):
 
                 def process(value):
                     return f"""'{
-                            value.replace("-", "").replace("'", "''")
-                        }'"""
+                        value.replace("-", "").replace("'", "''")
+                    }'"""
 
                 return process
 
index b9fd8c8baba5274e3c8cac4c083b55a0ef77bef9..0aec40ea97ff8d4705afd200e89bec2125c0bcce 100644 (file)
@@ -1706,10 +1706,10 @@ class PGCompiler(compiler.SQLCompiler):
             # see #9511
             dbapi_type = sqltypes.STRINGTYPE
         return f"""{sqltext}::{
-                self.dialect.type_compiler_instance.process(
-                    dbapi_type, identifier_preparer=self.preparer
-                )
-            }"""
+            self.dialect.type_compiler_instance.process(
+                dbapi_type, identifier_preparer=self.preparer
+            )
+        }"""
 
     def visit_array(self, element, **kw):
         return "ARRAY[%s]" % self.visit_clauselist(element, **kw)
index 71ee4ebd63e4e9604a9a7d5f306b18dca28cf496..c9829ac68130883f5526187807620d3ad2609e83 100644 (file)
@@ -584,8 +584,8 @@ class PGDialect_pg8000(PGDialect):
         cursor = dbapi_connection.cursor()
         cursor.execute(
             f"""SET CLIENT_ENCODING TO '{
-            client_encoding.replace("'", "''")
-        }'"""
+                client_encoding.replace("'", "''")
+            }'"""
         )
         cursor.execute("COMMIT")
         cursor.close()
index 0000e28103d304cea5d104c12526d8c3a73eb1ab..bcf6ca2280f6c4e0f1cf5a22d1a67c4c803fe321 100644 (file)
@@ -2067,15 +2067,16 @@ class Connection(ConnectionEventsTarget, inspection.Inspectable["Inspector"]):
             if self._echo:
                 self._log_info(sql_util._long_statement(sub_stmt))
 
-                imv_stats = f""" {
-                            imv_batch.batchnum}/{imv_batch.total_batches} ({
-                            'ordered'
-                            if imv_batch.rows_sorted else 'unordered'
-                        }{
-                            '; batch not supported'
-                            if imv_batch.is_downgraded
-                            else ''
-                        })"""
+                imv_stats = f""" {imv_batch.batchnum}/{
+                            imv_batch.total_batches
+                } ({
+                    'ordered'
+                    if imv_batch.rows_sorted else 'unordered'
+                }{
+                    '; batch not supported'
+                    if imv_batch.is_downgraded
+                    else ''
+                })"""
 
                 if imv_batch.batchnum == 1:
                     stats += imv_stats
index 6d2a8a29fd8e1ac449f89b76e9c35cf9e0c6bd58..66e94429cb1d1315641d7622b9597cbe5208d3a1 100644 (file)
@@ -1843,7 +1843,7 @@ class Inspector(inspection.Inspectable["Inspector"]):
                     if not expressions:
                         util.warn(
                             f"Skipping {flavor} {name!r} because key "
-                            f"{index+1} reflected as None but no "
+                            f"{index + 1} reflected as None but no "
                             "'expressions' were returned"
                         )
                         break
index cae6f0be21cf5e069eb8de1fcab997794bd3c5e2..624e8c199ab50146b0bf363f661fc4f541fbbb28 100644 (file)
@@ -149,9 +149,11 @@ def instances(cursor: CursorResult[Any], context: QueryContext) -> Result[Any]:
 
                 raise sa_exc.InvalidRequestError(
                     "Can't apply uniqueness to row tuple containing value of "
-                    f"""type {datatype!r}; {'the values returned appear to be'
-                    if uncertain else 'this datatype produces'} """
-                    "non-hashable values"
+                    f"""type {datatype!r}; {
+                        'the values returned appear to be'
+                        if uncertain
+                        else 'this datatype produces'
+                    } non-hashable values"""
                 )
 
             return go
index 6729b479f903c4931e973cb16be82ea4d40ef972..3f537fb761600730891cd0754821c3e95f7d905e 100644 (file)
@@ -559,7 +559,8 @@ def _collect_update_commands(
                     f"No primary key value supplied for column(s) "
                     f"""{
                         ', '.join(
-                        str(c) for c in pks if pk_params[c._label] is None)
+                            str(c) for c in pks if pk_params[c._label] is None
+                        )
                     }; """
                     "per-row ORM Bulk UPDATE by Primary Key requires that "
                     "records contain primary key values",
index 6c81e8fe7370e48c512c69641dd46cc40f010c2d..e090d5b258c50ebc67e2643332b369b996c63206 100644 (file)
@@ -1611,9 +1611,10 @@ class _LoadElement(
                 f"Mapped class {path[0]} does not apply to any of the "
                 f"root entities in this query, e.g. "
                 f"""{
-                    ", ".join(str(x.entity_zero)
-                    for x in mapper_entities if x.entity_zero
-                )}. Please """
+                    ", ".join(
+                        str(x.entity_zero)
+                        for x in mapper_entities if x.entity_zero
+                    )}. Please """
                 "specify the full path "
                 "from one of the root entities to the target "
                 "attribute. "
index b6a1d411a254a607dc7d56f4362177fe556dcfb2..ae2b7662ef5f07f218076267c31b70b3d0f25b6d 100644 (file)
@@ -389,7 +389,7 @@ class ReflectionTest(fixtures.TestBase, ComparesTables, AssertsCompiledSQL):
     ):
         """test #8035"""
 
-        tname = f"##foo{random.randint(1,1000000)}"
+        tname = f"##foo{random.randint(1, 1000000)}"
 
         with temp_db_alt_collation_fixture.connect() as conn:
             conn.exec_driver_sql(f"CREATE TABLE {tname} (id int primary key)")
index 2a82c25d9fd0ec7bb20c87c74c7be276098028dc..00d8363720104705e4a2e74327fc09636587d055 100644 (file)
@@ -1227,7 +1227,7 @@ class TypeReflectionTest(fixtures.TestBase):
             for attr in attributes:
                 r_attr = getattr(reflected_type, attr)
                 e_attr = getattr(expected_spec, attr)
-                col = f"c{i+1}"
+                col = f"c{i + 1}"
                 eq_(
                     r_attr,
                     e_attr,
index 44c494bad4abb331bc1c72fdab69c5042f0bd9df..49736df9b65ddd7638b6f376637bca96ff9bab8f 100644 (file)
@@ -460,8 +460,10 @@ class PoolEventsTest(PoolTestBase):
         @event.listens_for(p, "reset")
         def reset(conn, rec, state):
             canary.append(
-                f"""reset_{'rollback_ok'
-                if state.asyncio_safe else 'no_rollback'}"""
+                f"""reset_{
+                    'rollback_ok'
+                    if state.asyncio_safe else 'no_rollback'
+                }"""
             )
 
         @event.listens_for(p, "checkin")
index 3057087e43b6c83a280bd21b96de5cf2042b3f3b..a06406c11542a5d478734c86aa908efeb8b5a25e 100644 (file)
@@ -697,8 +697,10 @@ class RowTupleTest(QueryTest, AssertsCompiledSQL):
                     sa_exc.InvalidRequestError,
                     r"Can't apply uniqueness to row tuple "
                     r"containing value of type MyType\(\); "
-                    rf"""{'the values returned appear to be'
-                        if uncertain else 'this datatype produces'} """
+                    rf"""{
+                        'the values returned appear to be'
+                        if uncertain else 'this datatype produces'
+                    } """
                     r"non-hashable values",
                 ):
                     result = s.execute(q).unique().all()
index b9b941b688fb05dd1c0c81f0098269dd769c4456..d65c272430ad21e8438745e7bff214d71020e095 100644 (file)
@@ -38,7 +38,7 @@ def generate_table(meta: sa.MetaData, min_cols, max_cols, dialect_name):
             args.append(sa.ForeignKey(f"table_{target}.table_{target}_col_1"))
         cols.append(
             sa.Column(
-                f"table_{table_num}_col_{i+1}",
+                f"table_{table_num}_col_{i + 1}",
                 *args,
                 primary_key=i == 0,
                 comment=f"primary key of table_{table_num}"
index 29484696da88066e8c4f82333cc15a2fa8ad0162..e9eda0e5bd21faa1de50d26e5a49514c33824d5e 100644 (file)
@@ -2060,7 +2060,7 @@ class IMVSentinelTest(fixtures.TestBase):
                 collection_cls(r),
                 collection_cls(
                     [
-                        (uuids[i], f"d{i+1}", "some_server_default")
+                        (uuids[i], f"d{i + 1}", "some_server_default")
                         for i in range(5)
                     ]
                 ),
@@ -2072,7 +2072,7 @@ class IMVSentinelTest(fixtures.TestBase):
                 collection_cls(
                     [
                         (
-                            f"d{i+1}",
+                            f"d{i + 1}",
                             "some_server_default",
                         )
                         for i in range(5)
diff --git a/tox.ini b/tox.ini
index d11a88202959d99971cf442a299ba35f83f7056c..bf5a252d2406026b4c3e52ce6d5d85366ca871f9 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -210,7 +210,7 @@ setenv=
 [testenv:lint]
 basepython = python3
 deps=
-      flake8==6.0.0
+      flake8==6.1.0
       flake8-import-order
       flake8-builtins
       flake8-future-annotations>=0.0.5