]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
update black to 25.1.0 to align it with alembic
authorFederico Caselli <cfederico87@gmail.com>
Tue, 20 May 2025 20:15:06 +0000 (22:15 +0200)
committerFederico Caselli <cfederico87@gmail.com>
Fri, 23 May 2025 20:42:38 +0000 (22:42 +0200)
Change-Id: I2ac332237f18bbc44155eadee35c64f62adc2867

34 files changed:
.pre-commit-config.yaml
examples/dogpile_caching/helloworld.py
examples/dynamic_dict/__init__.py
examples/nested_sets/__init__.py
lib/sqlalchemy/engine/base.py
lib/sqlalchemy/engine/strategies.py
lib/sqlalchemy/event/api.py
lib/sqlalchemy/ext/asyncio/base.py
lib/sqlalchemy/ext/asyncio/engine.py
lib/sqlalchemy/orm/base.py
lib/sqlalchemy/orm/decl_base.py
lib/sqlalchemy/orm/dependency.py
lib/sqlalchemy/orm/events.py
lib/sqlalchemy/orm/path_registry.py
lib/sqlalchemy/orm/state_changes.py
lib/sqlalchemy/orm/strategies.py
lib/sqlalchemy/pool/base.py
lib/sqlalchemy/pool/impl.py
lib/sqlalchemy/schema.py
lib/sqlalchemy/sql/_typing.py
lib/sqlalchemy/sql/base.py
lib/sqlalchemy/sql/expression.py
lib/sqlalchemy/sql/naming.py
lib/sqlalchemy/sql/sqltypes.py
lib/sqlalchemy/sql/type_api.py
lib/sqlalchemy/sql/util.py
lib/sqlalchemy/sql/visitors.py
lib/sqlalchemy/types.py
test/ext/test_horizontal_shard.py
test/ext/test_orderinglist.py
test/orm/inheritance/test_assorted_poly.py
test/typing/plain_files/orm/relationship.py
test/typing/plain_files/orm/trad_relationship_uselist.py
tox.ini

index 35e10ee29d20901eb5d298d4855bc11b763d7a3c..c7d225e1ae07f180573ae40a0b6a7fff135d3edd 100644 (file)
@@ -2,7 +2,7 @@
 # See https://pre-commit.com/hooks.html for more hooks
 repos:
 -   repo: https://github.com/python/black
-    rev: 24.10.0
+    rev: 25.1.0
     hooks:
     -   id: black
 
@@ -12,7 +12,7 @@ repos:
     -   id: zimports
 
 -   repo: https://github.com/pycqa/flake8
-    rev: 6.1.0
+    rev: 7.2.0
     hooks:
     -   id: flake8
         additional_dependencies:
@@ -37,4 +37,4 @@ repos:
         types: [rst]
         exclude: README.*
         additional_dependencies:
-            - black==24.10.0
+            - black==25.1.0
index 01934c59fab943b26d72be034c7f0b2e08dea2bf..df1c2a318ef6e2eb7747e40ea44dd2a490688a69 100644 (file)
@@ -1,6 +1,4 @@
-"""Illustrate how to load some data, and cache the results.
-
-"""
+"""Illustrate how to load some data, and cache the results."""
 
 from sqlalchemy import select
 from .caching_query import FromCache
index ed31df062fb66bfcf12d95beab57dbd0d31ba47d..c1d52d3c4307084c85ceb6c95e912dd6571e7a0d 100644 (file)
@@ -1,4 +1,4 @@
-""" Illustrates how to place a dictionary-like facade on top of a
+"""Illustrates how to place a dictionary-like facade on top of a
 "dynamic" relation, so that dictionary operations (assuming simple
 string keys) can operate upon a large collection without loading the
 full collection at once.
index 5fdfbcedc08646437e80d786c81816ab533699c5..cacab411b9a982a204916ee1778409b4dfa80ae0 100644 (file)
@@ -1,4 +1,4 @@
-""" Illustrates a rudimentary way to implement the "nested sets"
+"""Illustrates a rudimentary way to implement the "nested sets"
 pattern for hierarchical data using the SQLAlchemy ORM.
 
 .. autosource::
