From 91501e06a17d873902114275d7149ba24973db6a Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 8 Dec 2021 20:27:16 -0500 Subject: factor out UnboundLoad and rearchitect strategy_options.py The architecture of Load is mostly rewritten here. The change includes removal of the "pluggable" aspect of the loader options, which would patch new methods onto Load. This has been replaced by normal methods that respond normally to typing annotations. As part of this change, the bake_loaders() and unbake_loaders() options, which have no effect since 1.4 and were unlikely to be in any common use, have been removed. Additionally, to support annotations for methods that make use of @decorator, @generative etc., modified format_argspec_plus to no longer return "args", instead returns "grouped_args" which is always grouped and allows return annotations to format correctly. Fixes: #6986 Change-Id: I6117c642345cdde65a64389bba6057ddd5374427 --- lib/sqlalchemy/sql/base.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/sqlalchemy/sql/base.py') diff --git a/lib/sqlalchemy/sql/base.py b/lib/sqlalchemy/sql/base.py index 4165751ca..65afc57dd 100644 --- a/lib/sqlalchemy/sql/base.py +++ b/lib/sqlalchemy/sql/base.py @@ -109,7 +109,9 @@ def _generative(fn): self = self._generate() x = fn(self, *args, **kw) - assert x is None, "generative methods must have no return value" + assert ( + x is None or x is self + ), "generative methods must return None or self" return self decorated = _generative(fn) @@ -835,7 +837,7 @@ class Executable(roles.StatementRole, Generative): For background on specific kinds of options for specific kinds of statements, refer to the documentation for those option objects. - .. versionchanged:: 1.4 - added :meth:`.Generative.options` to + .. versionchanged:: 1.4 - added :meth:`.Executable.options` to Core statement objects towards the goal of allowing unified Core / ORM querying capabilities. -- cgit v1.2.1