1
1
from typing import Any
2
+ from typing import Callable
3
+ from typing import Iterable
4
+ from typing import Iterator
5
+ from typing import List
2
6
from typing import Optional
7
+ from typing import Sequence
8
+ from typing import TypeVar
9
+ from typing import Union
3
10
4
- from . import coercions as coercions
5
- from . import operators as operators
6
- from . import roles as roles
7
- from . import visitors as visitors
8
- from .base import ColumnSet as ColumnSet
9
- from .ddl import sort_tables as sort_tables
10
- from .elements import BindParameter as BindParameter
11
- from .elements import ColumnClause as ColumnClause
12
- from .elements import ColumnElement as ColumnElement
13
- from .elements import Grouping as Grouping
14
- from .elements import Label as Label
15
- from .elements import Null as Null
16
- from .elements import UnaryExpression as UnaryExpression
17
- from .schema import Column as Column
18
- from .selectable import Alias as Alias
19
- from .selectable import FromClause as FromClause
20
- from .selectable import FromGrouping as FromGrouping
21
- from .selectable import Join as Join
22
- from .selectable import ScalarSelect as ScalarSelect
23
- from .selectable import SelectBase as SelectBase
24
- from .selectable import TableClause as TableClause
25
- from .traversals import HasCacheKey as HasCacheKey
26
- from .. import exc as exc
27
- from .. import util as util
11
+ from typing_extensions import Protocol
28
12
29
- join_condition : Any
13
+ from . import visitors
14
+ from .base import ColumnCollection
15
+ from .base import ColumnSet
16
+ from .elements import ClauseElement
17
+ from .elements import ColumnClause
18
+ from .schema import Table
19
+ from .selectable import Alias
20
+ from .selectable import FromClause
21
+ from .selectable import Join
22
+ from .selectable import Selectable
30
23
31
- def find_join_source (clauses : Any , join_to : Any ): ...
32
- def find_left_clause_that_matches_given (clauses : Any , join_from : Any ): ...
24
+ _T = TypeVar ("_T" )
25
+ _COLA = TypeVar ("_COLA" , bound = ColumnAdapter )
26
+
27
+ class _IsDerivedFrom (Protocol ):
28
+ def is_derived_from (self , __fromclause : FromClause ) -> bool : ...
29
+
30
+ join_condition = Join ._join_condition
31
+
32
+ def find_join_source (
33
+ clauses : Iterable [_IsDerivedFrom ], join_to : Selectable
34
+ ) -> List [int ]: ...
35
+ def find_left_clause_that_matches_given (
36
+ clauses : Sequence [_IsDerivedFrom ], join_from : Selectable
37
+ ) -> List [int ]: ...
33
38
def find_left_clause_to_join_from (
34
- clauses : Any , join_to : Any , onclause : Any
35
- ): ...
36
- def visit_binary_product (fn : Any , expr : Any ) -> None : ...
39
+ clauses : Sequence [FromClause ],
40
+ join_to : Selectable ,
41
+ onclause : Optional [Any ],
42
+ ) -> Iterable [int ]: ...
43
+ def visit_binary_product (
44
+ fn : Callable [[Any , Any , Any ], Any ], expr : ClauseElement
45
+ ) -> Iterator [ClauseElement ]: ...
37
46
def find_tables (
38
- clause : Any ,
47
+ clause : Union [ ClauseElement , FromClause ] ,
39
48
check_columns : bool = ...,
40
49
include_aliases : bool = ...,
41
50
include_joins : bool = ...,
42
51
include_selects : bool = ...,
43
52
include_crud : bool = ...,
44
- ): ...
45
- def unwrap_order_by (clause : Any ): ...
46
- def unwrap_label_reference (element : Any ): ...
47
- def expand_column_list_from_order_by (collist : Any , order_by : Any ): ...
48
- def clause_is_present (clause : Any , search : Any ): ...
49
- def tables_from_leftmost (clause : Any ) -> None : ...
50
- def surface_selectables (clause : Any ) -> None : ...
51
- def surface_selectables_only (clause : Any ) -> None : ...
52
- def extract_first_column_annotation (column : Any , annotation_name : Any ): ...
53
- def selectables_overlap (left : Any , right : Any ): ...
54
- def bind_values (clause : Any ): ...
53
+ ) -> List [Table ]: ...
54
+ def unwrap_order_by (clause : ClauseElement ) -> List [ClauseElement ]: ...
55
+ def unwrap_label_reference (element : _T ) -> _T : ...
56
+ def expand_column_list_from_order_by (
57
+ collist : ColumnCollection [Any ], order_by : ClauseElement
58
+ ) -> List [ClauseElement ]: ...
59
+ def clause_is_present (clause : Selectable , search : Selectable ) -> bool : ...
60
+ def tables_from_leftmost (clause : Table ) -> Iterator [Table ]: ...
61
+ def surface_selectables (clause : Any ) -> Iterator [FromClause ]: ...
62
+ def surface_selectables_only (
63
+ clause : Any ,
64
+ ) -> Iterator [Union [Alias , FromClause , ColumnClause [Any ]]]: ...
65
+ def extract_first_column_annotation (
66
+ column : Any , annotation_name : str
67
+ ) -> Optional [Any ]: ...
68
+ def selectables_overlap (left : Any , right : Any ) -> bool : ...
69
+ def bind_values (clause : Any ) -> List [Any ]: ...
55
70
56
71
class _repr_base :
57
- def trunc (self , value : Any ): ...
72
+ def trunc (self , value : Any ) -> str : ...
58
73
59
74
class _repr_row (_repr_base ):
60
75
row : Any = ...
61
- max_chars : Any = ...
76
+ max_chars : int = ...
62
77
def __init__ (self , row : Any , max_chars : int = ...) -> None : ...
63
78
64
79
class _repr_params (_repr_base ):
65
80
params : Any = ...
66
- ismulti : Any = ...
81
+ ismulti : Optional [ bool ] = ...
67
82
batches : Any = ...
68
- max_chars : Any = ...
83
+ max_chars : int = ...
69
84
def __init__ (
70
85
self ,
71
86
params : Any ,
72
87
batches : Any ,
73
88
max_chars : int = ...,
74
- ismulti : Optional [Any ] = ...,
89
+ ismulti : Optional [bool ] = ...,
75
90
) -> None : ...
76
91
77
- def adapt_criterion_to_null (crit : Any , nulls : Any ): ...
78
- def splice_joins (left : Any , right : Any , stop_on : Optional [Any ] = ...): ...
79
- def reduce_columns (columns : Any , * clauses : Any , ** kw : Any ): ...
92
+ def adapt_criterion_to_null (crit : Any , nulls : Any ) -> Any : ...
93
+ def splice_joins (
94
+ left : Any , right : Any , stop_on : Optional [Any ] = ...
95
+ ) -> Any : ...
96
+ def reduce_columns (
97
+ columns : Any , * clauses : Any , ** kw : Any
98
+ ) -> ColumnSet [Any ]: ...
80
99
def criterion_as_pairs (
81
100
expression : Any ,
82
101
consider_as_foreign_keys : Optional [Any ] = ...,
83
102
consider_as_referenced_keys : Optional [Any ] = ...,
84
103
any_operator : bool = ...,
85
- ): ...
104
+ ) -> Any : ...
86
105
87
106
class ClauseAdapter (visitors .ReplacingExternalTraversal ):
88
107
__traverse_options__ : Any = ...
@@ -100,7 +119,7 @@ class ClauseAdapter(visitors.ReplacingExternalTraversal):
100
119
adapt_on_names : bool = ...,
101
120
anonymize_labels : bool = ...,
102
121
) -> None : ...
103
- def replace (self , col : Any ): ...
122
+ def replace (self , col : Any ) -> Optional [ Any ] : ...
104
123
105
124
class ColumnAdapter (ClauseAdapter ):
106
125
columns : Any = ...
@@ -121,9 +140,9 @@ class ColumnAdapter(ClauseAdapter):
121
140
parent : Any = ...
122
141
columns : Any = ...
123
142
def __init__ (self , parent : Any , columns : Any ) -> None : ...
124
- def __getitem__ (self , key : Any ): ...
125
- def wrap (self , adapter : Any ): ...
126
- def traverse (self , obj : Any ): ...
127
- adapt_clause : Any = ...
128
- adapt_list : Any = ...
129
- def adapt_check_present (self , col : Any ): ...
143
+ def __getitem__ (self , key : Any ) -> Any : ...
144
+ def wrap (self : _COLA , adapter : Any ) -> _COLA : ...
145
+ def traverse (self , obj : Any ) -> Any : ...
146
+ def adapt_clause ( self , obj : Any ) -> Any : ...
147
+ adapt_list = ClauseAdapter . copy_and_process
148
+ def adapt_check_present (self , col : Any ) -> Optional [ Any ] : ...
0 commit comments