]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
chore: update black to 26.1, re-lint codebase
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Wed, 21 Jan 2026 22:51:23 +0000 (23:51 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Wed, 21 Jan 2026 22:51:23 +0000 (23:51 +0100)
Much better, thank you!

42 files changed:
psycopg/psycopg/_column.py
psycopg/psycopg/_queries.py
psycopg/psycopg/_typeinfo.py
psycopg/psycopg/pq/__init__.py
psycopg/psycopg/types/array.py
psycopg/psycopg/types/composite.py
psycopg/psycopg/types/datetime.py
psycopg/psycopg/types/enum.py
psycopg/psycopg/types/multirange.py
psycopg/psycopg/types/range.py
psycopg/pyproject.toml
tests/_test_cursor.py
tests/constraints.txt
tests/crdb/test_copy.py
tests/crdb/test_copy_async.py
tests/pool/test_module.py
tests/pq/test_async.py
tests/pq/test_copy.py
tests/pq/test_exec.py
tests/pq/test_pgresult.py
tests/scripts/copytest.py
tests/scripts/spiketest.py
tests/test_column.py
tests/test_connection.py
tests/test_connection_async.py
tests/test_copy.py
tests/test_copy_async.py
tests/test_cursor_common.py
tests/test_cursor_common_async.py
tests/test_errors.py
tests/test_module.py
tests/test_pipeline.py
tests/test_pipeline_async.py
tests/test_sql.py
tests/test_typeinfo.py
tests/types/test_composite.py
tests/types/test_datetime.py
tests/types/test_enum.py
tests/types/test_range.py
tools/bump_version.py
tools/update_errors.py
tools/update_oids.py

index 9d3f61fb31a8c029c5010aad247f51d5be655b1f..37ff11e01673edae8dcc3d187d56179fc4e93b63 100644 (file)
@@ -32,12 +32,9 @@ class Column(Sequence[Any]):
         self._fmod = res.fmod(index)
         self._fsize = res.fsize(index)
 
-    _attrs = tuple(
-        attrgetter(attr)
-        for attr in """
+    _attrs = tuple(attrgetter(attr) for attr in """
             name type_code display_size internal_size precision scale null_ok
-            """.split()
-    )
+            """.split())
 
     def __repr__(self) -> str:
         return (
index 33158680ff9d1a5673d36b4368305f0d5b57c0b1..b4dc269a9206ee2070d4aa070d06c165e922f9a8 100644 (file)
@@ -82,7 +82,7 @@ class PostgresQuery:
             else:
                 f = _query2pg_nocache
 
-            (self.query, self._want_formats, self._order, self._parts) = f(
+            self.query, self._want_formats, self._order, self._parts = f(
                 query, self._tx.encoding
             )
         else:
@@ -281,7 +281,7 @@ class PostgresClientQuery(PostgresQuery):
             else:
                 f = _query2pg_client_nocache
 
-            (self.template, self._order, self._parts) = f(query, self._tx.encoding)
+            self.template, self._order, self._parts = f(query, self._tx.encoding)
         else:
             self.query = query
             self._order = None
@@ -360,8 +360,7 @@ def _query2pg_client_nocache(
 _query2pg_client = lru_cache(_query2pg_client_nocache)
 
 
-_re_placeholder = re.compile(
-    rb"""(?x)
+_re_placeholder = re.compile(rb"""(?x)
         %                       # a literal %
         (?:
             (?:
@@ -371,8 +370,7 @@ _re_placeholder = re.compile(
             |
             (?:.)               # or any char, really
         )
-        """
-)
+        """)
 
 
 def _split_query(
index 4c187969084a520ae44b6d96d4f2444f7ecc7ffe..1f41abd6b6c995aba10f72f4aa7b7cbffbab8ecf 100644 (file)
@@ -158,16 +158,14 @@ class TypeInfo:
 
     @classmethod
     def _get_info_query(cls, conn: BaseConnection[Any]) -> QueryNoTemplate:
-        return sql.SQL(
-            """\
+        return sql.SQL("""\
 SELECT
     typname AS name, oid, typarray AS array_oid,
     oid::regtype::text AS regtype, typdelim AS delimiter
 FROM pg_type t
 WHERE t.oid = {regtype}
 ORDER BY t.oid
-"""
-        ).format(regtype=cls._to_regtype(conn))
+""").format(regtype=cls._to_regtype(conn))
 
     @classmethod
     def _has_to_regtype_function(cls, conn: BaseConnection[Any]) -> bool:
index 4485f88b62d5cd36cf9c4d9e13a694f08accefc3..bf0b55f2c400345e3db5f9252a8289b448f799a8 100644 (file)
@@ -105,12 +105,10 @@ def import_from_libpq() -> None:
         raise ImportError(f"requested psycopg implementation '{impl}' unknown")
     else:
         sattempts = "\n".join(f"- {attempt}" for attempt in attempts)
-        raise ImportError(
-            f"""\
+        raise ImportError(f"""\
 no pq wrapper available.
 Attempts made:
-{sattempts}"""
-        )
+{sattempts}""")
 
 
 import_from_libpq()
index ae46854812f57c82716b4d48a6766b950f93c378..82ec0484750c405dd8d6490e4db048de2efeb38c 100644 (file)
@@ -204,14 +204,11 @@ def _get_needs_quotes_regexp(delimiter: bytes) -> re.Pattern[bytes]:
     they are empty strings, contain curly braces, delimiter characters,
     double quotes, backslashes, or white space, or match the word NULL.
     """
-    return re.compile(
-        rb"""(?xi)
+    return re.compile(rb"""(?xi)
           ^$              # the empty string
         | ["{}%s\\\s]      # or a char to escape
         | ^null$          # or the word NULL
-        """
-        % delimiter
-    )
+        """ % delimiter)
 
 
 class ListBinaryDumper(BaseListDumper):
@@ -431,15 +428,12 @@ def _get_array_parse_regexp(delimiter: bytes) -> re.Pattern[bytes]:
     """
     Return a regexp to tokenize an array representation into item and brackets
     """
-    return re.compile(
-        rb"""(?xi)
+    return re.compile(rb"""(?xi)
         (     [{}]                        # open or closed bracket
             | " (?: [^"\\] | \\. )* "     # or a quoted string
             | [^"{}%s\\]+                 # or an unquoted non-empty string
         ) ,?
-        """
-        % delimiter
-    )
+        """ % delimiter)
 
 
 def _load_binary(data: Buffer, tx: Transformer) -> list[Any]:
index 82c4b56e7453416a8575a22e64143b16d88cd8a3..c9760d14985c95c6102b2d51d821f08e8e20b50b 100644 (file)
@@ -63,8 +63,7 @@ class CompositeInfo(TypeInfo):
 
     @classmethod
     def _get_info_query(cls, conn: BaseConnection[Any]) -> abc.QueryNoTemplate:
-        return sql.SQL(
-            """\
+        return sql.SQL("""\
 SELECT
     t.typname AS name, t.oid AS oid, t.typarray AS array_oid,
     t.oid::regtype::text AS regtype,
@@ -88,8 +87,7 @@ LEFT JOIN (
     GROUP BY attrelid
 ) a ON a.attrelid = t.typrelid
 WHERE t.oid = {regtype}
-"""
-        ).format(regtype=cls._to_regtype(conn))
+""").format(regtype=cls._to_regtype(conn))
 
 
 class TupleDumper(RecursiveDumper):
@@ -472,13 +470,11 @@ def _parse_text_record(data: abc.Buffer) -> list[bytes | None]:
     return record
 
 
-_re_tokenize = re.compile(
-    rb"""(?x)
+_re_tokenize = re.compile(rb"""(?x)
       (,)                       # an empty token, representing NULL
     | " ((?: [^"] | "")*) " ,?  # or a quoted string
     | ([^",)]+) ,?              # or an unquoted string
-    """
-)
+    """)
 _re_undouble = re.compile(rb'(["\\])\1')
 
 
index 1bcdc25f1a21542a6d23e9c12ef346c17289436f..8bd4e0f24e6025eda8de08c9e7f5528af5b4bf5a 100644 (file)
@@ -325,14 +325,12 @@ class TimeBinaryLoader(Loader):
 
 
 class TimetzLoader(Loader):
-    _re_format = re.compile(
-        rb"""(?ix)
+    _re_format = re.compile(rb"""(?ix)
         ^
         (\d+) : (\d+) : (\d+) (?: \. (\d+) )?       # Time and micros
         ([-+]) (\d+) (?: : (\d+) )? (?: : (\d+) )?  # Timezone
         $
-        """
-    )
+        """)
 
     def load(self, data: Buffer) -> time:
         if not (m := self._re_format.match(data)):
@@ -381,18 +379,15 @@ class TimetzBinaryLoader(Loader):
 
 
 class TimestampLoader(Loader):
-    _re_format = re.compile(
-        rb"""(?ix)
+    _re_format = re.compile(rb"""(?ix)
         ^
         (\d+) [^a-z0-9] (\d+) [^a-z0-9] (\d+)   # Date
         (?: T | [^a-z0-9] )                     # Separator, including T
         (\d+) [^a-z0-9] (\d+) [^a-z0-9] (\d+)   # Time
         (?: \.(\d+) )?                          # Micros
         $
-        """
-    )
-    _re_format_pg = re.compile(
-        rb"""(?ix)
+        """)
+    _re_format_pg = re.compile(rb"""(?ix)
         ^
         [a-z]+          [^a-z0-9]               # DoW, separator
         (\d+|[a-z]+)    [^a-z0-9]               # Month or day
@@ -401,8 +396,7 @@ class TimestampLoader(Loader):
         (?: \.(\d+) )?                          # Micros
         [^a-z0-9] (\d+)                         # Year
         $
-        """
-    )
+        """)
 
     _ORDER_YMD = 0
     _ORDER_DMY = 1
@@ -477,8 +471,7 @@ class TimestampBinaryLoader(Loader):
 
 
 class TimestamptzLoader(Loader):
-    _re_format = re.compile(
-        rb"""(?ix)
+    _re_format = re.compile(rb"""(?ix)
         ^
         (\d+) [^a-z0-9] (\d+) [^a-z0-9] (\d+)       # Date
         (?: T | [^a-z0-9] )                         # Separator, including T
@@ -486,8 +479,7 @@ class TimestamptzLoader(Loader):
         (?: \.(\d+) )?                              # Micros
         ([-+]) (\d+) (?: : (\d+) )? (?: : (\d+) )?  # Timezone
         $
-        """
-    )
+        """)
 
     def __init__(self, oid: int, context: AdaptContext | None = None):
         super().__init__(oid, context)
index 0a5b61091535fceda28f133b3ce40e0e536c6382..6af13c0dfefb2992ce79de3339ad3b85ddca92e0 100644 (file)
@@ -52,8 +52,7 @@ class EnumInfo(TypeInfo):
 
     @classmethod
     def _get_info_query(cls, conn: BaseConnection[Any]) -> QueryNoTemplate:
-        return sql.SQL(
-            """\
+        return sql.SQL("""\
 SELECT name, oid, array_oid, array_agg(label) AS labels
 FROM (
     SELECT
@@ -66,8 +65,7 @@ FROM (
     ORDER BY e.enumsortorder
 ) x
 GROUP BY name, oid, array_oid
-"""
-        ).format(regtype=cls._to_regtype(conn))
+""").format(regtype=cls._to_regtype(conn))
 
 
 class _BaseEnumLoader(Loader, Generic[E]):
index 1933a90d494b20cfcb4c6ce77fcdad6ea87825d7..3a3e8956c381244d9e2913e750b8c2a3d0da8898 100644 (file)
@@ -51,16 +51,14 @@ class MultirangeInfo(TypeInfo):
             raise e.NotSupportedError(
                 "multirange types are only available from PostgreSQL 14"
             )
-        return sql.SQL(
-            """\
+        return sql.SQL("""\
 SELECT t.typname AS name, t.oid AS oid, t.typarray AS array_oid,
     t.oid::regtype::text AS regtype,
     r.rngtypid AS range_oid, r.rngsubtype AS subtype_oid
 FROM pg_type t
 JOIN pg_range r ON t.oid = r.rngmultitypid
 WHERE t.oid = {regtype}
-"""
-        ).format(regtype=cls._to_regtype(conn))
+""").format(regtype=cls._to_regtype(conn))
 
     def _added(self, registry: TypesRegistry) -> None:
         # Map multiranges ranges and subtypes to info
index b410088e1dc8fd360c5b8db40cb74dfa68176ba4..a1903c5f9dc384d14cf7f1411ff3dc0dc1271c1f 100644 (file)
@@ -55,16 +55,14 @@ class RangeInfo(TypeInfo):
 
     @classmethod
     def _get_info_query(cls, conn: BaseConnection[Any]) -> QueryNoTemplate:
-        return sql.SQL(
-            """\
+        return sql.SQL("""\
 SELECT t.typname AS name, t.oid AS oid, t.typarray AS array_oid,
     t.oid::regtype::text AS regtype,
     r.rngsubtype AS subtype_oid
 FROM pg_type t
 JOIN pg_range r ON t.oid = r.rngtypid
 WHERE t.oid = {regtype}
-"""
-        ).format(regtype=cls._to_regtype(conn))
+""").format(regtype=cls._to_regtype(conn))
 
     def _added(self, registry: TypesRegistry) -> None:
         # Map ranges subtypes to info
index 24dfd0f7f768199f1e0246b81ad64b5a858f2ae9..9d6c4b4473675f5241ba4ad94e0c56a423803089 100644 (file)
@@ -79,7 +79,7 @@ test = [
 ]
 dev = [
     "ast-comments >= 1.1.2",
-    "black >= 24.1.0",
+    "black >= 26.1.0",
     "codespell >= 2.2",
     "cython-lint >= 0.16",
     "dnspython >= 2.1",
index fdc38daece6699f801564c4664c3cefdd35df0ab..b5fe363c996b4a4924afaa154b9b692ebbc9fb20 100644 (file)
@@ -15,12 +15,10 @@ from psycopg.rows import RowMaker
 
 @pytest.fixture(scope="session")
 def _execmany(svcconn):
-    svcconn.execute(
-        """
+    svcconn.execute("""
         drop table if exists execmany;
         create table execmany (id serial primary key, num integer, data text)
-        """
-    )
+        """)
 
 
 @pytest.fixture(scope="function")
index 2dea34be70ed2d9991cf1a691fad52f852f2768e..d309696ab334be0cb243f0febece9d5e1826fe43 100644 (file)
@@ -17,7 +17,7 @@ pytest-cov == 3.0.0
 pytest-randomly == 3.5.0
 
 # From the 'dev' extra
-black == 24.1.0
+black == 26.1.0
 dnspython == 2.1.0
 flake8 == 4.0.0
 types-setuptools == 57.4.0
index f4967a7d4f3db077bd079507dfb7a48419f4a0b7..42ba74b1323b8da05fe12f74c3cf544eb27eb096 100644 (file)
@@ -186,12 +186,10 @@ def test_copy_in_allchars(conn):
             copy.write_row((i, None, chr(i)))
         copy.write_row((ord(eur), None, eur))
 
-    cur.execute(
-        """
+    cur.execute("""
 select col1 = ascii(data), col2 is null, length(data), count(*)
 from copy_in group by 1, 2, 3
-"""
-    )
+""")
     data = cur.fetchall()
     assert data == [(True, True, 1, 256)]
 
index ed4d604c9db4677bf5a1f8458e905a13617dbe7f..9073c83c7c3038850cf053c0de57bf5c149fb975 100644 (file)
@@ -187,12 +187,10 @@ async def test_copy_in_allchars(aconn):
             await copy.write_row((i, None, chr(i)))
         await copy.write_row((ord(eur), None, eur))
 
-    await cur.execute(
-        """
+    await cur.execute("""
 select col1 = ascii(data), col2 is null, length(data), count(*)
 from copy_in group by 1, 2, 3
-"""
-    )
+""")
     data = await cur.fetchall()
     assert data == [(True, True, 1, 256)]
 
index 31f77aab35d60ccba1cd0c7cc62b36235111be33..20d488fdaf3e715fe0ffcaffa0e07f9a19e10ede 100644 (file)
@@ -1,8 +1,6 @@
 def test_version(mypy):
-    cp = mypy.run_on_source(
-        """\
+    cp = mypy.run_on_source("""\
 from psycopg_pool import __version__
 assert __version__
-"""
-    )
+""")
     assert not cp.stdout
index dd54efe66b080cbad853a2dbfad260fadbe95c93..a4226c986e7d73e238de80f8857a1f44115f403e 100644 (file)
@@ -238,12 +238,10 @@ def test_send_close_prepared_no_close(pgconn):
 
 @pytest.mark.crdb_skip("server-side cursor")
 def test_send_describe_portal(pgconn):
-    res = pgconn.exec_(
-        b"""
+    res = pgconn.exec_(b"""
         begin;
         declare cur cursor for select * from generate_series(1,10) foo;
-        """
-    )
+        """)
     assert res.status == pq.ExecStatus.COMMAND_OK, res.error_message
 
     pgconn.send_describe_portal(b"cur")
@@ -260,12 +258,10 @@ def test_send_describe_portal(pgconn):
 @pytest.mark.libpq(">= 17")
 @pytest.mark.crdb_skip("close portal")
 def test_send_close_portal(pgconn):
-    res = pgconn.exec_(
-        b"""
+    res = pgconn.exec_(b"""
         begin;
         declare cur cursor for select * from generate_series(1,10) foo;
-        """
-    )
+        """)
     assert res.status == pq.ExecStatus.COMMAND_OK, res.error_message
 
     pgconn.send_close_portal(b"cur")
index 383d272a2c704fa4312c8c7ef5026daa1d5a1ed9..a257e1177edfe5e61f7134811afeb3e57f752022 100644 (file)
@@ -57,11 +57,9 @@ def test_copy_out(pgconn):
     for i in range(10):
         data = []
         for j in range(20):
-            data.append(
-                f"""\
+            data.append(f"""\
 {i * 20 + j}\t{j}\t{'X' * (i * 20 + j)}
-"""
-            )
+""")
         rv = pgconn.put_copy_data("".join(data).encode("ascii"))
         assert rv > 0
 
@@ -89,11 +87,9 @@ def test_copy_out_err(pgconn):
     for i in range(10):
         data = []
         for j in range(20):
-            data.append(
-                f"""\
+            data.append(f"""\
 {i * 20 + j}\thardly a number\tnope
-"""
-            )
+""")
         rv = pgconn.put_copy_data("".join(data).encode("ascii"))
         assert rv > 0
 
@@ -117,11 +113,9 @@ def test_copy_out_error_end(pgconn):
     for i in range(10):
         data = []
         for j in range(20):
-            data.append(
-                f"""\
+            data.append(f"""\
 {i * 20 + j}\t{j}\t{'X' * (i * 20 + j)}
-"""
-            )
+""")
         rv = pgconn.put_copy_data("".join(data).encode("ascii"))
         assert rv > 0
 
index 3a73728758d2c8af9e03e0908ae970218cdf62b7..3536c55cc230fffdbf371b8470ecde1fafe1075b 100644 (file)
@@ -147,12 +147,10 @@ def test_close_prepared_no_close(pgconn):
 
 @pytest.mark.crdb_skip("close portal")
 def test_describe_portal(pgconn):
-    res = pgconn.exec_(
-        b"""
+    res = pgconn.exec_(b"""
         begin;
         declare cur cursor for select * from generate_series(1,10) foo;
-        """
-    )
+        """)
     assert res.status == pq.ExecStatus.COMMAND_OK, res.error_message
 
     res = pgconn.describe_portal(b"cur")
@@ -168,12 +166,10 @@ def test_describe_portal(pgconn):
 @pytest.mark.crdb_skip("close portal")
 @pytest.mark.libpq(">= 17")
 def test_close_portal(pgconn):
-    res = pgconn.exec_(
-        b"""
+    res = pgconn.exec_(b"""
         begin;
         declare cur cursor for select * from generate_series(1,10) foo;
-        """
-    )
+        """)
     assert res.status == pq.ExecStatus.COMMAND_OK, res.error_message
 
     res = pgconn.close_portal(b"cur")
index 3c426713332fb092253c10932626c8ae29a6247f..c9a571dd537a2019c21c84a42d80d74a4e657902 100644 (file)
@@ -102,13 +102,11 @@ def test_fname(pgconn):
 
 @pytest.mark.crdb("skip", reason="ftable")
 def test_ftable_and_col(pgconn):
-    res = pgconn.exec_(
-        b"""
+    res = pgconn.exec_(b"""
         drop table if exists t1, t2;
         create table t1 as select 1 as f1;
         create table t2 as select 2 as f2, 3 as f3;
-        """
-    )
+        """)
     assert res.status == pq.ExecStatus.COMMAND_OK, res.error_message
 
     res = pgconn.exec_(
index 8157a329368d45613cfe5938be84290e07261438..4325d080f43286982bff17a64bea01cbec53045b 100755 (executable)
@@ -1,5 +1,6 @@
 #!/usr/bin/env python
 """Copy operation micro-benchmarks."""
+
 from __future__ import annotations
 
 import sys
@@ -68,22 +69,18 @@ class CopyPutTest:
         fields = sql.SQL(", ").join(
             [sql.SQL(f"f{i} text") for i in range(self.args.nfields)]
         )
-        stmt = sql.SQL(
-            """\
+        stmt = sql.SQL("""\
 create temp table testcopy (id serial primary key, {})
-"""
-        ).format(fields)
+""").format(fields)
         return stmt
 
     def get_copy_stmt(self) -> Query:
         fields = sql.SQL(", ").join(
             [sql.Identifier(f"f{i}") for i in range(self.args.nfields)]
         )
-        stmt = sql.SQL(
-            """\
+        stmt = sql.SQL("""\
 copy testcopy ({}) from stdin
-"""
-        ).format(fields)
+""").format(fields)
         return stmt
 
     def get_record(self) -> tuple[Any, ...]:
index b669913022884b945cb00f1b7269a807dbd1b1e4..be347d9335d1f48e21eb0628e0c48927973006d5 100644 (file)
@@ -8,6 +8,7 @@ The test is inspired to the `spike analysis`__ illustrated by HikariCP
        Welcome-To-The-Jungle.md
 
 """
+
 # mypy: allow-untyped-defs
 # mypy: allow-untyped-calls
 
index ad5a5c05549ff82c3cc88bc3074504f489c77e40..e7757cf585a09d3215c5ec02180ffd3dad8a2923 100644 (file)
@@ -9,21 +9,17 @@ from .fix_crdb import crdb_encoding, is_crdb, skip_crdb
 
 def test_description_attribs(conn):
     curs = conn.cursor()
-    curs.execute(
-        """select
+    curs.execute("""select
         3.14::decimal(10,2) as pi,
         'hello'::text as hi,
         '2010-02-18'::date as now
-        """
-    )
+        """)
     assert len(curs.description) == 3
     for c in curs.description:
         len(c) == 7  # DBAPI happy
-        for i, a in enumerate(
-            """
+        for i, a in enumerate("""
             name type_code display_size internal_size precision scale null_ok
-            """.split()
-        ):
+        """.split()):
             assert c[i] == getattr(c, a)
 
         # Won't fill them up
@@ -135,13 +131,11 @@ def test_details_time(conn, type, precision):
 
 def test_pickle(conn):
     curs = conn.cursor()
-    curs.execute(
-        """select
+    curs.execute("""select
         3.14::decimal(10,2) as pi,
         'hello'::text as hi,
         '2010-02-18'::date as now
-        """
-    )
+        """)
     description = curs.description
     pickled = pickle.dumps(description, pickle.HIGHEST_PROTOCOL)
     unpickled = pickle.loads(pickled)
index 6b842b142c36784da9c19d9f61eee16e9cd0e54c..c30fb9bee1ec1ce6f1cc5b8b9cadb15ee9c7c3bd 100644 (file)
@@ -319,14 +319,12 @@ def test_commit(conn):
 
 @pytest.mark.crdb_skip("deferrable")
 def test_commit_error(conn):
-    conn.execute(
-        """
+    conn.execute("""
         drop table if exists selfref;
         create table selfref (
             x serial primary key,
             y int references selfref (x) deferrable initially deferred)
-        """
-    )
+        """)
     conn.commit()
 
     conn.execute("insert into selfref (y) values (-1)")
index 6a8f05349dec40a9339561b3eff7c0663f12d8e1..99a7ff41ef1c536cdf1d4be787c4aa137a3e0ade 100644 (file)
@@ -315,14 +315,12 @@ async def test_commit(aconn):
 
 @pytest.mark.crdb_skip("deferrable")
 async def test_commit_error(aconn):
-    await aconn.execute(
-        """
+    await aconn.execute("""
         drop table if exists selfref;
         create table selfref (
             x serial primary key,
             y int references selfref (x) deferrable initially deferred)
-        """
-    )
+        """)
     await aconn.commit()
 
     await aconn.execute("insert into selfref (y) values (-1)")
index 4a983e1f3161f84cb8c5024f55dcc9de3c3b74e1..72e019db9317510344ddc8949f2c9c19f6969ac6 100644 (file)
@@ -93,12 +93,10 @@ def test_copy_out_param(conn, ph, params):
 @pytest.mark.parametrize("typetype", ["names", "oids"])
 def test_read_rows(conn, format, typetype):
     cur = conn.cursor()
-    with cur.copy(
-        """copy (
+    with cur.copy("""
+        copy (
             select 10::int4, 'hello'::text, '{0.0,1.0}'::float8[]
-        ) to stdout (format %s)"""
-        % format.name
-    ) as copy:
+    ) to stdout (format %s)""" % format.name) as copy:
         copy.set_types(["int4", "text", "float8[]"])
         row = copy.read_row()
         assert copy.read_row() is None
@@ -567,12 +565,10 @@ def test_copy_in_allchars(conn):
             copy.write_row((i, None, chr(i)))
         copy.write_row((ord(eur), None, eur))
 
-    cur.execute(
-        """
+    cur.execute("""
 select col1 = ascii(data), col2 is null, length(data), count(*)
 from copy_in group by 1, 2, 3
-"""
-    )
+""")
     data = cur.fetchall()
     assert data == [(True, True, 1, 256)]
 
index c284018094c07cef79585ef1a5af23b603c0fdf9..0db4682e2075d94071c33a3a47f509a825a46c5c 100644 (file)
@@ -94,12 +94,10 @@ async def test_copy_out_param(aconn, ph, params):
 @pytest.mark.parametrize("typetype", ["names", "oids"])
 async def test_read_rows(aconn, format, typetype):
     cur = aconn.cursor()
-    async with cur.copy(
-        """copy (
+    async with cur.copy("""
+        copy (
             select 10::int4, 'hello'::text, '{0.0,1.0}'::float8[]
-        ) to stdout (format %s)"""
-        % format.name
-    ) as copy:
+    ) to stdout (format %s)""" % format.name) as copy:
         copy.set_types(["int4", "text", "float8[]"])
         row = await copy.read_row()
         assert (await copy.read_row()) is None
@@ -580,12 +578,10 @@ async def test_copy_in_allchars(aconn):
             await copy.write_row((i, None, chr(i)))
         await copy.write_row((ord(eur), None, eur))
 
-    await cur.execute(
-        """
+    await cur.execute("""
 select col1 = ascii(data), col2 is null, length(data), count(*)
 from copy_in group by 1, 2, 3
-"""
-    )
+""")
     data = await cur.fetchall()
     assert data == [(True, True, 1, 256)]
 
index 9b597661599e287774a362dc416e0df7dd15a9fd..6ecd1a03ecc06c4041a259b42eb7ba99c24ee1c7 100644 (file)
@@ -552,13 +552,11 @@ def test_rownumber_none(conn, query):
 
 def test_rownumber_mixed(conn):
     cur = conn.cursor()
-    cur.execute(
-        """
+    cur.execute("""
 select x from generate_series(1, 3) x;
 set timezone to utc;
 select x from generate_series(4, 6) x;
-"""
-    )
+""")
     assert cur.rownumber == 0
     assert cur.fetchone() == (1,)
     assert cur.rownumber == 1
@@ -982,13 +980,11 @@ def test_change_loader_results(conn):
     # With no result
     cur.adapters.register_loader("text", make_loader("1"))
 
-    cur.execute(
-        """
+    cur.execute("""
         values ('foo'::text);
         values ('bar'::text), ('baz');
         values ('qux'::text);
-        """
-    )
+        """)
     assert cur.fetchall() == [("foo1",)]
 
     cur.nextset()
index 76974bad72d197218b0a11da01eb5704d95b684f..7a8c772557330de7a46cdf82f53312827832623b 100644 (file)
@@ -557,13 +557,11 @@ async def test_rownumber_none(aconn, query):
 
 async def test_rownumber_mixed(aconn):
     cur = aconn.cursor()
-    await cur.execute(
-        """
+    await cur.execute("""
 select x from generate_series(1, 3) x;
 set timezone to utc;
 select x from generate_series(4, 6) x;
-"""
-    )
+""")
     assert cur.rownumber == 0
     assert await cur.fetchone() == (1,)
     assert cur.rownumber == 1
@@ -990,13 +988,11 @@ async def test_change_loader_results(aconn):
     # With no result
     cur.adapters.register_loader("text", make_loader("1"))
 
-    await cur.execute(
-        """
+    await cur.execute("""
         values ('foo'::text);
         values ('bar'::text), ('baz');
         values ('qux'::text);
-        """
-    )
+        """)
     assert (await cur.fetchall()) == [("foo1",)]
 
     cur.nextset()
index afaf890954d10230082b0112ea01bd05a3e67bfc..8d7f71b7b623da8ecbe73287158f15b37ecd1ec6 100644 (file)
@@ -69,12 +69,10 @@ def test_diag_right_attr(pgconn, monkeypatch):
 def test_diag_attr_values(conn):
     if is_crdb(conn):
         conn.execute("set experimental_enable_temp_tables = 'on'")
-    conn.execute(
-        """
+    conn.execute("""
         create temp table test_exc (
             data int constraint chk_eq1 check (data = 1)
-        )"""
-    )
+        )""")
     with pytest.raises(e.Error) as exc:
         conn.execute("insert into test_exc values(2)")
     diag = exc.value.diag
@@ -105,13 +103,11 @@ def test_error_encoding(conn, enc):
         conn.execute(f"set client_encoding to {enc}")
     cur = conn.cursor()
     with pytest.raises(e.DatabaseError) as excinfo:
-        cur.execute(
-            """
+        cur.execute("""
             do $$begin
                 execute format('insert into "%s" values (1)', chr(8364));
             end$$ language plpgsql;
-            """
-        )
+            """)
 
     diag = excinfo.value.diag
     assert diag.message_primary and f'"{eur}"' in diag.message_primary
@@ -218,14 +214,12 @@ def test_diag_independent(conn):
 @pytest.mark.crdb_skip("deferrable")
 def test_diag_from_commit(conn):
     cur = conn.cursor()
-    cur.execute(
-        """
+    cur.execute("""
         create temp table test_deferred (
            data int primary key,
            ref int references test_deferred (data)
                deferrable initially deferred)
-    """
-    )
+    """)
     cur.execute("insert into test_deferred values (1,2)")
     with pytest.raises(e.Error) as exc:
         conn.commit()
@@ -236,14 +230,12 @@ def test_diag_from_commit(conn):
 @pytest.mark.crdb_skip("deferrable")
 async def test_diag_from_commit_async(aconn):
     cur = aconn.cursor()
-    await cur.execute(
-        """
+    await cur.execute("""
         create temp table test_deferred (
            data int primary key,
            ref int references test_deferred (data)
                deferrable initially deferred)
-    """
-    )
+    """)
     await cur.execute("insert into test_deferred values (1,2)")
     with pytest.raises(e.Error) as exc:
         await aconn.commit()
@@ -271,13 +263,11 @@ def test_unknown_sqlstate(conn):
         e.lookup(code)
 
     with pytest.raises(e.ProgrammingError) as excinfo:
-        conn.execute(
-            f"""
+        conn.execute(f"""
             do $$begin
             raise exception 'made up code' using errcode = '{code}';
             end$$ language plpgsql
-            """
-        )
+            """)
     exc = excinfo.value
     assert exc.diag.sqlstate == code
     assert exc.sqlstate == code
index 608eebd8603e63998e1fb9267216a4e277d5b281..42659d7e52b3af1fd4bab6cecf1326bc77366abe 100644 (file)
@@ -50,12 +50,10 @@ def test_version_c():
 
 
 def test_version_static(mypy):
-    cp = mypy.run_on_source(
-        """\
+    cp = mypy.run_on_source("""\
 from psycopg import __version__
 assert __version__
-"""
-    )
+""")
     assert not cp.stdout
 
 
@@ -64,10 +62,8 @@ def test_version_c_static(mypy):
     # can be psycopg_c, psycopg_binary
     cpackage = _psycopg.__name__.split(".")[0]
 
-    cp = mypy.run_on_source(
-        f"""\
+    cp = mypy.run_on_source(f"""\
 from {cpackage} import __version__
 assert __version__
-"""
-    )
+""")
     assert not cp.stdout
index 7a012aaee696da3563e37c09488a2be6cf8289e2..5f15cdc3365fd79b44c927e3e729ad04a3a2d5f8 100644 (file)
@@ -292,14 +292,12 @@ def test_implicit_transaction(conn):
 
 @pytest.mark.crdb_skip("deferrable")
 def test_error_on_commit(conn):
-    conn.execute(
-        """
+    conn.execute("""
         drop table if exists selfref;
         create table selfref (
             x serial primary key,
             y int references selfref (x) deferrable initially deferred)
-        """
-    )
+        """)
     conn.commit()
 
     with conn.pipeline():
@@ -343,10 +341,9 @@ def test_executemany(conn):
 def test_executemany_no_returning(conn):
     conn.set_autocommit(True)
     conn.execute("drop table if exists execmanypipelinenoreturning")
-    conn.execute(
-        """create unlogged table execmanypipelinenoreturning
-            (id serial primary key, num integer)"""
-    )
+    conn.execute("""
+        create unlogged table execmanypipelinenoreturning
+            (id serial primary key, num integer)""")
     with conn.pipeline(), conn.cursor() as cur:
         cur.executemany(
             "insert into execmanypipelinenoreturning(num) values (%s)",
@@ -567,11 +564,10 @@ def test_concurrency(conn):
         conn.execute("drop table if exists pipeline_concurrency")
         conn.execute("drop table if exists accessed")
     with conn.transaction():
-        conn.execute(
-            """create unlogged table pipeline_concurrency (
+        conn.execute("""
+            create unlogged table pipeline_concurrency (
                 id serial primary key,
-                value integer)"""
-        )
+                value integer)""")
         conn.execute("create unlogged table accessed as (select now() as value)")
 
     def update(value):
index 608b234759b3deadc7d571e956ad5632e960617a..c72387e680aedce70c72431362f2b22e0866828a 100644 (file)
@@ -289,14 +289,12 @@ async def test_implicit_transaction(aconn):
 
 @pytest.mark.crdb_skip("deferrable")
 async def test_error_on_commit(aconn):
-    await aconn.execute(
-        """
+    await aconn.execute("""
         drop table if exists selfref;
         create table selfref (
             x serial primary key,
             y int references selfref (x) deferrable initially deferred)
-        """
-    )
+        """)
     await aconn.commit()
 
     async with aconn.pipeline():
@@ -340,10 +338,9 @@ async def test_executemany(aconn):
 async def test_executemany_no_returning(aconn):
     await aconn.set_autocommit(True)
     await aconn.execute("drop table if exists execmanypipelinenoreturning")
-    await aconn.execute(
-        """create unlogged table execmanypipelinenoreturning
-            (id serial primary key, num integer)"""
-    )
+    await aconn.execute("""
+        create unlogged table execmanypipelinenoreturning
+            (id serial primary key, num integer)""")
     async with aconn.pipeline(), aconn.cursor() as cur:
         await cur.executemany(
             "insert into execmanypipelinenoreturning(num) values (%s)",
@@ -568,11 +565,10 @@ async def test_concurrency(aconn):
         await aconn.execute("drop table if exists pipeline_concurrency")
         await aconn.execute("drop table if exists accessed")
     async with aconn.transaction():
-        await aconn.execute(
-            """create unlogged table pipeline_concurrency (
+        await aconn.execute("""
+            create unlogged table pipeline_concurrency (
                 id serial primary key,
-                value integer)"""
-        )
+                value integer)""")
         await aconn.execute("create unlogged table accessed as (select now() as value)")
 
     async def update(value):
index 894fc27ac3b7d56c5f5108faa7e7a59388b6d93b..6d949ad1797e962d6b0410a45f8d64103fc42a64 100644 (file)
@@ -170,13 +170,11 @@ class TestSqlFormat:
 
     def test_execute(self, conn):
         cur = conn.cursor()
-        cur.execute(
-            """
+        cur.execute("""
             create table test_compose (
                 id serial primary key,
                 foo text, bar text, "ba'z" text)
-            """
-        )
+            """)
         cur.execute(
             sql.SQL("insert into {0} (id, {1}) values (%s, {2})").format(
                 sql.Identifier("test_compose"),
@@ -191,13 +189,11 @@ class TestSqlFormat:
 
     def test_executemany(self, conn):
         cur = conn.cursor()
-        cur.execute(
-            """
+        cur.execute("""
             create table test_compose (
                 id serial primary key,
                 foo text, bar text, "ba'z" text)
-            """
-        )
+            """)
         cur.executemany(
             sql.SQL("insert into {0} (id, {1}) values (%s, {2})").format(
                 sql.Identifier("test_compose"),
@@ -213,13 +209,11 @@ class TestSqlFormat:
     @pytest.mark.crdb_skip("copy")
     def test_copy(self, conn):
         cur = conn.cursor()
-        cur.execute(
-            """
+        cur.execute("""
             create table test_compose (
                 id serial primary key,
                 foo text, bar text, "ba'z" text)
-            """
-        )
+            """)
 
         with cur.copy(
             sql.SQL("copy {t} (id, foo, bar, {f}) from stdin").format(
@@ -411,8 +405,7 @@ class TestLiteral:
     def test_invalid_name(self, conn, name):
         if conn.info.parameter_status("is_superuser") != "on":
             pytest.skip("not a superuser")
-        conn.execute(
-            f"""
+        conn.execute(f"""
             set client_encoding to utf8;
             create type "{name}";
             create function invin(cstring) returns "{name}"
@@ -420,8 +413,7 @@ class TestLiteral:
             create function invout("{name}") returns cstring
                 language internal immutable strict as 'textout';
             create type "{name}" (input=invin, output=invout, like=text);
-            """
-        )
+            """)
         info = TypeInfo.fetch(conn, f'"{name}"')
 
         class InvDumper(StrDumper):
index 3df6fb5102d38cfd5cab560192c3a8776fe6d2bc..2940de60852cdb19602c8828cc9967231194fb71 100644 (file)
@@ -142,12 +142,10 @@ def test_fetch_by_schema_qualified_string(conn, name):
     info = TypeInfo.fetch(conn, name)
     assert info.name == "testtype"
     # assert info.schema == "testschema"
-    cur = conn.execute(
-        """
+    cur = conn.execute("""
         select oid, typarray from pg_type
         where oid = 'testschema.testtype'::regtype
-        """
-    )
+        """)
     assert cur.fetchone() == (info.oid, info.array_oid)
 
 
index feb54ad21970f6eaa1666988a9e9cb267113d056..8d7a4aa528d8572bcbe1f609500d3e971450f4e6 100644 (file)
@@ -57,12 +57,10 @@ def test_load_different_records_rows(conn, fmt_out):
 def test_dump_tuple(conn, rec, obj):
     cur = conn.cursor()
     fields = [f"f{i} text" for i in range(len(obj))]
-    cur.execute(
-        f"""
+    cur.execute(f"""
         drop type if exists tmptype;
         create type tmptype as ({', '.join(fields)});
-        """
-    )
+        """)
     info = CompositeInfo.fetch(conn, "tmptype")
     register_composite(info, conn)
 
@@ -72,12 +70,10 @@ def test_dump_tuple(conn, rec, obj):
 
 def test_dump_tuple_null(conn):
     cur = conn.cursor()
-    cur.execute(
-        """
+    cur.execute("""
         drop type if exists tmptype;
         create type tmptype as (f1 text, f2 text);
-        """
-    )
+        """)
     info = CompositeInfo.fetch(conn, "tmptype")
     register_composite(info, conn)
     conn.adapters.register_dumper(str, StrNoneDumper)
@@ -105,12 +101,10 @@ def test_load_all_chars(conn, fmt_out):
 
 @pytest.mark.parametrize("fmt_in", PyFormat)
 def test_dump_builtin_empty_range(conn, fmt_in):
-    conn.execute(
-        """
+    conn.execute("""
         drop type if exists tmptype;
         create type tmptype as (num integer, range daterange, nums integer[])
-        """
-    )
+        """)
     info = CompositeInfo.fetch(conn, "tmptype")
     register_composite(info, conn)
 
@@ -155,8 +149,7 @@ def testcomp(svcconn):
     if is_crdb(svcconn):
         pytest.skip(crdb_skip_message("composite"))
     cur = svcconn.cursor()
-    cur.execute(
-        """
+    cur.execute("""
         create schema if not exists testschema;
 
         drop type if exists testcomp2 cascade;
@@ -166,8 +159,7 @@ def testcomp(svcconn):
         create type testcomp as (foo text, bar int8, baz float8);
         create type testcomp2 as (qux int8, quux testcomp);
         create type testschema.testcomp as (foo text, bar int8, qux bool);
-        """
-    )
+        """)
     return CompositeInfo.fetch(svcconn, "testcomp")
 
 
@@ -472,12 +464,10 @@ def test_no_info_error(conn):
 
 def test_invalid_fields_names(conn):
     conn.execute("set client_encoding to utf8")
-    conn.execute(
-        f"""
+    conn.execute(f"""
         create type "a-b" as ("c-d" text, "{eur}" int);
         create type "-x-{eur}" as ("w-ww" "a-b", "0" int);
-        """
-    )
+        """)
     ab = CompositeInfo.fetch(conn, '"a-b"')
     x = CompositeInfo.fetch(conn, f'"-x-{eur}"')
     register_composite(ab, conn)
index 6ed17aed7ba4082f51c0ea546cc499fe8a3b8213..8a3a3d6d41e332f609caf6a2345bcc237bc6e9b0 100644 (file)
@@ -427,15 +427,13 @@ class TestDateTimeTz:
     @pytest.mark.crdb_skip("copy")
     def test_load_copy(self, conn):
         cur = conn.cursor(binary=False)
-        with cur.copy(
-            """
+        with cur.copy("""
             copy (
                 select
                     '2000-01-01 01:02:03.123456-10:20'::timestamptz,
                     '11111111'::int4
             ) to stdout
-            """
-        ) as copy:
+        """) as copy:
             copy.set_types(["timestamptz", "int4"])
             rec = copy.read_row()
 
@@ -643,15 +641,13 @@ class TestTimeTz:
     @pytest.mark.crdb_skip("copy")
     def test_load_copy(self, conn):
         cur = conn.cursor(binary=False)
-        with cur.copy(
-            """
+        with cur.copy("""
             copy (
                 select
                     '01:02:03.123456-10:20'::timetz,
                     '11111111'::int4
             ) to stdout
-            """
-        ) as copy:
+        """) as copy:
             copy.set_types(["timetz", "int4"])
             rec = copy.read_row()
 
@@ -758,15 +754,13 @@ class TestInterval:
     @pytest.mark.crdb_skip("copy")
     def test_load_copy(self, conn):
         cur = conn.cursor(binary=False)
-        with cur.copy(
-            """
+        with cur.copy("""
             copy (
                 select
                     '1 days +00:00:01.000001'::interval,
                     'foo bar'::text
             ) to stdout
-            """
-        ) as copy:
+        """) as copy:
             copy.set_types(["interval", "text"])
             rec = copy.read_row()
 
index b92fb43614d59de5a3bd62c6baa6837c79855f26..028dd007b4e9e2f9f5e8531ef0f1b61a6e76418c 100644 (file)
@@ -49,14 +49,10 @@ def make_test_enums(request, svcconn):
 def ensure_enum(enum, conn):
     name = enum.__name__.lower()
     labels = list(enum.__members__)
-    conn.execute(
-        sql.SQL(
-            """
+    conn.execute(sql.SQL("""
             drop type if exists {name};
             create type {name} as enum ({labels});
-            """
-        ).format(name=sql.Identifier(name), labels=sql.SQL(",").join(labels))
-    )
+            """).format(name=sql.Identifier(name), labels=sql.SQL(",").join(labels)))
     return name, enum, labels
 
 
index 3b979228188092473250fc4459573acbda8055ce..cf5cb6baa4938bdf52560ac0a22fc90e458b62f9 100644 (file)
@@ -262,8 +262,7 @@ def create_test_range(conn):
     if is_crdb(conn):
         pytest.skip(crdb_skip_message("range"))
 
-    conn.execute(
-        """
+    conn.execute("""
         create schema if not exists testschema;
 
         drop type if exists testrange cascade;
@@ -271,8 +270,7 @@ def create_test_range(conn):
 
         create type testrange as range (subtype = text, collation = "C");
         create type testschema.testrange as range (subtype = float8);
-        """
-    )
+        """)
 
 
 fetch_cases = [
index 32c2035a0002639b5f47572c717ac4b5602e0b20..d46da77cd99cd118d84733b0a3faab0cadcd360c 100755 (executable)
@@ -60,17 +60,14 @@ class Bumper:
         self.package = package
         self.bump_level = BumpLevel(bump_level) if bump_level else None
 
-        self._ini_regex = re.compile(
-            r"""(?ix)
+        self._ini_regex = re.compile(r"""(?ix)
             ^
             (?P<pre> version \s* = \s* ")
             (?P<ver> [^\s"]+)
             (?P<post> " \s*)
             \s* $
-            """
-        )
-        self._extra_regex = re.compile(
-            r"""(?ix)
+            """)
+        self._extra_regex = re.compile(r"""(?ix)
             ^
             (?P<pre> \s* ")
             (?P<package> [^\s]+)
@@ -78,8 +75,7 @@ class Bumper:
             (?P<ver> [^\s]+)
             (?P<post> \s* (?:;.* \s*))
             \s* $
-            """
-        )
+            """)
 
     @cached_property
     def current_version(self) -> Version:
index 8019acf80c4642b5dfb0e2aab6f3ef98e6ef2452..a64075da6327e29b4b76704cd8fd5fd86a1134b8 100755 (executable)
@@ -112,12 +112,10 @@ def fetch_errors(versions):
         "XX000": "InternalError_",
     }
 
-    seen = set(
-        """
+    seen = set("""
         Error Warning InterfaceError DataError DatabaseError ProgrammingError
         IntegrityError InternalError NotSupportedError OperationalError
-        """.split()
-    )
+        """.split())
 
     for c, cerrs in errors.items():
         for sqstate, errlabel in list(cerrs.items()):
index 90238d679ccb79d87abd4fb50cf9b282489c4376..49c929c7e9b89aa9e02ce9bffb3f0aff7213a537 100755 (executable)
@@ -102,8 +102,7 @@ def get_version_comment(conn: Connection) -> list[str]:
 
 def get_py_oids(conn: Connection) -> list[str]:
     lines = []
-    for typname, oid in conn.execute(
-        """
+    for typname, oid in conn.execute("""
 select typname, oid
 from pg_type
 where
@@ -111,8 +110,7 @@ where
     and (typtype = any('{b,r,m}') or typname = 'record')
     and (typname !~ '^(_|pg_)' or typname = 'pg_lsn')
 order by typname
-"""
-    ):
+"""):
         const_name = typname.upper() + "_OID"
         lines.append(f"{const_name} = {oid}")
 
@@ -138,8 +136,7 @@ def get_py_types(conn: Connection) -> list[str]:
     # Note: "record" is a pseudotype but still a useful one to have.
     # "pg_lsn" is a documented public type and useful in streaming replication
     lines = []
-    for typname, oid, typarray, regtype, typdelim in conn.execute(
-        """
+    for typname, oid, typarray, regtype, typdelim in conn.execute("""
 select typname, oid, typarray,
     -- CRDB might have quotes in the regtype representation
     replace(typname::regtype::text, '''', '') as regtype,
@@ -151,8 +148,7 @@ where
     and (typtype = 'b' or typname = 'record')
     and (typname !~ '^(_|pg_)' or typname = 'pg_lsn')
 order by typname
-"""
-    ):
+"""):
         typemod = typemods.get(typname)
 
         # Weird legacy type in postgres catalog
@@ -177,8 +173,7 @@ order by typname
 
 def get_py_ranges(conn: Connection) -> list[str]:
     lines = []
-    for typname, oid, typarray, rngsubtype in conn.execute(
-        """
+    for typname, oid, typarray, rngsubtype in conn.execute("""
 select typname, oid, typarray, rngsubtype
 from
     pg_type t
@@ -187,8 +182,7 @@ where
     oid < 10000
     and typtype = 'r'
 order by typname
-"""
-    ):
+"""):
         params = [f"{typname!r}, {oid}, {typarray}, subtype_oid={rngsubtype}"]
         lines.append(f"RangeInfo({','.join(params)}),")
 
@@ -197,8 +191,7 @@ order by typname
 
 def get_py_multiranges(conn: Connection) -> list[str]:
     lines = []
-    for typname, oid, typarray, rngtypid, rngsubtype in conn.execute(
-        """
+    for typname, oid, typarray, rngtypid, rngsubtype in conn.execute("""
 select typname, oid, typarray, rngtypid, rngsubtype
 from
     pg_type t
@@ -207,8 +200,7 @@ where
     oid < 10000
     and typtype = 'm'
 order by typname
-"""
-    ):
+"""):
         params = [
             f"{typname!r}, {oid}, {typarray},"
             f" range_oid={rngtypid}, subtype_oid={rngsubtype}"
@@ -220,8 +212,7 @@ order by typname
 
 def get_cython_oids(conn: Connection) -> list[str]:
     lines = []
-    for typname, oid in conn.execute(
-        """
+    for typname, oid in conn.execute("""
 select typname, oid
 from pg_type
 where
@@ -229,8 +220,7 @@ where
     and (typtype = any('{b,r,m}') or typname = 'record')
     and (typname !~ '^(_|pg_)' or typname = 'pg_lsn')
 order by typname
-"""
-    ):
+"""):
         const_name = typname.upper() + "_OID"
         lines.append(f"    {const_name} = {oid}")