index 5e562bcb1384bfa8419d7c315e2a0404c093aae5..49da1083a8a2344b691c8a11f25d8193e53d28df 100644 (file)
@@ -4,9 +4,7 @@
 #
 # This module is part of SQLAlchemy and is released under
 # the MIT License: https://www.opensource.org/licenses/mit-license.php
-"""Defines :class:`_engine.Connection` and :class:`_engine.Engine`.
-
-"""
+"""Defines :class:`_engine.Connection` and :class:`_engine.Engine`."""
 from __future__ import annotations
 
 import contextlib
index 5dd7bca9a49e9a8d77766633b79bbeb97917abea..b4b8077ba05752331186d8d35def7764e345b3a0 100644 (file)
@@ -5,10 +5,7 @@
 # This module is part of SQLAlchemy and is released under
 # the MIT License: https://www.opensource.org/licenses/mit-license.php
 
-"""Deprecated mock engine strategy used by Alembic.
-
-
-"""
+"""Deprecated mock engine strategy used by Alembic."""
 
 from __future__ import annotations
 
index b6ec8f6d32bef28850b904c149b2cc795e3ea9a9..01dd4bdd1bfe40217f86b0113114642d7431677f 100644 (file)
@@ -5,9 +5,7 @@
 # This module is part of SQLAlchemy and is released under
 # the MIT License: https://www.opensource.org/licenses/mit-license.php
 
-"""Public API functions for the event system.
-
-"""
+"""Public API functions for the event system."""
 from __future__ import annotations
 
 from typing import Any
index ce2c439f1609670f4ac0b010c7be129b99b33db3..72a617f4e227784884609eb0b03e7e9657a6714f 100644 (file)
@@ -215,7 +215,7 @@ class GeneratorStartableContext(StartableContext[_T_co]):
 
 
 def asyncstartablecontext(
-    func: Callable[..., AsyncIterator[_T_co]]
+    func: Callable[..., AsyncIterator[_T_co]],
 ) -> Callable[..., GeneratorStartableContext[_T_co]]:
     """@asyncstartablecontext decorator.
 
index bf3cae63493bd4405ec67a2f41fabcff820f27ab..a33911321003dd53e083e66f1b77110f8e6ef76b 100644 (file)
@@ -1433,7 +1433,7 @@ def _get_sync_engine_or_connection(
 
 
 def _get_sync_engine_or_connection(
-    async_engine: Union[AsyncEngine, AsyncConnection]
+    async_engine: Union[AsyncEngine, AsyncConnection],
 ) -> Union[Engine, Connection]:
     if isinstance(async_engine, AsyncConnection):
         return async_engine._proxied
index aff2b23ae22ec366bb254c32c6112e93fbceba35..c53ba4434582565b9e1d2e0412037a18e144ab9b 100644 (file)
@@ -5,9 +5,7 @@
 # This module is part of SQLAlchemy and is released under
 # the MIT License: https://www.opensource.org/licenses/mit-license.php
 
-"""Constants and rudimental functions used throughout the ORM.
-
-"""
+"""Constants and rudimental functions used throughout the ORM."""
 
 from __future__ import annotations
 
@@ -438,7 +436,7 @@ def _inspect_mapped_object(instance: _T) -> Optional[InstanceState[_T]]:
 
 
 def _class_to_mapper(
-    class_or_mapper: Union[Mapper[_T], Type[_T]]
+    class_or_mapper: Union[Mapper[_T], Type[_T]],
 ) -> Mapper[_T]:
     # can't get mypy to see an overload for this
     insp = inspection.inspect(class_or_mapper, False)
@@ -450,7 +448,7 @@ def _class_to_mapper(
 
 
 def _mapper_or_none(
-    entity: Union[Type[_T], _InternalEntityType[_T]]
+    entity: Union[Type[_T], _InternalEntityType[_T]],
 ) -> Optional[Mapper[_T]]:
     """Return the :class:`_orm.Mapper` for the given class or None if the
     class is not mapped.
