summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/base.py
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2023-01-13 19:28:33 +0000
committerGerrit Code Review <gerrit@ci3.zzzcomputing.com>2023-01-13 19:28:33 +0000
commit5be715d63ba60f065a6339de5de564cc26058545 (patch)
treeebd2b67c04e7ca037943c7224f4c9ab8965de21a /lib/sqlalchemy/sql/base.py
parentb04b7527ed1df22d32707acda9a3c1fea04ca5a8 (diff)
parent73389e94aefd4604c9f1b1ba744e0e74c99d8371 (diff)
downloadsqlalchemy-5be715d63ba60f065a6339de5de564cc26058545.tar.gz
Merge "Type annotations for sqlalchemy.sql.selectable" into main
Diffstat (limited to 'lib/sqlalchemy/sql/base.py')
-rw-r--r--lib/sqlalchemy/sql/base.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/base.py b/lib/sqlalchemy/sql/base.py
index 25e214bd3..96ebc7824 100644
--- a/lib/sqlalchemy/sql/base.py
+++ b/lib/sqlalchemy/sql/base.py
@@ -66,6 +66,7 @@ if TYPE_CHECKING:
from . import type_api
from ._orm_types import DMLStrategyArgument
from ._orm_types import SynchronizeSessionArgument
+ from ._typing import _CLE
from .elements import BindParameter
from .elements import ClauseList
from .elements import ColumnClause # noqa
@@ -282,7 +283,9 @@ def _clone(element, **kw):
return element._clone(**kw)
-def _expand_cloned(elements):
+def _expand_cloned(
+ elements: Iterable[_CLE],
+) -> Iterable[_CLE]:
"""expand the given set of ClauseElements to be the set of all 'cloned'
predecessors.
@@ -291,7 +294,7 @@ def _expand_cloned(elements):
return itertools.chain(*[x._cloned_set for x in elements])
-def _cloned_intersection(a, b):
+def _cloned_intersection(a: Iterable[_CLE], b: Iterable[_CLE]) -> Set[_CLE]:
"""return the intersection of sets a and b, counting
any overlap between 'cloned' predecessors.
@@ -302,7 +305,7 @@ def _cloned_intersection(a, b):
return {elem for elem in a if all_overlap.intersection(elem._cloned_set)}
-def _cloned_difference(a, b):
+def _cloned_difference(a: Iterable[_CLE], b: Iterable[_CLE]) -> Set[_CLE]:
all_overlap = set(_expand_cloned(a)).intersection(_expand_cloned(b))
return {
elem for elem in a if not all_overlap.intersection(elem._cloned_set)