1
+ from typing import AbstractSet
1
2
from typing import Any
3
+ from typing import Callable
4
+ from typing import Mapping
2
5
from typing import Optional
6
+ from typing import Sequence
7
+ from typing import Tuple
3
8
from typing import Type
4
9
from typing import TypeVar
5
10
from typing import Union
6
11
12
+ from typing_extensions import Literal
13
+
14
+ from . import _BackrefResult
7
15
from . import attributes as attributes
8
16
from .base import state_str as state_str
9
17
from .interfaces import MANYTOMANY as MANYTOMANY
@@ -19,6 +27,7 @@ from .. import schema as schema
19
27
from .. import sql as sql
20
28
from .. import util as util
21
29
from ..inspection import inspect as inspect
30
+ from ..schema import Column
22
31
from ..sql import coercions as coercions
23
32
from ..sql import expression as expression
24
33
from ..sql import operators as operators
@@ -35,78 +44,82 @@ def foreign(expr: Any): ...
35
44
36
45
_T = TypeVar ("_T" )
37
46
47
+ _InfoDict = Mapping [Any , Any ]
48
+
38
49
class RelationshipProperty (StrategizedProperty [_T ]):
39
- strategy_wildcard_key : str = ...
40
- inherit_cache : bool = ...
41
- uselist : Any = ...
42
- argument : Any = ...
43
- secondary : Any = ...
44
- primaryjoin : Any = ...
45
- secondaryjoin : Any = ...
46
- post_update : Any = ...
47
- direction : Any = ...
48
- viewonly : Any = ...
49
- sync_backref : Any = ...
50
- lazy : Any = ...
51
- single_parent : Any = ...
52
- collection_class : Optional [Type ] = ...
53
- passive_deletes : Any = ...
54
- cascade_backrefs : Any = ...
55
- passive_updates : Any = ...
56
- remote_side : Any = ...
57
- enable_typechecks : Any = ...
58
- query_class : Any = ...
59
- innerjoin : Any = ...
60
- distinct_target_key : Any = ...
61
- doc : Any = ...
62
- active_history : Any = ...
63
- join_depth : Any = ...
64
- omit_join : Any = ...
65
- local_remote_pairs : Any = ...
66
- bake_queries : Any = ...
67
- load_on_pending : Any = ...
68
- comparator_factory : Any = ...
69
- comparator : Any = ...
70
- info : Any = ...
71
- strategy_key : Any = ...
72
- order_by : Any = ...
73
- back_populates : Any = ...
74
- backref : Any = ...
50
+ strategy_wildcard_key : str
51
+ inherit_cache : bool
52
+ uselist : Optional [ bool ]
53
+ argument : Any
54
+ secondary : Any
55
+ primaryjoin : Any
56
+ secondaryjoin : Any
57
+ post_update : bool
58
+ direction : Any
59
+ viewonly : Any
60
+ sync_backref : Any
61
+ lazy : str
62
+ single_parent : Any
63
+ collection_class : Optional [Type ]
64
+ passive_deletes : Union [ bool , Literal [ "all" ]]
65
+ cascade_backrefs : bool
66
+ passive_updates : bool
67
+ remote_side : Any
68
+ enable_typechecks : bool # NOTE: not documented
69
+ query_class : Any
70
+ innerjoin : Union [ bool , str ]
71
+ distinct_target_key : Optional [ bool ]
72
+ doc : Optional [ str ]
73
+ active_history : bool
74
+ join_depth : Optional [ int ]
75
+ omit_join : Optional [ Literal [ False ]]
76
+ local_remote_pairs : Any # NOTE: not documented
77
+ bake_queries : bool
78
+ load_on_pending : bool
79
+ comparator_factory : Any
80
+ comparator : Any
81
+ info : _InfoDict # NOTE: not set if constructor argument is ``None``
82
+ strategy_key : Tuple [ Tuple [ str , str ]] # NOTE: not documented
83
+ order_by : Any
84
+ back_populates : Union [ None , str ]
85
+ backref : Union [ None , str , _BackrefResult ]
75
86
def __init__ (
76
87
self ,
77
88
argument : Any ,
78
89
secondary : Optional [Any ] = ...,
79
90
primaryjoin : Optional [Any ] = ...,
80
91
secondaryjoin : Optional [Any ] = ...,
81
92
foreign_keys : Optional [Any ] = ...,
82
- uselist : Optional [Any ] = ...,
83
- order_by : bool = ...,
84
- backref : Optional [Any ] = ...,
85
- back_populates : Optional [Any ] = ...,
86
- overlaps : Optional [Any ] = ...,
93
+ uselist : Optional [bool ] = ...,
94
+ order_by : Union [
95
+ Literal [False ], str , Column , Callable [[], Column ]
96
+ ] = ...,
97
+ backref : Union [str , _BackrefResult ] = ...,
98
+ back_populates : str = ...,
99
+ overlaps : Union [AbstractSet [str ], str ] = ...,
87
100
post_update : bool = ...,
88
- cascade : bool = ...,
101
+ cascade : Union [ Literal [ False ], Sequence [ str ]] = ...,
89
102
viewonly : bool = ...,
90
103
lazy : str = ...,
91
104
collection_class : Optional [Any ] = ...,
92
- passive_deletes : Any = ...,
93
- passive_updates : Any = ...,
105
+ passive_deletes : Union [ bool , Literal [ "all" ]] = ...,
106
+ passive_updates : bool = ...,
94
107
remote_side : Optional [Any ] = ...,
95
- enable_typechecks : Any = ...,
96
- join_depth : Optional [Any ] = ...,
108
+ enable_typechecks : bool = ..., # NOTE: not documented
109
+ join_depth : Optional [int ] = ...,
97
110
comparator_factory : Optional [Any ] = ...,
98
111
single_parent : bool = ...,
99
- innerjoin : bool = ...,
100
- distinct_target_key : Optional [Any ] = ...,
101
- doc : Optional [Any ] = ...,
102
- active_history : Any = ...,
103
- cascade_backrefs : Any = ...,
112
+ innerjoin : Union [ bool , str ] = ...,
113
+ distinct_target_key : Optional [bool ] = ...,
114
+ doc : Optional [str ] = ...,
115
+ active_history : bool = ...,
116
+ cascade_backrefs : bool = ...,
104
117
load_on_pending : bool = ...,
105
118
bake_queries : bool = ...,
106
119
_local_remote_pairs : Optional [Any ] = ...,
107
120
query_class : Optional [Any ] = ...,
108
- info : Optional [Any ] = ...,
109
- omit_join : Optional [Any ] = ...,
121
+ info : Optional [_InfoDict ] = ...,
122
+ omit_join : Optional [Literal [ False ] ] = ...,
110
123
sync_backref : Optional [Any ] = ...,
111
124
) -> None : ...
112
125
def instrument_class (self , mapper : Any ) -> None : ...
@@ -154,12 +167,12 @@ class RelationshipProperty(StrategizedProperty[_T]):
154
167
halt_on : Optional [Any ] = ...,
155
168
) -> None : ...
156
169
def entity (self ) -> Union [AliasedInsp , Mapper ]: ...
157
- def mapper (self ): ...
170
+ def mapper (self ) -> Mapper : ...
158
171
def do_init (self ) -> None : ...
159
172
@property
160
- def cascade (self ): ...
173
+ def cascade (self ) -> CascadeOptions : ...
161
174
@cascade .setter
162
- def cascade (self , cascade : Any ) -> None : ...
175
+ def cascade (self , cascade : Sequence [ str ] ) -> None : ...
163
176
164
177
class JoinCondition :
165
178
parent_persist_selectable : Any = ...
0 commit comments