index 55f5236ce3c32391556ebbee21d89fa19efaf690..d1b6e74b03c854c61e39b29d453e25a158d4bbc0 100644 (file)
@@ -103,6 +103,7 @@ class MappedClassProtocol(Protocol[_O]):
 
 class _DeclMappedClassProtocol(MappedClassProtocol[_O], Protocol):
     "Internal more detailed version of ``MappedClassProtocol``."
+
     metadata: MetaData
     __tablename__: str
     __mapper_args__: _MapperKwArgs
index 288d74f1c853098c57d19457791f5049e0387cae..15c3a348182d877461960880b2cb65dc10429016 100644 (file)
@@ -7,9 +7,7 @@
 # mypy: ignore-errors
 
 
-"""Relationship dependencies.
-
-"""
+"""Relationship dependencies."""
 
 from __future__ import annotations
 
index e478c9ed656b445c6efa98c061018d7b2f656f53..53429139d87b286c73e2e40005f82c90367912f7 100644 (file)
@@ -5,9 +5,7 @@
 # This module is part of SQLAlchemy and is released under
 # the MIT License: https://www.opensource.org/licenses/mit-license.php
 
-"""ORM event interfaces.
-
-"""
+"""ORM event interfaces."""
 from __future__ import annotations
 
 from typing import Any
@@ -1574,7 +1572,7 @@ class SessionEvents(event.Events[Session]):
     _dispatch_target = Session
 
     def _lifecycle_event(  # type: ignore [misc]
-        fn: Callable[[SessionEvents, Session, Any], None]
+        fn: Callable[[SessionEvents, Session, Any], None],
     ) -> Callable[[SessionEvents, Session, Any], None]:
         _sessionevents_lifecycle_event_names.add(fn.__name__)
         return fn
index aa1363ad826ccd7c162beb3a5e556d74ae914d6b..d9e02268632633b46c426d4f831273de20fb69eb 100644 (file)
@@ -4,9 +4,7 @@
 #
 # This module is part of SQLAlchemy and is released under
 # the MIT License: https://www.opensource.org/licenses/mit-license.php
-"""Path tracking utilities, representing mapper graph traversals.
-
-"""
+"""Path tracking utilities, representing mapper graph traversals."""
 
 from __future__ import annotations
 
index 10e417e85d19ea02f3df4fad73c84bb9a3cc7736..a79874e1c7a0341c21340fb6eb5e5fbb0cf2dbf2 100644 (file)
@@ -5,9 +5,7 @@
 # This module is part of SQLAlchemy and is released under
 # the MIT License: https://www.opensource.org/licenses/mit-license.php
 
-"""State tracking utilities used by :class:`_orm.Session`.
-
-"""
+"""State tracking utilities used by :class:`_orm.Session`."""
 
 from __future__ import annotations
 
