]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
update for latest mypy; update to black 26.5.1 main
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 16 Jul 2026 16:58:30 +0000 (12:58 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 16 Jul 2026 17:04:26 +0000 (13:04 -0400)
Change-Id: Ifcc7e9686f233381087dba6aaeba75da4eca8035

29 files changed:
.pre-commit-config.yaml
alembic/__init__.py
alembic/autogenerate/render.py
alembic/command.py
alembic/config.py
alembic/ddl/impl.py
alembic/ddl/mssql.py
alembic/ddl/postgresql.py
alembic/operations/__init__.py
alembic/operations/base.py
alembic/operations/batch.py
alembic/runtime/environment.py
alembic/runtime/migration.py
alembic/testing/env.py
docs/build/conf.py
pyproject.toml
reap_dbs.py
tests/conftest.py
tests/test_batch.py
tests/test_bulk_insert.py
tests/test_command.py
tests/test_config.py
tests/test_environment.py
tests/test_offline_environment.py
tests/test_post_write.py
tests/test_postgresql.py
tests/test_script_consumption.py
tests/test_script_production.py
tools/write_pyi.py

index 5f45d05463c1841bcc382cb39ece2ccb4c37352b..af478101e2f2e856e1108e840c98c3862e5842bd 100644 (file)
@@ -2,7 +2,7 @@
 # See https://pre-commit.com/hooks.html for more hooks
 repos:
 -   repo: https://github.com/python/black
-    rev: 25.9.0
+    rev: 26.5.1
     hooks:
     -   id: black
 
index 2d8ea2d31bde40964152acecb98ffd1a16b4e987..f41cb208ee4903790d909403bb25bfde7dfc6849 100644 (file)
@@ -2,5 +2,4 @@ from . import context
 from . import op
 from .runtime import plugins
 
-
 __version__ = "1.18.6"
index 4cae1cf31edcef8b5dc516f1be257d7070e0ec95..f202c6c8e2cfd93f59e6d08fbcf29f900da66fd6 100644 (file)
@@ -754,7 +754,7 @@ def _render_column(
     opts: List[Tuple[str, Any]] = []
 
     if column.server_default:
-        rendered = _render_server_default(  # type:ignore[assignment]
+        rendered = _render_server_default(  # type: ignore[assignment]
             column.server_default, autogen_context
         )
         if rendered:
index 2cb94ad189990894c9e0f4698c1c78c664b364e5..0f374f2a7dc246813417a3c23142d435e913e407 100644 (file)
@@ -442,7 +442,7 @@ def merge(
         head=revisions,
         branch_labels=branch_label,
         splice=splice,
-        **template_args,  # type:ignore[arg-type]
+        **template_args,  # type: ignore[arg-type]
     )
 
 
index 121a4459cd56fa5ab6bf174e8cb7a9946ba95b0b..a5f6406f0e32c00da03179caf2d6e7902c384912 100644 (file)
@@ -28,7 +28,6 @@ from . import util
 from .util import compat
 from .util.pyfiles import _preserving_path_as_str
 
-
 log = logging.getLogger(__name__)
 
 
@@ -180,7 +179,7 @@ class Config:
             return None
         return Path(self.toml_file_name)
 
-    config_ini_section: str = None  # type:ignore[assignment]
+    config_ini_section: str = None  # type: ignore[assignment]
     """Name of the config file section to read basic configuration
     from.  Defaults to ``alembic``, that is the ``[alembic]`` section
     of the .ini file.  This value is modified using the ``-n/--name``
@@ -927,11 +926,11 @@ class CommandLine:
             if arg in self._KWARGS_OPTS:
                 kwarg_opt = self._KWARGS_OPTS[arg]
                 args, opts = kwarg_opt[0:-1], kwarg_opt[-1]
-                subparser.add_argument(*args, **opts)  # type:ignore
+                subparser.add_argument(*args, **opts)  # type: ignore
 
         for arg in positional:
             opts = self._POSITIONAL_OPTS.get(arg, {})
-            subparser.add_argument(arg, **opts)  # type:ignore
+            subparser.add_argument(arg, **opts)  # type: ignore
 
     def _inspect_function(self, fn: CommandFunction) -> tuple[Any, Any, str]:
         spec = compat.inspect_getfullargspec(fn)
index 964cd1f30b99c8b44b4dac37acc50e9dcfad9781..dc4fbaa6ffd3bcfe974e552e65c695d1b440fa11 100644 (file)
@@ -328,7 +328,7 @@ class DefaultImpl(metaclass=ImplMeta):
                 cls_(
                     table_name,
                     column_name,
-                    server_default,  # type:ignore[arg-type]
+                    server_default,  # type: ignore[arg-type]
                     schema=schema,
                     existing_type=existing_type,
                     existing_server_default=existing_server_default,
index 91cd9e428d08c366b506d709574c2ceae935eacf..52ef34d0de0cac430718321869d5580c8d090e90 100644 (file)
@@ -199,7 +199,7 @@ class MSSQLImpl(DefaultImpl):
                 index.table.append_column(Column(col, sqltypes.NullType))
         self._exec(CreateIndex(index, **kw))
 
-    def bulk_insert(  # type:ignore[override]
+    def bulk_insert(  # type: ignore[override]
         self, table: Union[TableClause, Table], rows: List[dict], **kw: Any
     ) -> None:
         if self.as_sql:
index cc03f45346d81c873a3724aee1a51fd2ea2cf1a6..3659375de9415144d1f8be4ae9ef6f5c583feb2e 100644 (file)
@@ -52,7 +52,6 @@ from ..operations.base import Operations
 from ..util import sqla_compat
 from ..util.sqla_compat import compiles
 
-
 if TYPE_CHECKING:
     from typing import Literal
 
@@ -637,7 +636,7 @@ class CreateExcludeConstraintOp(ops.AddConstraintOp):
         self.kw = kw
 
     @classmethod
-    def from_constraint(  # type:ignore[override]
+    def from_constraint(  # type: ignore[override]
         cls, constraint: ExcludeConstraint
     ) -> CreateExcludeConstraintOp:
         constraint_table = sqla_compat._table_for_constraint(constraint)
@@ -803,7 +802,7 @@ def _exclude_constraint(
             "(%s, %r)"
             % (
                 _render_potential_column(
-                    sqltext,  # type:ignore[arg-type]
+                    sqltext,  # type: ignore[arg-type]
                     autogen_context,
                 ),
                 opstring,
index 26197cbe8205decca224757d329e634a6a23d2e2..fabe0e20fb3e7dc492b896b48eefeb0b1f89c167 100644 (file)
@@ -5,7 +5,6 @@ from .base import Operations
 from .ops import MigrateOperation
 from .ops import MigrationScript
 
-
 __all__ = [
     "AbstractOperations",
     "Operations",
index 67aefdd4c2c7b9f92558e12c5aba9e526d38cab2..c9e976c570caf9920d38c8478d2395e16f05b735 100644 (file)
@@ -487,7 +487,7 @@ class AbstractOperations(util.ModuleClsProxy):
         a particular constraint name is already converted.
 
         """
-        return conv(name)
+        return conv(name)  # type: ignore[no-any-return]
 
     def inline_literal(
         self, value: Union[str, int], type_: Optional[TypeEngine[Any]] = None
index 9b48be598625f32837be93ae055b14e8faac9d3e..6f50bb57020ea3c109341ed8c775592479b29a50 100644 (file)
@@ -511,10 +511,10 @@ class ApplyBatchImpl:
                 # pop named constraints for Boolean/Enum for rename
                 if (
                     isinstance(resolved_existing_type, SchemaEventTarget)
-                    and resolved_existing_type.name  # type:ignore[attr-defined]  # noqa E501
+                    and resolved_existing_type.name  # type: ignore[attr-defined]  # noqa E501
                 ):
                     self.named_constraints.pop(
-                        resolved_existing_type.name,  # type:ignore[attr-defined]  # noqa E501
+                        resolved_existing_type.name,  # type: ignore[attr-defined]  # noqa E501
                         None,
                     )
 
@@ -527,8 +527,8 @@ class ApplyBatchImpl:
             # Operations.implementation_for(alter_column)
 
             if isinstance(existing.type, SchemaEventTarget):
-                existing.type._create_events = (  # type:ignore[attr-defined]
-                    existing.type.create_constraint  # type:ignore[attr-defined] # noqa
+                existing.type._create_events = (  # type: ignore[attr-defined]
+                    existing.type.create_constraint  # type: ignore[attr-defined] # noqa
                 ) = False
 
             self.impl.cast_for_batch_migrate(
@@ -639,10 +639,10 @@ class ApplyBatchImpl:
         if (
             "existing_type" in kw
             and isinstance(kw["existing_type"], SchemaEventTarget)
-            and kw["existing_type"].name  # type:ignore[attr-defined]
+            and kw["existing_type"].name  # type: ignore[attr-defined]
         ):
             self.named_constraints.pop(
-                kw["existing_type"].name, None  # type:ignore[attr-defined]
+                kw["existing_type"].name, None  # type: ignore[attr-defined]
             )
 
     def create_column_comment(self, column):
index 5817e2d9fdd7b85cea126ec757b1059e0f7ad3b2..f9e0b1e359abc279079ea9072023121a6a72014c 100644 (file)
@@ -173,12 +173,12 @@ class EnvironmentContext(util.ModuleClsProxy):
 
     _migration_context: Optional[MigrationContext] = None
 
-    config: Config = None  # type:ignore[assignment]
+    config: Config = None  # type: ignore[assignment]
     """An instance of :class:`.Config` representing the
     configuration file contents as well as other variables
     set programmatically within it."""
 
-    script: ScriptDirectory = None  # type:ignore[assignment]
+    script: ScriptDirectory = None  # type: ignore[assignment]
     """An instance of :class:`.ScriptDirectory` which provides
     programmatic access to version files within the ``versions/``
     directory.
index 3fccf22a67272a34d8941e40cd870af33a179cd0..a108539d18793596f01ae634b737f630381b1981 100644 (file)
@@ -170,13 +170,13 @@ class MigrationContext:
         if "output_encoding" in opts:
             self.output_buffer = EncodedIO(
                 opts.get("output_buffer")
-                or sys.stdout,  # type:ignore[arg-type]
+                or sys.stdout,  # type: ignore[arg-type]
                 opts["output_encoding"],
             )
         else:
             self.output_buffer = opts.get(
                 "output_buffer", sys.stdout
-            )  # type:ignore[assignment]  # noqa: E501
+            )  # type: ignore[assignment]  # noqa: E501
 
         self.transactional_ddl = transactional_ddl
 
@@ -645,7 +645,7 @@ class MigrationContext:
 
     def _in_connection_transaction(self) -> bool:
         try:
-            meth = self.connection.in_transaction  # type:ignore[union-attr]
+            meth = self.connection.in_transaction  # type: ignore[union-attr]
         except AttributeError:
             return False
         else:
@@ -1036,7 +1036,7 @@ class RevisionStep(MigrationStep):
             return (self.revision.revision,)
 
     @property
-    def from_revisions_no_deps(  # type:ignore[override]
+    def from_revisions_no_deps(  # type: ignore[override]
         self,
     ) -> Tuple[str, ...]:
         if self.is_upgrade:
@@ -1052,7 +1052,7 @@ class RevisionStep(MigrationStep):
             return self.revision._normalized_down_revisions
 
     @property
-    def to_revisions_no_deps(  # type:ignore[override]
+    def to_revisions_no_deps(  # type: ignore[override]
         self,
     ) -> Tuple[str, ...]:
         if self.is_upgrade:
@@ -1264,13 +1264,13 @@ class StampStep(MigrationStep):
         return self.to_
 
     @property
-    def from_revisions_no_deps(  # type:ignore[override]
+    def from_revisions_no_deps(  # type: ignore[override]
         self,
     ) -> Tuple[str, ...]:
         return self.from_
 
     @property
-    def to_revisions_no_deps(  # type:ignore[override]
+    def to_revisions_no_deps(  # type: ignore[override]
         self,
     ) -> Tuple[str, ...]:
         return self.to_
index ad4de783530018be713b1cf6729072752a56e7d9..f8711f2a525972fdf086642d415adfd14afd4ed9 100644 (file)
@@ -96,14 +96,11 @@ def script_file_fixture(txt):
 
 def env_file_fixture(txt):
     dir_ = _join_path(_get_staging_directory(), "scripts")
-    txt = (
-        """
+    txt = """
 from alembic import context
 
 config = context.config
-"""
-        + txt
-    )
+""" + txt
 
     path = _join_path(dir_, "env.py")
     pyc_path = util.pyc_file_from_path(path)
@@ -128,8 +125,7 @@ def _sqlite_testing_config(sourceless=False, future=False):
 
     sqlalchemy_future = future or ("future" in config.db.__class__.__module__)
 
-    return _write_config_file(
-        f"""
+    return _write_config_file(f"""
 [alembic]
 script_location = {dir_}
 sqlalchemy.url = {url}
@@ -164,8 +160,7 @@ keys = generic
 [formatter_generic]
 format = %%(levelname)-5.5s [%%(name)s] %%(message)s
 datefmt = %%H:%%M:%%S
-    """
-    )
+    """)
 
 
 def _multi_dir_testing_config(sourceless=False, extra_version_location=""):
@@ -174,8 +169,7 @@ def _multi_dir_testing_config(sourceless=False, extra_version_location=""):
 
     url = "sqlite:///%s/foo.db" % dir_
 
-    return _write_config_file(
-        f"""
+    return _write_config_file(f"""
 [alembic]
 script_location = {dir_}
 sqlalchemy.url = {url}
@@ -208,8 +202,7 @@ keys = generic
 [formatter_generic]
 format = %%(levelname)-5.5s [%%(name)s] %%(message)s
 datefmt = %%H:%%M:%%S
-    """
-    )
+    """)
 
 
 def _no_sql_pyproject_config(dialect="postgresql", directives=""):
@@ -260,8 +253,7 @@ def _no_sql_testing_config(dialect="postgresql", directives=""):
     """use a postgresql url with no host so that
     connections guaranteed to fail"""
     dir_ = _join_path(_get_staging_directory(), "scripts")
-    return _write_config_file(
-        f"""
+    return _write_config_file(f"""
 [alembic]
 script_location ={dir_}
 sqlalchemy.url = {dialect}://
@@ -291,8 +283,7 @@ keys = generic
 format = %%(levelname)-5.5s [%%(name)s] %%(message)s
 datefmt = %%H:%%M:%%S
 
-"""
-    )
+""")
 
 
 def _write_toml_config(tomltext, initext):
@@ -541,8 +532,7 @@ def _multidb_testing_config(engines):
         for key, value in engines.items()
     )
 
-    return _write_config_file(
-        f"""
+    return _write_config_file(f"""
 [alembic]
 script_location = {dir_}
 sourceless = false
@@ -573,8 +563,7 @@ keys = generic
 [formatter_generic]
 format = %%(levelname)-5.5s [%%(name)s] %%(message)s
 datefmt = %%H:%%M:%%S
-    """
-    )
+    """)
 
 
 def _join_path(base: str, *more: str):
index e065844503fec86f7aaa118fe77ca30612a1e220..28780730d72b17be49ff813204d34a04f46dbfb2 100644 (file)
@@ -15,7 +15,6 @@
 import os
 import sys
 
-
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
index 0fbdb9c936bcb8e106af52044b6fec31516d587d..25ebc56b67448434c15cbbb98715582129d8ca86 100644 (file)
@@ -54,7 +54,7 @@ alembic = "alembic.config:main"
 tests = [
     "pytest>8,<10",
     "pytest-xdist",
-    "black==25.9.0",  # for test_post_write.py
+    "black==26.5.1",  # for test_post_write.py
     "zimports",  # for stub testing
     "tzdata",
     "junitparser"
@@ -78,7 +78,7 @@ lint = [
     "flake8-rst-docstrings",
     "pydocstyle",
     "pygments",
-    "black==25.9.0"
+    "black==26.5.1"
 ]
 
 mypy = [
index 6b2215dfe24bccd9f6e8a76d70ecc5b3a05c1e8b..66e503b643cc943ee2100583c2f880dcd617e69e 100644 (file)
@@ -16,7 +16,6 @@ import sys
 
 from sqlalchemy.testing import provision
 
-
 logging.basicConfig()
 logging.getLogger(provision.__name__).setLevel(logging.INFO)
 
index fc3871f5996ee9c7c9b77a4906036147df8fa98a..69172ab3a0fa7f99a8a3a360972ffacb6f9a6e6f 100755 (executable)
@@ -6,6 +6,7 @@ This script is an extension to py.test which
 installs SQLAlchemy's testing plugin into the local environment.
 
 """
+
 import os
 
 import pytest
index fa582829c76476b7c328fd44c524b2be5450cb57..0dfd273b39f18a255099059c38f849a30a70ef6f 100644 (file)
@@ -2467,8 +2467,7 @@ class OfflineTest(TestBase):
             batch_op.drop_column('foo')
             batch_op.add_column(Column('bar', String))
 
-    """  # noqa: E501
-                % a,
+    """ % a,  # noqa: E501
             )
 
         yield go
@@ -2510,8 +2509,7 @@ class OfflineTest(TestBase):
             batch_op.drop_column('foo')
             batch_op.add_column(Column('bar', String))
 
-    """
-                % a,
+    """ % a,
             )
 
         yield go
index 0841c9a9973d5b69fcb66b8ac7a855138a60ec27..a4894bca5593e718317054381085c1517b3939c4 100644 (file)
@@ -238,17 +238,13 @@ class RoundTripTest(TestBase):
     def setUp(self):
         self.conn = config.db.connect()
         with self.conn.begin():
-            self.conn.execute(
-                text(
-                    """
+            self.conn.execute(text("""
                 create table foo(
                     id integer primary key,
                     data varchar(50),
                     x integer
                 )
-            """
-                )
-            )
+            """))
         context = MigrationContext.configure(self.conn)
         self.op = op.Operations(context)
         self.t1 = table("foo", column("id"), column("data"), column("x"))
index 391a19d00ab4a30720f3ef01545831d06dc40190..16e2b1cc0fd2ab42130b769a610996bad5c21373 100644 (file)
@@ -74,8 +74,7 @@ class HistoryTest(_BufMixin, TestBase):
 
     @classmethod
     def _setup_env_file(self):
-        env_file_fixture(
-            r"""
+        env_file_fixture(r"""
 
 from sqlalchemy import MetaData, engine_from_config
 target_metadata = MetaData()
@@ -97,8 +96,7 @@ try:
 finally:
     connection.close()
     engine.dispose()
-"""
-        )
+""")
 
     def _eq_cmd_output(self, buf, expected, env_token=False, currents=()):
         script = ScriptDirectory.from_config(self.cfg)
@@ -222,8 +220,7 @@ class RevisionEnvironmentTest(_BufMixin, TestBase):
 
     @classmethod
     def _setup_env_file(self):
-        env_file_fixture(
-            r"""
+        env_file_fixture(r"""
 
 from sqlalchemy import MetaData, engine_from_config
 target_metadata = MetaData()
@@ -245,8 +242,7 @@ try:
 finally:
     connection.close()
     engine.dispose()
-"""
-        )
+""")
 
     def _assert_env_token(self, buf, expected):
         if expected:
@@ -423,8 +419,7 @@ class RevisionTest(TestBase):
         clear_staging_env()
 
     def _env_fixture(self, version_table_pk=True):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 
 from sqlalchemy import MetaData, engine_from_config
 target_metadata = MetaData()
@@ -447,9 +442,7 @@ finally:
     connection.close()
     engine.dispose()
 
-"""
-            % (version_table_pk,)
-        )
+""" % (version_table_pk,))
 
     def test_create_rev_plain_db_not_up_to_date(self):
         self._env_fixture()
@@ -684,8 +677,7 @@ class CheckTest(TestBase):
         clear_staging_env()
 
     def _env_fixture(self, version_table_pk=True):
-        env_file_fixture(
-            f"""
+        env_file_fixture(f"""
 
 from sqlalchemy import MetaData, engine_from_config
 target_metadata = MetaData()
@@ -710,8 +702,7 @@ finally:
     connection.close()
     engine.dispose()
 
-"""
-        )
+""")
 
     def test_check_no_changes(self):
         self._env_fixture()
@@ -749,8 +740,7 @@ class CheckTestMultiDB(CheckTest):
         )
 
     def _env_fixture(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 
 import re
 from sqlalchemy import MetaData, engine_from_config
@@ -776,8 +766,7 @@ for db_name in re.split(r",\\s*", db_names):
         engine.dispose()
 
 
-"""
-        )
+""")
 
 
 class _StampTest:
@@ -1092,8 +1081,7 @@ class LiveStampTest(TestBase):
             """
 revision = '%s'
 down_revision = None
-"""
-            % a,
+""" % a,
         )
         script.generate_revision(b, None, refresh=True)
         write_script(
@@ -1102,8 +1090,7 @@ down_revision = None
             """
 revision = '%s'
 down_revision = '%s'
-"""
-            % (b, a),
+""" % (b, a),
         )
 
     def tearDown(self):
