|
1 | 1 | from typing import Any
|
| 2 | +from typing import Callable |
| 3 | +from typing import Dict |
| 4 | +from typing import Iterable |
| 5 | +from typing import Iterator |
| 6 | +from typing import List |
| 7 | +from typing import Optional |
| 8 | +from typing import TypeVar |
| 9 | + |
| 10 | +_ET = TypeVar("_ET", bound=ExternalTraversal) |
| 11 | +_T = TypeVar("_T") |
2 | 12 |
|
3 | 13 | class TraversibleType(type):
|
4 | 14 | def __init__(cls, clsname: Any, bases: Any, clsdict: Any) -> None: ...
|
5 | 15 |
|
6 |
| -class Traversible: ... |
| 16 | +class Traversible(metaclass=TraversibleType): ... |
7 | 17 |
|
8 | 18 | class _InternalTraversalType(type):
|
9 | 19 | def __init__(cls, clsname: Any, bases: Any, clsdict: Any) -> None: ...
|
10 | 20 |
|
11 |
| -class InternalTraversal: |
12 |
| - def dispatch(self, visit_symbol: Any): ... |
| 21 | +class InternalTraversal(object, metaclass=_InternalTraversalType): |
| 22 | + def dispatch(self, visit_symbol: Any) -> Optional[Callable[..., Any]]: ... |
13 | 23 | def run_generated_dispatch(
|
14 | 24 | self,
|
15 | 25 | target: Any,
|
16 | 26 | internal_dispatch: Any,
|
17 | 27 | generate_dispatcher_name: Any,
|
18 |
| - ): ... |
| 28 | + ) -> Any: ... |
19 | 29 | def generate_dispatch(
|
20 | 30 | self,
|
21 | 31 | target_cls: Any,
|
22 | 32 | internal_dispatch: Any,
|
23 | 33 | generate_dispatcher_name: Any,
|
24 |
| - ): ... |
25 |
| - dp_has_cache_key: Any = ... |
26 |
| - dp_has_cache_key_list: Any = ... |
27 |
| - dp_clauseelement: Any = ... |
28 |
| - dp_fromclause_canonical_column_collection: Any = ... |
29 |
| - dp_clauseelement_tuples: Any = ... |
30 |
| - dp_clauseelement_list: Any = ... |
31 |
| - dp_clauseelement_tuple: Any = ... |
32 |
| - dp_executable_options: Any = ... |
33 |
| - dp_fromclause_ordered_set: Any = ... |
34 |
| - dp_string: Any = ... |
35 |
| - dp_string_list: Any = ... |
36 |
| - dp_anon_name: Any = ... |
37 |
| - dp_boolean: Any = ... |
38 |
| - dp_operator: Any = ... |
39 |
| - dp_type: Any = ... |
40 |
| - dp_plain_dict: Any = ... |
41 |
| - dp_dialect_options: Any = ... |
42 |
| - dp_string_clauseelement_dict: Any = ... |
43 |
| - dp_string_multi_dict: Any = ... |
44 |
| - dp_annotations_key: Any = ... |
45 |
| - dp_plain_obj: Any = ... |
46 |
| - dp_named_ddl_element: Any = ... |
47 |
| - dp_prefix_sequence: Any = ... |
48 |
| - dp_table_hint_list: Any = ... |
49 |
| - dp_setup_join_tuple: Any = ... |
50 |
| - dp_statement_hint_list: Any = ... |
51 |
| - dp_unknown_structure: Any = ... |
52 |
| - dp_dml_ordered_values: Any = ... |
53 |
| - dp_dml_values: Any = ... |
54 |
| - dp_dml_multi_values: Any = ... |
55 |
| - dp_propagate_attrs: Any = ... |
| 34 | + ) -> Any: ... |
| 35 | + dp_has_cache_key: int = ... |
| 36 | + dp_has_cache_key_list: int = ... |
| 37 | + dp_clauseelement: int = ... |
| 38 | + dp_fromclause_canonical_column_collection: int = ... |
| 39 | + dp_clauseelement_tuples: int = ... |
| 40 | + dp_clauseelement_list: int = ... |
| 41 | + dp_clauseelement_tuple: int = ... |
| 42 | + dp_executable_options: int = ... |
| 43 | + dp_fromclause_ordered_set: int = ... |
| 44 | + dp_string: int = ... |
| 45 | + dp_string_list: int = ... |
| 46 | + dp_anon_name: int = ... |
| 47 | + dp_boolean: int = ... |
| 48 | + dp_operator: int = ... |
| 49 | + dp_type: int = ... |
| 50 | + dp_plain_dict: int = ... |
| 51 | + dp_dialect_options: int = ... |
| 52 | + dp_string_clauseelement_dict: int = ... |
| 53 | + dp_string_multi_dict: int = ... |
| 54 | + dp_annotations_key: int = ... |
| 55 | + dp_plain_obj: int = ... |
| 56 | + dp_named_ddl_element: int = ... |
| 57 | + dp_prefix_sequence: int = ... |
| 58 | + dp_table_hint_list: int = ... |
| 59 | + dp_setup_join_tuple: int = ... |
| 60 | + dp_statement_hint_list: int = ... |
| 61 | + dp_unknown_structure: int = ... |
| 62 | + dp_dml_ordered_values: int = ... |
| 63 | + dp_dml_values: int = ... |
| 64 | + dp_dml_multi_values: int = ... |
| 65 | + dp_propagate_attrs: int = ... |
56 | 66 |
|
57 | 67 | class ExtendedInternalTraversal(InternalTraversal):
|
58 |
| - dp_ignore: Any = ... |
59 |
| - dp_inspectable: Any = ... |
60 |
| - dp_multi: Any = ... |
61 |
| - dp_multi_list: Any = ... |
62 |
| - dp_has_cache_key_tuples: Any = ... |
63 |
| - dp_inspectable_list: Any = ... |
| 68 | + dp_ignore: int = ... |
| 69 | + dp_inspectable: int = ... |
| 70 | + dp_multi: int = ... |
| 71 | + dp_multi_list: int = ... |
| 72 | + dp_has_cache_key_tuples: int = ... |
| 73 | + dp_inspectable_list: int = ... |
64 | 74 |
|
65 | 75 | class ExternalTraversal:
|
66 | 76 | __traverse_options__: Any = ...
|
67 |
| - def traverse_single(self, obj: Any, **kw: Any): ... |
68 |
| - def iterate(self, obj: Any): ... |
69 |
| - def traverse(self, obj: Any): ... |
| 77 | + def traverse_single(self, obj: Any, **kw: Any) -> Any: ... |
| 78 | + def iterate(self, obj: Any) -> Iterator[Any]: ... |
| 79 | + def traverse(self, obj: _T) -> _T: ... |
70 | 80 | @property
|
71 |
| - def visitor_iterator(self) -> None: ... |
72 |
| - def chain(self, visitor: Any): ... |
| 81 | + def visitor_iterator(self) -> Iterator[Any]: ... |
| 82 | + def chain(self: _ET, visitor: Any) -> _ET: ... |
73 | 83 |
|
74 | 84 | class CloningExternalTraversal(ExternalTraversal):
|
75 |
| - def copy_and_process(self, list_: Any): ... |
76 |
| - def traverse(self, obj: Any): ... |
| 85 | + def copy_and_process(self, list_: Iterable[_T]) -> List[_T]: ... |
| 86 | + def traverse(self, obj: _T) -> _T: ... |
77 | 87 |
|
78 | 88 | class ReplacingExternalTraversal(CloningExternalTraversal):
|
79 |
| - def replace(self, elem: Any) -> None: ... |
80 |
| - def traverse(self, obj: Any): ... |
| 89 | + def replace(self, elem: Any) -> Optional[Any]: ... |
| 90 | + def traverse(self, obj: _T) -> _T: ... |
81 | 91 |
|
82 | 92 | Visitable = Traversible
|
83 | 93 | VisitableType = TraversibleType
|
84 | 94 | ClauseVisitor = ExternalTraversal
|
85 | 95 | CloningVisitor = CloningExternalTraversal
|
86 | 96 | ReplacingCloningVisitor = ReplacingExternalTraversal
|
87 | 97 |
|
88 |
| -def iterate(obj: Any, opts: Any = ...) -> None: ... |
89 |
| -def traverse_using(iterator: Any, obj: Any, visitors: Any): ... |
90 |
| -def traverse(obj: Any, opts: Any, visitors: Any): ... |
91 |
| -def cloned_traverse(obj: Any, opts: Any, visitors: Any): ... |
92 |
| -def replacement_traverse(obj: Any, opts: Any, replace: Any): ... |
| 98 | +def iterate(obj: Any, opts: Dict[str, Any] = ...) -> Iterator[Any]: ... |
| 99 | +def traverse_using( |
| 100 | + iterator: Iterator[Any], obj: _T, visitors: Dict[str, Callable[..., Any]] |
| 101 | +) -> _T: ... |
| 102 | +def traverse( |
| 103 | + obj: _T, opts: Dict[str, Any], visitors: Dict[str, Callable[..., Any]] |
| 104 | +) -> _T: ... |
| 105 | +def cloned_traverse( |
| 106 | + obj: _T, opts: Dict[str, Any], visitors: Dict[str, Callable[..., Any]] |
| 107 | +) -> _T: ... |
| 108 | +def replacement_traverse( |
| 109 | + obj: _T, opts: Dict[str, Any], replace: Callable[[Any], Any] |
| 110 | +) -> _T: ... |
0 commit comments