1
1
from typing import Any
2
2
from typing import Optional
3
+ from typing import Type
4
+ from typing import TypeVar
3
5
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 )
17
11
18
12
class Load (Generative , LoaderOption ):
19
13
path : Any = ...
@@ -22,24 +16,43 @@ class Load(Generative, LoaderOption):
22
16
is_class_strategy : bool = ...
23
17
def __init__ (self , entity : Any ) -> None : ...
24
18
@classmethod
25
- def for_existing_path (cls , path : Any ): ...
19
+ def for_existing_path (cls : Type [ _L ] , path : Any ) -> _L : ...
26
20
is_opts_only : bool = ...
27
21
strategy : Any = ...
28
22
propagate_to_loaders : bool = ...
29
23
def process_compile_state (self , compile_state : Any ) -> None : ...
30
- def options (self , * opts : Any ) -> None : ...
24
+ def options (self : _L , * opts : Any ) -> _L : ...
31
25
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 : ...
34
28
def set_column_strategy (
35
- self ,
29
+ self : _L ,
36
30
attrs : Any ,
37
31
strategy : Any ,
38
32
opts : Optional [Any ] = ...,
39
33
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 : ...
43
56
44
57
class _UnboundLoad (Load ):
45
58
path : Any = ...
@@ -49,5 +62,88 @@ class _UnboundLoad(Load):
49
62
class loader_option :
50
63
def __init__ (self ) -> None : ...
51
64
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