From: Mike Bayer Date: Fri, 20 Dec 2024 23:02:37 +0000 (-0500) Subject: update for mypy 1.14 X-Git-Tag: rel_2_0_37~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e660ae98dbaa7ceba349ffdb69f60b2181a2dc5;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git update for mypy 1.14 Change-Id: I7315c06314ed25c2c00f56b2883f97f4489e433c (cherry picked from commit b39afd5008bef95a8c2c30eada1e22ef6a286670) --- diff --git a/lib/sqlalchemy/ext/horizontal_shard.py b/lib/sqlalchemy/ext/horizontal_shard.py index 1d7b3f3580..56242c478f 100644 --- a/lib/sqlalchemy/ext/horizontal_shard.py +++ b/lib/sqlalchemy/ext/horizontal_shard.py @@ -318,7 +318,7 @@ class ShardedSession(Session): state.identity_token = shard_id return shard_id - def connection_callable( # type: ignore [override] + def connection_callable( self, mapper: Optional[Mapper[_T]] = None, instance: Optional[Any] = None, diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py index f8ce45100e..abaa22e448 100644 --- a/lib/sqlalchemy/orm/session.py +++ b/lib/sqlalchemy/orm/session.py @@ -1773,7 +1773,7 @@ class Session(_SessionClassMethods, EventTarget): # the idea is that at some point NO_ARG will warn that in the future # the default will switch to close_resets_only=False. - if close_resets_only or close_resets_only is _NoArg.NO_ARG: + if close_resets_only in (True, _NoArg.NO_ARG): self._close_state = _SessionCloseState.CLOSE_IS_RESET else: self._close_state = _SessionCloseState.ACTIVE diff --git a/tox.ini b/tox.ini index 62d29be43a..e8229efde6 100644 --- a/tox.ini +++ b/tox.ini @@ -191,7 +191,7 @@ commands= deps= greenlet != 0.4.17 importlib_metadata; python_version < '3.8' - mypy >= 1.6.0 + mypy >= 1.14.0 types-greenlet commands = mypy {env:MYPY_COLOR} ./lib/sqlalchemy