@@ -1623,10 +1610,8 @@ class CommandLineTest(TestBase):
         root = pathlib.Path(_get_staging_directory())
 
         with (root / "pyproject.toml").open("w") as file_:
-            file_.write(
-                """[tool.sometool]
-someconfig = 'bar'"""
-            )
+            file_.write("""[tool.sometool]
+someconfig = 'bar'""")
         yield config.Config(
             self.cfg.config_file_name, toml_file=root / "pyproject.toml"
         )
@@ -1663,10 +1648,8 @@ someconfig = 'bar'"""
         with open(cfg.toml_file_name, "r") as f:
             file_content = f.read()
 
-        assert file_content.startswith(
-            """[tool.sometool]
-someconfig = 'bar'\n\n[tool.alembic]"""
-        )
+        assert file_content.startswith("""[tool.sometool]
+someconfig = 'bar'\n\n[tool.alembic]""")
         toml = compat.tomllib.loads(file_content)
         eq_(
             toml,
index 0dc840f8c355901b83445730740770dd56c7accd..74102e4bf54ed791aeacd57ffa3c90e7c462f04a 100644 (file)
@@ -28,12 +28,10 @@ from alembic.testing.fixtures import TestBase
 
 class FileConfigTest(TestBase):
     def test_config_args(self):
-        cfg = _write_config_file(
-            """
+        cfg = _write_config_file("""
 [alembic]
 migrations = %(base_path)s/db/migrations
-"""
-        )
+""")
         test_cfg = config.Config(
             cfg.config_file_name, config_args=dict(base_path="/home/alembic")
         )
@@ -61,12 +59,10 @@ class ConfigTest(TestBase):
             logger.addHandler(handler)
             logger.setLevel(logging.INFO)
 
-            cfg = _write_config_file(
-                """
+            cfg = _write_config_file("""
 [alembic]
 script_location = %(base_path)s/db/migrations
-"""
-            )
+""")
             test_cfg = config.Config(
                 cfg.config_file_name, config_args=dict(base_path="/tmp")
             )
@@ -464,14 +460,12 @@ class PyprojectConfigTest(TestBase):
     def test_script_location(self, pyproject_only_env):
         cfg = pyproject_only_env
         with cfg._toml_file_path.open("wb") as file_:
-            file_.write(
-                rb"""
+            file_.write(rb"""
 
 [tool.alembic]
 script_location = "%(here)s/scripts"
 
-"""
-            )
+""")
 
         new_cfg = config.Config(
             file_=cfg.config_file_name, toml_file=cfg._toml_file_path
@@ -486,13 +480,11 @@ script_location = "%(here)s/scripts"
 
         cfg = pyproject_only_env
         with cfg._toml_file_path.open("ba") as file_:
-            file_.write(
-                b"""
+            file_.write(b"""
 version_locations = [
     "%(here)s/foo/bar"
 ]
-"""
-            )
+""")
 
         if "toml_alembic_config" in cfg.__dict__:
             cfg.__dict__.pop("toml_alembic_config")
@@ -510,8 +502,7 @@ version_locations = [
 
         cfg = pyproject_only_env
         with cfg._toml_file_path.open("wb") as file_:
-            file_.write(
-                rb"""
+            file_.write(rb"""
 
 [tool.alembic]
 script_location = "%(here)s/scripts"
@@ -521,8 +512,7 @@ prepend_sys_path = [
     "%(here)s/path/to/python",
     "c:\\some\\path"
 ]
-"""
-            )
+""")
 
         if "toml_alembic_config" in cfg.__dict__:
             cfg.__dict__.pop("toml_alembic_config")
@@ -542,8 +532,7 @@ prepend_sys_path = [
 
         cfg = pyproject_only_env
         with cfg._toml_file_path.open("wb") as file_:
-            file_.write(
-                rb"""
+            file_.write(rb"""
 
 [tool.alembic]
 script_location = "%(here)s/scripts"
@@ -554,8 +543,7 @@ type = "exec"
 executable = "%(here)s/.venv/bin/ruff"
 options = "-l 79 REVISION_SCRIPT_FILENAME"
 
-"""
-            )
+""")
 
         if "toml_alembic_config" in cfg.__dict__:
             cfg.__dict__.pop("toml_alembic_config")
@@ -579,8 +567,7 @@ options = "-l 79 REVISION_SCRIPT_FILENAME"
 
         cfg = pyproject_only_env
         with cfg._toml_file_path.open("wb") as file_:
-            file_.write(
-                rb"""
+            file_.write(rb"""
 
 [tool.alembic]
 script_location = "%(here)s/scripts"
@@ -590,8 +577,7 @@ my_list = [
     "two %(here)s three"
 ]
 
-"""
-            )
+""")
         if "toml_alembic_config" in cfg.__dict__:
             cfg.__dict__.pop("toml_alembic_config")
 
@@ -626,15 +612,13 @@ my_list = [
             else:
                 argtype.fail()
 
-            file_.write(
-                rf"""
+            file_.write(rf"""
 
 [tool.alembic]
 script_location = "%(here)s/scripts"
 
 {config_option}
-"""
-            )
+""")
         if "toml_alembic_config" in cfg.__dict__:
             cfg.__dict__.pop("toml_alembic_config")
 
@@ -668,14 +652,12 @@ script_location = "%(here)s/scripts"
             else:
                 arg_type.fail()
 
-            file_.write(
-                rf"""
+            file_.write(rf"""
 [tool.alembic]
 script_location = "%(here)s/scripts"
 
 {config_option}
-"""
-            )
+""")
         if "toml_alembic_config" in cfg.__dict__:
             cfg.__dict__.pop("toml_alembic_config")
 
index fb98bf11edba311a245559604925f343682e203d..edbbe051b1346947f7643c120f73b7aa500f1303 100644 (file)
@@ -92,9 +92,7 @@ def upgrade():
         do some SQL thing with a % percent sign %
     ''')
 
-""".format(
-                a_rev
-            ),
+""".format(a_rev),
         )
         with capture_context_buffer(transactional_ddl=True) as buf:
             command.upgrade(self.cfg, "arev", sql=True)
@@ -129,8 +127,7 @@ def upgrade():
 def downgrade():
     pass
 
-"""
-            % a_rev,
+""" % a_rev,
         )
         migration_fn = mock.MagicMock()
 
index 8188d2cfd8de8732a96632fd6b197253941dff7e..1c0d958d37f57ce11b4e7317a2786b618d688828 100644 (file)
@@ -27,50 +27,40 @@ class OfflineEnvironmentTest(TestBase):
         clear_staging_env()
 
     def test_not_requires_connection(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 assert not context.requires_connection()
-"""
-        )
+""")
         command.upgrade(self.cfg, a, sql=True)
         command.downgrade(self.cfg, "%s:%s" % (b, a), sql=True)
 
     def test_requires_connection(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 assert context.requires_connection()
-"""
-        )
+""")
         command.upgrade(self.cfg, a)
         command.downgrade(self.cfg, a)
 
     def test_starting_rev_post_context(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 context.configure(dialect_name='sqlite', starting_rev='x')
 assert context.get_starting_revision_argument() == 'x'
-"""
-        )
+""")
         command.upgrade(self.cfg, a, sql=True)
         command.downgrade(self.cfg, "%s:%s" % (b, a), sql=True)
         command.current(self.cfg)
         command.stamp(self.cfg, a)
 
     def test_starting_rev_pre_context(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 assert context.get_starting_revision_argument() == 'x'
-"""
-        )
+""")
         command.upgrade(self.cfg, "x:y", sql=True)
         command.downgrade(self.cfg, "x:y", sql=True)
 
     def test_starting_rev_pre_context_cmd_w_no_startrev(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 assert context.get_starting_revision_argument() == 'x'
-"""
-        )
+""")
         assert_raises_message(
             util.CommandError,
             "No starting revision argument is available.",
@@ -79,11 +69,9 @@ assert context.get_starting_revision_argument() == 'x'
         )
 
     def test_starting_rev_current_pre_context(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 assert context.get_starting_revision_argument() is None
-"""
-        )
+""")
         assert_raises_message(
             util.CommandError,
             "No starting revision argument is available.",
@@ -92,57 +80,42 @@ assert context.get_starting_revision_argument() is None
         )
 
     def test_destination_rev_pre_context(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 assert context.get_revision_argument() == '%s'
-"""
-            % b
-        )
+""" % b)
         command.upgrade(self.cfg, b, sql=True)
         command.stamp(self.cfg, b, sql=True)
         command.downgrade(self.cfg, "%s:%s" % (c, b), sql=True)
 
     def test_destination_rev_pre_context_multihead(self):
         d, e, f = multi_heads_fixture(self.cfg, a, b, c)
-        env_file_fixture(
-            """
+        env_file_fixture("""
 assert set(context.get_revision_argument()) == set(('%s', '%s', '%s', ))
-"""
-            % (f, e, c)
-        )
+""" % (f, e, c))
         command.upgrade(self.cfg, "heads", sql=True)
 
     def test_destination_rev_post_context(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 context.configure(dialect_name='sqlite')
 assert context.get_revision_argument() == '%s'
-"""
-            % b
-        )
+""" % b)
         command.upgrade(self.cfg, b, sql=True)
         command.downgrade(self.cfg, "%s:%s" % (c, b), sql=True)
         command.stamp(self.cfg, b, sql=True)
 
     def test_destination_rev_post_context_multihead(self):
         d, e, f = multi_heads_fixture(self.cfg, a, b, c)
-        env_file_fixture(
-            """
+        env_file_fixture("""
 context.configure(dialect_name='sqlite')
 assert set(context.get_revision_argument()) == set(('%s', '%s', '%s', ))
-"""
-            % (f, e, c)
-        )
+""" % (f, e, c))
         command.upgrade(self.cfg, "heads", sql=True)
 
     def test_head_rev_pre_context(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 assert context.get_head_revision() == '%s'
 assert context.get_head_revisions() == ('%s', )
-"""
-            % (c, c)
-        )
+""" % (c, c))
         command.upgrade(self.cfg, b, sql=True)
         command.downgrade(self.cfg, "%s:%s" % (b, a), sql=True)
         command.stamp(self.cfg, b, sql=True)
@@ -150,26 +123,20 @@ assert context.get_head_revisions() == ('%s', )
 
     def test_head_rev_pre_context_multihead(self):
         d, e, f = multi_heads_fixture(self.cfg, a, b, c)
-        env_file_fixture(
-            """
+        env_file_fixture("""
 assert set(context.get_head_revisions()) == set(('%s', '%s', '%s', ))
-"""
-            % (e, f, c)
-        )
+""" % (e, f, c))
         command.upgrade(self.cfg, e, sql=True)
         command.downgrade(self.cfg, "%s:%s" % (e, b), sql=True)
         command.stamp(self.cfg, c, sql=True)
         command.current(self.cfg)
 
     def test_head_rev_post_context(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 context.configure(dialect_name='sqlite')
 assert context.get_head_revision() == '%s'
 assert context.get_head_revisions() == ('%s', )
-"""
-            % (c, c)
-        )
+""" % (c, c))
         command.upgrade(self.cfg, b, sql=True)
         command.downgrade(self.cfg, "%s:%s" % (b, a), sql=True)
         command.stamp(self.cfg, b, sql=True)
@@ -177,72 +144,57 @@ assert context.get_head_revisions() == ('%s', )
 
     def test_head_rev_post_context_multihead(self):
         d, e, f = multi_heads_fixture(self.cfg, a, b, c)
-        env_file_fixture(
-            """
+        env_file_fixture("""
 context.configure(dialect_name='sqlite')
 assert set(context.get_head_revisions()) == set(('%s', '%s', '%s', ))
-"""
-            % (e, f, c)
-        )
+""" % (e, f, c))
         command.upgrade(self.cfg, e, sql=True)
         command.downgrade(self.cfg, "%s:%s" % (e, b), sql=True)
         command.stamp(self.cfg, c, sql=True)
         command.current(self.cfg)
 
     def test_tag_pre_context(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 assert context.get_tag_argument() == 'hi'
-"""
-        )
+""")
         command.upgrade(self.cfg, b, sql=True, tag="hi")
         command.downgrade(self.cfg, "%s:%s" % (b, a), sql=True, tag="hi")
 
     def test_tag_pre_context_None(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 assert context.get_tag_argument() is None
-"""
-        )
+""")
         command.upgrade(self.cfg, b, sql=True)
         command.downgrade(self.cfg, "%s:%s" % (b, a), sql=True)
 
     def test_tag_cmd_arg(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 context.configure(dialect_name='sqlite')
 assert context.get_tag_argument() == 'hi'
-"""
-        )
+""")
         command.upgrade(self.cfg, b, sql=True, tag="hi")
         command.downgrade(self.cfg, "%s:%s" % (b, a), sql=True, tag="hi")
 
     def test_tag_cfg_arg(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 context.configure(dialect_name='sqlite', tag='there')
 assert context.get_tag_argument() == 'there'
-"""
-        )
+""")
         command.upgrade(self.cfg, b, sql=True, tag="hi")
         command.downgrade(self.cfg, "%s:%s" % (b, a), sql=True, tag="hi")
 
     def test_tag_None(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 context.configure(dialect_name='sqlite')
 assert context.get_tag_argument() is None
-"""
-        )
+""")
         command.upgrade(self.cfg, b, sql=True)
         command.downgrade(self.cfg, "%s:%s" % (b, a), sql=True)
 
     def test_downgrade_wo_colon(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 context.configure(dialect_name='sqlite')
-"""
-        )
+""")
         assert_raises_message(
             util.CommandError,
             "downgrade with --sql requires <fromrev>:<torev>",
@@ -253,13 +205,11 @@ context.configure(dialect_name='sqlite')
         )
 
     def test_upgrade_with_output_encoding(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 url = config.get_main_option('sqlalchemy.url')
 context.configure(url=url, output_encoding='utf-8')
 assert not context.requires_connection()
-"""
-        )
+""")
         command.upgrade(self.cfg, a, sql=True)
         command.downgrade(self.cfg, "%s:%s" % (b, a), sql=True)
 
@@ -275,44 +225,34 @@ assert not context.requires_connection()
         )
 
     def test_starting_rev_pre_context_abbreviated(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 assert context.get_starting_revision_argument() == '%s'
-"""
-            % b[0:4]
-        )
+""" % b[0:4])
         command.upgrade(self.cfg, "%s:%s" % (b[0:4], c), sql=True)
         command.stamp(self.cfg, "%s:%s" % (b[0:4], c), sql=True)
         command.downgrade(self.cfg, "%s:%s" % (b[0:4], a), sql=True)
 
     def test_destination_rev_pre_context_abbreviated(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 assert context.get_revision_argument() == '%s'
-"""
-            % b[0:4]
-        )
+""" % b[0:4])
         command.upgrade(self.cfg, "%s:%s" % (a, b[0:4]), sql=True)
         command.stamp(self.cfg, b[0:4], sql=True)
         command.downgrade(self.cfg, "%s:%s" % (c, b[0:4]), sql=True)
 
     def test_starting_rev_context_runs_abbreviated(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 context.configure(dialect_name='sqlite')
 context.run_migrations()
-"""
-        )
+""")
         command.upgrade(self.cfg, "%s:%s" % (b[0:4], c), sql=True)
         command.downgrade(self.cfg, "%s:%s" % (b[0:4], a), sql=True)
 
     def test_destination_rev_context_runs_abbreviated(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 context.configure(dialect_name='sqlite')
 context.run_migrations()
-"""
-        )
+""")
         command.upgrade(self.cfg, "%s:%s" % (a, b[0:4]), sql=True)
         command.stamp(self.cfg, b[0:4], sql=True)
         command.downgrade(self.cfg, "%s:%s" % (c, b[0:4]), sql=True)
index fe2afe97f5cb978dedddcaa1e1d5463ec9a79467..c1a5c17f4e7e1216baf6416a4a65e0e7cb8ef642 100644 (file)
@@ -63,8 +63,7 @@ class RunHookTest(TestBase):
                 )
             )
         else:
-            self.cfg = _no_sql_pyproject_config(
-                directives="""
+            self.cfg = _no_sql_pyproject_config(directives="""
 
                 [[tool.alembic.post_write_hooks]]
                 name="hook1"
@@ -75,8 +74,7 @@ class RunHookTest(TestBase):
                 name="hook2"
                 type="hook2"
                 arg1="bar"
-                """
-            )
+                """)
         rev = command.revision(self.cfg, message="x")
 
         eq_(
@@ -109,11 +107,9 @@ class RunHookTest(TestBase):
         if config.ini:
             self.cfg = _no_sql_testing_config(directives="")
         else:
-            self.cfg = _no_sql_pyproject_config(
-                directives="""
+            self.cfg = _no_sql_pyproject_config(directives="""
 
-                """
-            )
+                """)
 
         command.revision(self.cfg, message="x")
 
@@ -133,14 +129,12 @@ class RunHookTest(TestBase):
                 )
             )
         else:
-            self.cfg = _no_sql_pyproject_config(
-                directives="""
+            self.cfg = _no_sql_pyproject_config(directives="""
 
                 [[tool.alembic.post_write_hooks]]
                 name="foo"
                 bar="somebar"
-                """
-            )
+                """)
 
         assert_raises_message(
             util.CommandError,
@@ -480,15 +474,11 @@ ruff.cwd = /path/to/cwd
         )
 
     def test_module_config_missing(self):
-        self.cfg = _no_sql_testing_config(
-            directives=(
-                """
+        self.cfg = _no_sql_testing_config(directives=("""
 [post_write_hooks]
 hooks = ruff
 ruff.type = module
-                """
-            )
-        )
+                """))
         assert_raises_message(
             util.CommandError,
             "Key ruff.module is required for post write hook 'ruff'",
@@ -498,16 +488,12 @@ ruff.type = module
         )
 
     def test_module_not_found(self):
-        self.cfg = _no_sql_testing_config(
-            directives=(
-                """
+        self.cfg = _no_sql_testing_config(directives=("""
 [post_write_hooks]
 hooks = ruff
 ruff.type = module
 ruff.module = ruff_not_found
-                """
-            )
-        )
+                """))
         assert_raises_message(
             util.CommandError,
             "Could not find module ruff_not_found",
index d0304651dc1b36c4600b0388205f1eb3d5d3dac1..685b93beada96bc4f6b33c3bc10f0c0322d436c8 100644 (file)
@@ -64,7 +64,6 @@ from alembic.testing.fixtures import TablesTest
 from alembic.testing.fixtures import TestBase
 from alembic.testing.suite._autogen_fixtures import AutogenFixtureTest
 
-
 if True:
     from alembic.autogenerate.compare.server_defaults import (
         _render_server_default_for_compare,
@@ -559,8 +558,7 @@ def upgrade():
 
 def downgrade():
     op.drop_table("sometable")
-"""
-            % self.rid,
+""" % self.rid,
         )
 
     def _distinct_enum_script(self):
@@ -588,8 +586,7 @@ def downgrade():
     op.drop_table("sometable")
     ENUM(name="pgenum").drop(op.get_bind(), checkfirst=False)
 
-"""
-            % self.rid,
+""" % self.rid,
         )
 
     def test_offline_inline_enum_create(self):
@@ -638,16 +635,12 @@ class PostgresqlInlineLiteralTest(TablesTest):
 
     @classmethod
     def insert_data(cls, connection):
-        connection.execute(
-            text(
-                """
+        connection.execute(text("""
                 insert into tab (col) values
                     ('old data 1'),
                     ('old data 2.1'),
                     ('old data 3')
-            """
-            )
-        )
+            """))
 
     def test_inline_percent(self, connection, ops_context):
         # TODO: here's the issue, you need to escape this.
index 0ea6e471df6b4020addfd06da153a3a6eea47cce..0858ac2ade24d38711efa873cfd0c007e5441662 100644 (file)
@@ -187,8 +187,7 @@ class ApplyVersionsFunctionalTest(PatchEnvironment, TestBase):
     def downgrade():
         op.execute("DROP TABLE foo")
 
-    """
-            % a,
+    """ % a,
             sourceless=self.sourceless,
         )
 
@@ -210,8 +209,7 @@ class ApplyVersionsFunctionalTest(PatchEnvironment, TestBase):
     def downgrade():
         op.execute("DROP TABLE bar")
 
-    """
-            % (b, a),
+    """ % (b, a),
             sourceless=self.sourceless,
         )
 
@@ -233,8 +231,7 @@ class ApplyVersionsFunctionalTest(PatchEnvironment, TestBase):
     def downgrade():
         op.execute("DROP TABLE bat")
 
-    """
-            % (c, b),
+    """ % (c, b),
             sourceless=self.sourceless,
         )
 
@@ -325,9 +322,7 @@ class CallbackEnvironmentTest(ApplyVersionsFunctionalTest):
 
     @staticmethod
     def _env_file_fixture():
-        env_file_fixture(
-            textwrap.dedent(
-                """\
+        env_file_fixture(textwrap.dedent("""\
             import alembic
             from alembic import context
             from sqlalchemy import engine_from_config, pool
@@ -364,9 +359,7 @@ class CallbackEnvironmentTest(ApplyVersionsFunctionalTest):
                 run_migrations_offline()
             else:
                 run_migrations_online()
-            """
-            )
-        )
+            """))
 
     def test_steps(self):
         import alembic
@@ -483,8 +476,7 @@ def upgrade():
 def downgrade():
     pass
 
-"""
-            % (a,),
+""" % (a,),
         )
         script.generate_revision(b, "revision b", refresh=True)
         write_script(
@@ -508,8 +500,7 @@ def upgrade():
 def downgrade():
     pass
 
-"""
-            % (b, a),
+""" % (b, a),
         )
         script.generate_revision(c, "revision c", refresh=True)
         write_script(
@@ -530,8 +521,7 @@ def upgrade():
 def downgrade():
     pass
 
-"""
-            % (c, b),
+""" % (c, b),
         )
         return a, b, c
 
@@ -598,8 +588,7 @@ def downgrade():
     def test_noerr_transaction_opened_externally(self):
         a, b, c = self._opened_transaction_fixture()
 
-        env_file_fixture(
-            """
+        env_file_fixture("""
 from sqlalchemy import engine_from_config, pool
 
 def run_migrations_online():
@@ -621,8 +610,7 @@ def run_migrations_online():
 
 run_migrations_online()
 
-"""
-        )
+""")
 
         command.stamp(self.cfg, c)
 
@@ -650,8 +638,7 @@ class EncodingTest(TestBase):
         write_script(
             script,
             self.a,
-            (
-                """# coding: utf-8
+            ("""# coding: utf-8
 from __future__ import unicode_literals
 revision = '%s'
 down_revision = None
@@ -664,9 +651,7 @@ def upgrade():
 def downgrade():
     op.execute("drôle de petite voix m’a réveillé")
 
-"""
-                % self.a
-            ),
+""" % self.a),
             encoding="utf-8",
         )
 
@@ -711,8 +696,7 @@ class VersionNameTemplateTest(TestBase):
     def downgrade():
         op.execute("DROP TABLE foo")
 
-    """
-            % a,
+    """ % a,
         )
 
         script = ScriptDirectory.from_config(self.cfg)
@@ -757,8 +741,7 @@ class VersionNameTemplateTest(TestBase):
 
         path = script.get_revision(a).path
         with open(path, "w") as fp:
-            fp.write(
-                """
+            fp.write("""
 down_revision = None
 
 from alembic import op
@@ -771,8 +754,7 @@ def upgrade():
 def downgrade():
     op.execute("DROP TABLE foo")
 
-"""
-            )
+""")
         pyc_path = util.pyc_file_from_path(path)
         if pyc_path is not None and os.access(pyc_path, os.F_OK):
             os.unlink(pyc_path)
@@ -886,8 +868,7 @@ class SourcelessNeedsFlagTest(TestBase):
     def downgrade():
         op.execute("DROP TABLE foo")
 
-    """
-            % a,
+    """ % a,
             sourceless=True,
         )
 
index a9145773d04b58cc0c4059eebe0307e8818a8a5e..e14ace9100da3c19bfcaf8fcc325a09fe265a8dd 100644 (file)
@@ -560,8 +560,7 @@ def upgrade():
 def downgrade():
     pass
 
-"""
-                % (name, model, name),
+""" % (name, model, name),
             )
 
     def tearDown(self):
@@ -747,9 +746,7 @@ def downgrade():
 
         with open(rev.path) as handle:
             result = handle.read()
-        assert (
-            (
-                '''
+        assert ('''
 def upgrade() -> None:
     """Upgrade schema."""
     # ### commands auto generated by Alembic - please adjust! ###
@@ -759,10 +756,7 @@ def upgrade() -> None:
     sa.PrimaryKeyConstraint('id')
     )
     # ### end Alembic commands ###
-'''
-            )
-            in result
-        )
+''') in result
 
 
 class ScriptAccessorTest(TestBase):
@@ -880,8 +874,7 @@ class MultiContextTest(TestBase):
         clear_staging_env()
 
     def test_autogen(self):
-        self._write_metadata(
-            """
+        self._write_metadata("""
 import sqlalchemy as sa
 
 m1 = sa.MetaData()
@@ -893,8 +886,7 @@ sa.Table('e1t1', m1, sa.Column('x', sa.Integer))
 sa.Table('e2t1', m2, sa.Column('y', sa.Integer))
 sa.Table('e3t1', m3, sa.Column('z', sa.Integer))
 
-"""
-        )
+""")
 
         rev = command.revision(
             self.cfg, message="some message", autogenerate=True
@@ -1432,18 +1424,14 @@ class TemplateArgsTest(TestBase):
         eq_(template_args, {"x": "x1", "y": "y2", "z": "z1", "q": "q1"})
 
     def test_tmpl_args_revision(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 context.configure(dialect_name='sqlite', template_args={"somearg":"somevalue"})
-"""
-        )
-        script_file_fixture(
-            """
+""")
+        script_file_fixture("""
 # somearg: ${somearg}
 revision = ${repr(up_revision)}
 down_revision = ${repr(down_revision)}
-"""
-        )
+""")
 
         command.revision(self.cfg, message="some rev")
         script = ScriptDirectory.from_config(self.cfg)
@@ -1454,16 +1442,12 @@ down_revision = ${repr(down_revision)}
         assert "somearg: somevalue" in text
 
     def test_bad_render(self):
-        env_file_fixture(
-            """
+        env_file_fixture("""
 context.configure(dialect_name='sqlite', template_args={"somearg":"somevalue"})
-"""
-        )
-        script_file_fixture(
-            """
+""")
+        script_file_fixture("""
     <% z = x + y %>
-"""
-        )
+""")
 
         try:
             command.revision(self.cfg, message="some rev")
@@ -1524,8 +1508,7 @@ def upgrade():
 def downgrade():
     pass
 
-"""
-                % (name, model, name),
+""" % (name, model, name),
             )
 
     def tearDown(self):
index bd32b38386081318f0855acbde498af24a84f42b..7a30598fd004e42f3addafbf6568223f29844694 100644 (file)
@@ -272,15 +272,13 @@ def _generate_stub_for_meth(
 
     suffix = "..." if file_info.AddEllipsis and docs else ""
 
-    func_text = textwrap.dedent(
-        f"""
+    func_text = textwrap.dedent(f"""
     {overload}
     {contextmanager}
     def {name}{argspec}: {"..." if not docs else ""}
         {docs}
         {suffix}
-    """
-    )
+    """)
 
     return func_text