1
1
from _typeshed import Incomplete
2
+ from collections .abc import Callable
2
3
from typing import Any
4
+ from typing_extensions import Self
3
5
4
6
from ..sql .base import Generative
5
7
from .interfaces import LoaderOption
@@ -17,50 +19,67 @@ class Load(Generative, LoaderOption):
17
19
propagate_to_loaders : bool
18
20
def process_compile_state_replaced_entities (self , compile_state , mapper_entities ) -> None : ...
19
21
def process_compile_state (self , compile_state ) -> None : ...
20
- def options (self , * opts ) -> None : ...
21
- def set_relationship_strategy (self , attr , strategy , propagate_to_loaders : bool = True ) -> None : ...
22
- def set_column_strategy (self , attrs , strategy , opts : Incomplete | None = None , opts_only : bool = False ) -> None : ...
23
- def set_generic_strategy (self , attrs , strategy ) -> None : ...
24
- def set_class_strategy (self , strategy , opts ) -> None : ...
25
- # added dynamically at runtime
26
- def contains_eager (self , attr , alias : Incomplete | None = None ): ...
27
- def load_only (self , * attrs ): ...
28
- def joinedload (self , attr , innerjoin : Incomplete | None = None ): ...
29
- def subqueryload (self , attr ): ...
30
- def selectinload (self , attr ): ...
31
- def lazyload (self , attr ): ...
32
- def immediateload (self , attr ): ...
33
- def noload (self , attr ): ...
34
- def raiseload (self , attr , sql_only : bool = False ): ...
35
- def defaultload (self , attr ): ...
36
- def defer (self , key , raiseload : bool = False ): ...
37
- def undefer (self , key ): ...
38
- def undefer_group (self , name ): ...
39
- def with_expression (self , key , expression ): ...
40
- def selectin_polymorphic (self , classes ): ...
22
+ def options (self , * opts ) -> Self : ...
23
+ def set_relationship_strategy (self , attr , strategy , propagate_to_loaders : bool = True ) -> Self : ...
24
+ def set_column_strategy (self , attrs , strategy , opts : Incomplete | None = None , opts_only : bool = False ) -> Self : ...
25
+ def set_generic_strategy (self , attrs , strategy ) -> Self : ...
26
+ def set_class_strategy (self , strategy , opts ) -> Self : ...
27
+ # Added dynamically at runtime
28
+ def contains_eager (loadopt , attr , alias : Incomplete | None = None ) -> Self : ...
29
+ def load_only (loadopt , * attrs ) -> Self : ...
30
+ def joinedload (loadopt , attr , innerjoin : Incomplete | None = None ) -> Self : ...
31
+ def subqueryload (loadopt , attr ) -> Self : ...
32
+ def selectinload (loadopt , attr ) -> Self : ...
33
+ def lazyload (loadopt , attr ) -> Self : ...
34
+ def immediateload (loadopt , attr ) -> Self : ...
35
+ def noload (loadopt , attr ) -> Self : ...
36
+ def raiseload (loadopt , attr , sql_only : bool = False ) -> Self : ...
37
+ def defaultload (loadopt , attr ) -> Self : ...
38
+ def defer (loadopt , key , raiseload : bool = False ) -> Self : ...
39
+ def undefer (loadopt , key ) -> Self : ...
40
+ def undefer_group (loadopt , name ) -> Self : ...
41
+ def with_expression (loadopt , key , expression ) -> Self : ...
42
+ def selectin_polymorphic (loadopt , classes ) -> Self : ...
41
43
42
44
class _UnboundLoad (Load ):
43
45
path : Any
44
46
local_opts : Any
45
47
def __init__ (self ) -> None : ...
46
48
47
49
class loader_option :
48
- name : Any
49
- fn : Any
50
- def __call__ (self , fn ): ...
50
+ name : str
51
+ # The first parameter of this Callable should always be `loadopt: Load`
52
+ fn : Callable [..., loader_option ]
53
+ def __call__ (self , fn : Callable [..., loader_option ]) -> Self : ...
51
54
52
- def contains_eager (loadopt , attr , alias : Incomplete | None = ...): ...
53
- def load_only (loadopt , * attrs ): ...
54
- def joinedload (loadopt , attr , innerjoin : Incomplete | None = ...): ...
55
- def subqueryload (loadopt , attr ): ...
56
- def selectinload (loadopt , attr ): ...
57
- def lazyload (loadopt , attr ): ...
58
- def immediateload (loadopt , attr ): ...
59
- def noload (loadopt , attr ): ...
60
- def raiseload (loadopt , attr , sql_only : bool = ...): ...
61
- def defaultload (loadopt , attr ): ...
62
- def defer (loadopt , key , raiseload : bool = ...): ...
63
- def undefer (loadopt , key ): ...
64
- def undefer_group (loadopt , name ): ...
65
- def with_expression (loadopt , key , expression ): ...
66
- def selectin_polymorphic (loadopt , classes ): ...
55
+ # loader_option instances that can be used to dynamically add methods to Load at runtime
56
+ @loader_option ()
57
+ def contains_eager (loadopt : Load , attr , alias : Incomplete | None = ...) -> loader_option : ...
58
+ @loader_option ()
59
+ def load_only (loadopt : Load , * attrs ) -> loader_option : ...
60
+ @loader_option ()
61
+ def joinedload (loadopt , attr , innerjoin = None ): ...
62
+ @loader_option ()
63
+ def subqueryload (loadopt : Load , attr ) -> loader_option : ...
64
+ @loader_option ()
65
+ def selectinload (loadopt : Load , attr ) -> loader_option : ...
66
+ @loader_option ()
67
+ def lazyload (loadopt : Load , attr ) -> loader_option : ...
68
+ @loader_option ()
69
+ def immediateload (loadopt : Load , attr ) -> loader_option : ...
70
+ @loader_option ()
71
+ def noload (loadopt : Load , attr ) -> loader_option : ...
72
+ @loader_option ()
73
+ def raiseload (loadopt : Load , attr , sql_only : bool = ...) -> loader_option : ...
74
+ @loader_option ()
75
+ def defaultload (loadopt : Load , attr ) -> loader_option : ...
76
+ @loader_option ()
77
+ def defer (loadopt : Load , key , raiseload : bool = ...) -> loader_option : ...
78
+ @loader_option ()
79
+ def undefer (loadopt : Load , key ) -> loader_option : ...
80
+ @loader_option ()
81
+ def undefer_group (loadopt : Load , name ) -> loader_option : ...
82
+ @loader_option ()
83
+ def with_expression (loadopt : Load , key ) -> loader_option : ...
84
+ @loader_option ()
85
+ def selectin_polymorphic (loadopt : Load , classes ) -> loader_option : ...
0 commit comments