From 258bf1af7c73c83502eb49240a996f5846c6a0a9 Mon Sep 17 00:00:00 2001 From: Semyon Pupkov Date: Sat, 11 May 2024 16:43:52 +0500 Subject: [PATCH] Change typing --- lib/sqlalchemy/util/_collections.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sqlalchemy/util/_collections.py b/lib/sqlalchemy/util/_collections.py index f5edf275f5..34b435e05f 100644 --- a/lib/sqlalchemy/util/_collections.py +++ b/lib/sqlalchemy/util/_collections.py @@ -16,6 +16,7 @@ import typing from typing import Any from typing import Callable from typing import cast +from typing import Container from typing import Dict from typing import FrozenSet from typing import Generic @@ -401,14 +402,13 @@ def to_list(x: Any, default: Optional[List[Any]] = None) -> List[Any]: return list(x) -def has_intersection(set_: Union[Set[Any], FrozenSet[Any]], iterable: Iterable[Any]) -> bool: +def has_intersection(set_: Container[Any], iterable: Iterable[Any]) -> bool: r"""return True if any items of set\_ are present in iterable. Goes through special effort to ensure __hash__ is not called on items in iterable that don't support it. """ - # TODO: optimize, write in C, etc. return any(i in set_ for i in iterable if i.__hash__) -- 2.47.2