index 2a226788706e019085ab4814a90d702d4e866004..8e67973e4baec966102c168d0c93b8dabbd4ce24 100644 (file)
@@ -8,7 +8,7 @@
 
 
 """sqlalchemy.orm.interfaces.LoaderStrategy
-   implementations, and related MapperOptions."""
+implementations, and related MapperOptions."""
 
 from __future__ import annotations
 
index 7c051f12afc9e151d0e55f370c5289394d28e4d0..e25e000f01f9306be91b66d348d4515b0e282b1f 100644 (file)
@@ -6,9 +6,7 @@
 # the MIT License: https://www.opensource.org/licenses/mit-license.php
 
 
-"""Base constructs for connection pools.
-
-"""
+"""Base constructs for connection pools."""
 
 from __future__ import annotations
 
index 1355ca8e1caef9ef134c35115dd874d1852fb362..0bfcb6e7d3cbdcebc629268243a843baa948b5c4 100644 (file)
@@ -6,9 +6,7 @@
 # the MIT License: https://www.opensource.org/licenses/mit-license.php
 
 
-"""Pool implementation classes.
-
-"""
+"""Pool implementation classes."""
 from __future__ import annotations
 
 import threading
index 16f7ec37b3c539aa6ef8a9760658f59f78874eea..56b90ec99e84b219423df539d031d3dd39c7f92f 100644 (file)
@@ -5,9 +5,7 @@
 # This module is part of SQLAlchemy and is released under
 # the MIT License: https://www.opensource.org/licenses/mit-license.php
 
-"""Compatibility namespace for sqlalchemy.sql.schema and related.
-
-"""
+"""Compatibility namespace for sqlalchemy.sql.schema and related."""
 
 from __future__ import annotations
 
index eb5d09ec2dac8fe56aef38fe48ac1701c353e1d8..14769dde17abf9b45ebac9f0b24e1eef91d066bc 100644 (file)
@@ -340,11 +340,11 @@ if TYPE_CHECKING:
     def is_selectable(t: Any) -> TypeGuard[Selectable]: ...
 
     def is_select_base(
-        t: Union[Executable, ReturnsRows]
+        t: Union[Executable, ReturnsRows],
     ) -> TypeGuard[SelectBase]: ...
 
     def is_select_statement(
-        t: Union[Executable, ReturnsRows]
+        t: Union[Executable, ReturnsRows],
     ) -> TypeGuard[Select[Unpack[TupleAny]]]: ...
 
     def is_table(t: FromClause) -> TypeGuard[TableClause]: ...
index e4279964a05ad5305f03cdacd4de8c378419816c..fe6cdf6a07b7cd2a69c0f206fde801c2a22cb221 100644 (file)
@@ -6,9 +6,7 @@
 # the MIT License: https://www.opensource.org/licenses/mit-license.php
 # mypy: allow-untyped-defs, allow-untyped-calls
 
-"""Foundational utilities common to many sql modules.
-
-"""
+"""Foundational utilities common to many sql modules."""
 
 
 from __future__ import annotations
@@ -2368,7 +2366,7 @@ class ColumnSet(util.OrderedSet["ColumnClause[Any]"]):
 
 
 def _entity_namespace(
-    entity: Union[_HasEntityNamespace, ExternallyTraversible]
+    entity: Union[_HasEntityNamespace, ExternallyTraversible],
 ) -> _EntityNamespace:
     """Return the nearest .entity_namespace for the given entity.
 
index f8ac3a9ecad8064bd26f2200b6836cb726bc6044..dc7dee13b12821e29f3216f9e0721e96d8a078d5 100644 (file)
@@ -5,10 +5,7 @@
 # This module is part of SQLAlchemy and is released under
 # the MIT License: https://www.opensource.org/licenses/mit-license.php
 
-"""Defines the public namespace for SQL expression constructs.
-
-
-"""
+"""Defines the public namespace for SQL expression constructs."""
 
 
 from __future__ import annotations
index 58203e4b9a1d59155c815f244a985f54bf9c954b..ce68acf15b9b1e56b327ba16f4aab6e1742db3fb 100644 (file)
@@ -6,10 +6,7 @@
 # the MIT License: https://www.opensource.org/licenses/mit-license.php
 # mypy: allow-untyped-defs, allow-untyped-calls
 
-"""Establish constraint and index naming conventions.
-
-
-"""
+"""Establish constraint and index naming conventions."""
 
 from __future__ import annotations
 
index 90c93bcef1bb69f1789ebfeccd44cfddc01ecb37..7582df72f9c936414a56d80a4e925dec06e807b5 100644 (file)
@@ -6,9 +6,7 @@
 # the MIT License: https://www.opensource.org/licenses/mit-license.php
 # mypy: allow-untyped-defs, allow-untyped-calls
 
-"""SQL specific types.
-
-"""
+"""SQL specific types."""
 from __future__ import annotations
 
 import collections.abc as collections_abc
index becd500d5d4971081e7ab8b4941133797abbb3e3..890214e2e4d84be96974dfd628cc5e111b210d04 100644 (file)
@@ -5,9 +5,7 @@
 # This module is part of SQLAlchemy and is released under
 # the MIT License: https://www.opensource.org/licenses/mit-license.php
 
-"""Base types API.
-
-"""
+"""Base types API."""
 
 from __future__ import annotations
 
index a98b51c1dee5d8ae7312356d69a33ef1084cfbc2..7dda0a12b9af231afd58c94921fd295b34e3a8d3 100644 (file)
@@ -6,9 +6,7 @@
 # the MIT License: https://www.opensource.org/licenses/mit-license.php
 # mypy: allow-untyped-defs, allow-untyped-calls
 
