11from typing import Any
22from typing import Optional
3+ from typing import Type
4+ from typing import TypeVar
35
4- from .attributes import QueryableAttribute as QueryableAttribute
5- from .base import InspectionAttr as InspectionAttr
6- from .interfaces import LoaderOption as LoaderOption
7- from .interfaces import MapperProperty as MapperProperty
8- from .interfaces import PropComparator as PropComparator
9- from .path_registry import PathRegistry as PathRegistry
10- from .path_registry import TokenRegistry as TokenRegistry
11- from .. import inspect as inspect
12- from .. import util as util
13- from ..sql import coercions as coercions
14- from ..sql import roles as roles
15- from ..sql import visitors as visitors
16- from ..sql .base import Generative as Generative
6+ from .interfaces import LoaderOption
7+ from ..sql .base import Generative
8+
9+ _L = TypeVar ("_L" , bound = Load )
10+ _LO = TypeVar ("_LO" , bound = loader_option )
1711
1812class Load (Generative , LoaderOption ):
1913 path : Any = ...
@@ -22,24 +16,43 @@ class Load(Generative, LoaderOption):
2216 is_class_strategy : bool = ...
2317 def __init__ (self , entity : Any ) -> None : ...
2418 @classmethod
25- def for_existing_path (cls , path : Any ): ...
19+ def for_existing_path (cls : Type [ _L ] , path : Any ) -> _L : ...
2620 is_opts_only : bool = ...
2721 strategy : Any = ...
2822 propagate_to_loaders : bool = ...
2923 def process_compile_state (self , compile_state : Any ) -> None : ...
30- def options (self , * opts : Any ) -> None : ...
24+ def options (self : _L , * opts : Any ) -> _L : ...
3125 def set_relationship_strategy (
32- self , attr : Any , strategy : Any , propagate_to_loaders : bool = ...
33- ) -> None : ...
26+ self : _L , attr : Any , strategy : Any , propagate_to_loaders : bool = ...
27+ ) -> _L : ...
3428 def set_column_strategy (
35- self ,
29+ self : _L ,
3630 attrs : Any ,
3731 strategy : Any ,
3832 opts : Optional [Any ] = ...,
3933 opts_only : bool = ...,
40- ) -> None : ...
41- def set_generic_strategy (self , attrs : Any , strategy : Any ) -> None : ...
42- def set_class_strategy (self , strategy : Any , opts : Any ) -> None : ...
34+ ) -> _L : ...
35+ def set_generic_strategy (self : _L , attrs : Any , strategy : Any ) -> _L : ...
36+ def set_class_strategy (self : _L , strategy : Any , opts : Any ) -> _L : ...
37+ def contains_eager (
38+ loadopt : _L , attr : Any , alias : Optional [Any ] = ...
39+ ) -> _L : ...
40+ def load_only (loadopt : _L , * attrs : Any ) -> _L : ...
41+ def joinedload (
42+ loadopt : _L , attr : Any , innerjoin : Optional [bool ] = ...
43+ ) -> _L : ...
44+ def subqueryload (loadopt : _L , attr : Any ) -> _L : ...
45+ def selectinload (loadopt : _L , attr : Any ) -> _L : ...
46+ def lazyload (loadopt : _L , attr : Any ) -> _L : ...
47+ def immediateload (loadopt : _L , attr : Any ) -> _L : ...
48+ def noload (loadopt : _L , attr : Any ) -> _L : ...
49+ def raiseload (loadopt : _L , attr : Any , sql_only : bool = ...) -> _L : ...
50+ def defaultload (loadopt : _L , attr : Any ) -> _L : ...
51+ def defer (loadopt : _L , key : str , raiseload : bool = ...) -> _L : ...
52+ def undefer (loadopt : _L , key : str ) -> _L : ...
53+ def undefer_group (loadopt : _L , name : str ) -> _L : ...
54+ def with_expression (loadopt : _L , key : Any , expression : Any ) -> _L : ...
55+ def selectin_polymorphic (loadopt : _L , classes : Any ) -> _L : ...
4356
4457class _UnboundLoad (Load ):
4558 path : Any = ...
@@ -49,5 +62,88 @@ class _UnboundLoad(Load):
4962class loader_option :
5063 def __init__ (self ) -> None : ...
5164 name : Any = ...
52- fn : Any = ...
53- def __call__ (self , fn : Any ): ...
65+ def __call__ (self : _LO , fn : Any ) -> _LO : ...
66+
67+ class _containseager_loader_option (loader_option ):
68+ def fn (self , loadopt : _L , attr : Any , alias : Optional [Any ] = ...) -> _L : ...
69+ def _unbound_fn (
70+ self , attr : Any , alias : Optional [Any ] = ...
71+ ) -> _UnboundLoad : ...
72+
73+ class _load_only_loader_option (loader_option ):
74+ def fn (self , loadopt : _L , * attrs : Any ) -> _L : ...
75+ def _unbound_fn (self , * attrs : Any ) -> _UnboundLoad : ...
76+
77+ class _joinedload_loader_option (loader_option ):
78+ def fn (
79+ self , loadopt : _L , attr : Any , innerjoin : Optional [bool ] = ...
80+ ) -> _L : ...
81+ def _unbound_fn (
82+ self , attr : Any , innerjoin : Optional [bool ] = ...
83+ ) -> _UnboundLoad : ...
84+
85+ class _subqueryload_loader_option (loader_option ):
86+ def fn (self , loadopt : _L , attr : Any ) -> _L : ...
87+ def _unbound_fn (self , attr : Any ) -> _UnboundLoad : ...
88+
89+ class _selectinload_loader_option (loader_option ):
90+ def fn (self , loadopt : _L , attr : Any ) -> _L : ...
91+ def _unbound_fn (self , attr : Any ) -> _UnboundLoad : ...
92+
93+ class _lazyload_loader_option (loader_option ):
94+ def fn (self , loadopt : _L , attr : Any ) -> _L : ...
95+ def _unbound_fn (self , attr : Any ) -> _UnboundLoad : ...
96+
97+ class _immediateload_loader_option (loader_option ):
98+ def fn (self , loadopt : _L , attr : Any ) -> _L : ...
99+ def _unbound_fn (self , attr : Any ) -> _UnboundLoad : ...
100+
101+ class _noload_loader_option (loader_option ):
102+ def fn (self , loadopt : _L , attr : Any ) -> _L : ...
103+ def _unbound_fn (self , attr : Any ) -> _UnboundLoad : ...
104+
105+ class _raiseload_loader_option (loader_option ):
106+ def fn (self , loadopt : _L , attr : Any , sql_only : bool = ...) -> _L : ...
107+ def _unbound_fn (self , attr : Any , sql_only : bool = ...) -> _UnboundLoad : ...
108+
109+ class _defaultload_loader_option (loader_option ):
110+ def fn (self , loadopt : _L , attr : Any ) -> _L : ...
111+ def _unbound_fn (self , attr : Any ) -> _UnboundLoad : ...
112+
113+ class _defer_loader_option (loader_option ):
114+ def fn (self , loadopt : _L , key : str , raiseload : bool = ...) -> _L : ...
115+ def _unbound_fn (self , key : str , raiseload : bool = ...) -> _UnboundLoad : ...
116+
117+ class _undefer_loader_option (loader_option ):
118+ def fn (self , loadopt : _L , key : str ) -> _L : ...
119+ def _unbound_fn (self , key : str ) -> _UnboundLoad : ...
120+
121+ class _undefer_group_loader_option (loader_option ):
122+ def fn (self , loadopt : _L , name : str ) -> _L : ...
123+ def _unbound_fn (self , name : str ) -> _UnboundLoad : ...
124+
125+ class _with_expression_loader_option (loader_option ):
126+ def fn (self , loadopt : _L , key : Any , expression : Any ) -> _L : ...
127+ def _unbound_fn (
128+ self , loadopt : _L , key : Any , expression : Any
129+ ) -> _UnboundLoad : ...
130+
131+ class _selectin_polymorphic_loader_option (loader_option ):
132+ def fn (self , loadopt : _L , classes : Any ) -> _L : ...
133+ def _unbound_fn (self , classes : Any ) -> _UnboundLoad : ...
134+
135+ contains_eager : _containseager_loader_option
136+ load_only : _load_only_loader_option
137+ joinedload : _joinedload_loader_option
138+ subqueryload : _subqueryload_loader_option
139+ selectinload : _selectinload_loader_option
140+ lazyload : _lazyload_loader_option
141+ immediateload : _immediateload_loader_option
142+ noload : _noload_loader_option
143+ raiseload : _raiseload_loader_option
144+ defaultload : _defaultload_loader_option
145+ defer : _defer_loader_option
146+ undefer : _undefer_loader_option
147+ undefer_group : _undefer_group_loader_option
148+ with_expression : _with_expression_loader_option
149+ selectin_polymorphic : _selectin_polymorphic_loader_option
0 commit comments