diff options
author | mike bayer <mike_mp@zzzcomputing.com> | 2022-05-16 02:32:44 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@ci3.zzzcomputing.com> | 2022-05-16 02:32:44 +0000 |
commit | 5d080d17464712d33c0215d12513e529d848ee8c (patch) | |
tree | eec56f3138a48f55f2585a64f01b4fd9c14451b7 /lib/sqlalchemy/sql/annotation.py | |
parent | c4dad3695f4ab9fef3a4cb05893492afbec811f7 (diff) | |
parent | 18a73fb1d1c267842ead5dacd05a49f4344d8b22 (diff) | |
download | sqlalchemy-5d080d17464712d33c0215d12513e529d848ee8c.tar.gz |
Merge "revenge of pep 484" into main
Diffstat (limited to 'lib/sqlalchemy/sql/annotation.py')
-rw-r--r-- | lib/sqlalchemy/sql/annotation.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/annotation.py b/lib/sqlalchemy/sql/annotation.py index fa36c09fc..56d88bc2f 100644 --- a/lib/sqlalchemy/sql/annotation.py +++ b/lib/sqlalchemy/sql/annotation.py @@ -454,9 +454,23 @@ def _deep_annotate( return element +@overload +def _deep_deannotate( + element: Literal[None], values: Optional[Sequence[str]] = None +) -> Literal[None]: + ... + + +@overload def _deep_deannotate( element: _SA, values: Optional[Sequence[str]] = None ) -> _SA: + ... + + +def _deep_deannotate( + element: Optional[_SA], values: Optional[Sequence[str]] = None +) -> Optional[_SA]: """Deep copy the given element, removing annotations.""" cloned: Dict[Any, SupportsAnnotations] = {} @@ -482,9 +496,7 @@ def _deep_deannotate( return element -def _shallow_annotate( - element: SupportsAnnotations, annotations: _AnnotationDict -) -> SupportsAnnotations: +def _shallow_annotate(element: _SA, annotations: _AnnotationDict) -> _SA: """Annotate the given ClauseElement and copy its internals so that internal objects refer to the new annotated object. |