-"""High level utilities which build upon other modules here.
-
-"""
+"""High level utilities which build upon other modules here."""
 from __future__ import annotations
 
 from collections import deque
index 34ac84953bcb875b22f8b264403bf9b21d9b35f8..a5cf585ba42db585fbd21cf45ce5ff04a7ce6c36 100644 (file)
@@ -5,10 +5,7 @@
 # This module is part of SQLAlchemy and is released under
 # the MIT License: https://www.opensource.org/licenses/mit-license.php
 
-"""Visitor/traversal interface and library functions.
-
-
-"""
+"""Visitor/traversal interface and library functions."""
 
 from __future__ import annotations
 
index e0a4e356b6d2a87355b133510a3641b1b1dca8bb..c803bc9d91e59b3260efcd72bcd9d3a12f46add7 100644 (file)
@@ -5,9 +5,7 @@
 # This module is part of SQLAlchemy and is released under
 # the MIT License: https://www.opensource.org/licenses/mit-license.php
 
-"""Compatibility namespace for sqlalchemy.sql.types.
-
-"""
+"""Compatibility namespace for sqlalchemy.sql.types."""
 
 
 from __future__ import annotations
index 8215c44e5d09bad5a268274ec9892bcec7a41bed..485fce795ce39825f8ff8286120239aacdd435f7 100644 (file)
@@ -51,7 +51,7 @@ class ShardTest:
 
     @classmethod
     def define_tables(cls, metadata):
-        global db1, db2, db3, db4, weather_locations, weather_reports
+        global weather_locations
 
         cls.tables.ids = ids = Table(
             "ids", metadata, Column("nextid", Integer, nullable=False)
index 90c7f385789c3f3b617801c190fa51e8d2d0c2c0..98e2a8207f9cb9bb3a07fc7346045d164da4ce5c 100644 (file)
@@ -70,7 +70,7 @@ class OrderingListTest(fixtures.MappedTest):
         """Build a relationship situation using the given
         test_collection_class factory"""
 
-        global metadata, slides_table, bullets_table, Slide, Bullet
+        global slides_table, bullets_table, Slide, Bullet
 
         slides_table = Table(
             "test_Slides",
index 2b15b74251a4403466fcb9df738e1cb6520e6918..ea8be8d3769da33f9ca194120c67b6c904aec396 100644 (file)
@@ -820,7 +820,7 @@ class RelationshipTest6(fixtures.MappedTest):
 
     @classmethod
     def define_tables(cls, metadata):
-        global people, managers, data
+        global people, managers
         people = Table(
             "people",
             metadata,
index 44090ad53b4ea5d7a6fba4a5be41a8751c9ee64a..a972e23b83e84994c049fe467b55fcd95ce58261 100644 (file)
@@ -1,6 +1,4 @@
-"""this suite experiments with other kinds of relationship syntaxes.
-
-"""
+"""this suite experiments with other kinds of relationship syntaxes."""
 
 from __future__ import annotations
 
index 9282181f01bd4dd1dfeb11e940552164cf2aa0db..e15fe709341904fe19aee819adca2b3c0a1bbdbb 100644 (file)
@@ -1,7 +1,4 @@
-"""traditional relationship patterns with explicit uselist.
-
-
-"""
+"""traditional relationship patterns with explicit uselist."""
 
 import typing
 from typing import cast
diff --git a/tox.ini b/tox.ini
index cf0e9d2bd779d5b0ca5d45f53a8094c24a5294e1..3012ec874853d8a28fc40e5834b2c7d0b00b4ded 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -235,7 +235,7 @@ extras=
      {[greenletextras]extras}
 
 deps=
-      flake8==6.1.0
+      flake8==7.2.0
       flake8-import-order
       flake8-builtins
       flake8-future-annotations>=0.0.5
@@ -247,7 +247,7 @@ deps=
       # in case it requires a version pin
       pydocstyle
       pygments
-      black==24.10.0
+      black==25.1.0
       slotscheck>=0.17.0
 
       # required by generate_tuple_map_overloads