# 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
- id: zimports
- repo: https://github.com/pycqa/flake8
- rev: 6.1.0
+ rev: 7.2.0
hooks:
- id: flake8
additional_dependencies:
types: [rst]
exclude: README.*
additional_dependencies:
- - black==24.10.0
+ - black==25.1.0
-"""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
-""" 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.
-""" 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::
#
# 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
# 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
# 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
def asyncstartablecontext(
- func: Callable[..., AsyncIterator[_T_co]]
+ func: Callable[..., AsyncIterator[_T_co]],
) -> Callable[..., GeneratorStartableContext[_T_co]]:
"""@asyncstartablecontext decorator.
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
# 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
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)
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.
class _DeclMappedClassProtocol(MappedClassProtocol[_O], Protocol):
"Internal more detailed version of ``MappedClassProtocol``."
+
metadata: MetaData
__tablename__: str
__mapper_args__: _MapperKwArgs
# mypy: ignore-errors
-"""Relationship dependencies.
-
-"""
+"""Relationship dependencies."""
from __future__ import annotations
# 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
_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
#
# 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
# 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
"""sqlalchemy.orm.interfaces.LoaderStrategy
- implementations, and related MapperOptions."""
+implementations, and related MapperOptions."""
from __future__ import annotations
# 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
# the MIT License: https://www.opensource.org/licenses/mit-license.php
-"""Pool implementation classes.
-
-"""
+"""Pool implementation classes."""
from __future__ import annotations
import threading
# 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
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]: ...
# 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
def _entity_namespace(
- entity: Union[_HasEntityNamespace, ExternallyTraversible]
+ entity: Union[_HasEntityNamespace, ExternallyTraversible],
) -> _EntityNamespace:
"""Return the nearest .entity_namespace for the given entity.
# 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
# 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
# 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
# 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
# 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
# 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
# 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
@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)
"""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",
@classmethod
def define_tables(cls, metadata):
- global people, managers, data
+ global people, managers
people = Table(
"people",
metadata,
-"""this suite experiments with other kinds of relationship syntaxes.
-
-"""
+"""this suite experiments with other kinds of relationship syntaxes."""
from __future__ import annotations
-"""traditional relationship patterns with explicit uselist.
-
-
-"""
+"""traditional relationship patterns with explicit uselist."""
import typing
from typing import cast
{[greenletextras]extras}
deps=
- flake8==6.1.0
+ flake8==7.2.0
flake8-import-order
flake8-builtins
flake8-future-annotations>=0.0.5
# 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