diff --git a/python_modules/dagster/dagster/_core/definitions/declarative_automation/operators/boolean_operators.py b/python_modules/dagster/dagster/_core/definitions/declarative_automation/operators/boolean_operators.py index 72b9615306644..0824e8b85b75b 100644 --- a/python_modules/dagster/dagster/_core/definitions/declarative_automation/operators/boolean_operators.py +++ b/python_modules/dagster/dagster/_core/definitions/declarative_automation/operators/boolean_operators.py @@ -1,6 +1,8 @@ import asyncio from collections.abc import Sequence -from typing import TYPE_CHECKING, Union +from typing import TYPE_CHECKING, TypeVar, Union, get_args + +from typing_extensions import TypeIs import dagster._check as check from dagster._annotations import public @@ -21,16 +23,19 @@ from dagster._core.definitions.asset_selection import AssetSelection -def _has_allow_ignore(condition: AutomationCondition) -> bool: - return isinstance( - condition, - ( - DepsAutomationCondition, - AndAutomationCondition, - OrAutomationCondition, - NotAutomationCondition, - ), - ) +T_HasAllowIgnore = TypeVar( + "T_HasAllowIgnore", + bound=Union[ + DepsAutomationCondition, + "AndAutomationCondition", + "OrAutomationCondition", + "NotAutomationCondition", + ], +) + + +def _has_allow_ignore(condition: AutomationCondition) -> TypeIs[T_HasAllowIgnore]: + return isinstance(condition, get_args(T_HasAllowIgnore)) @whitelist_for_serdes(storage_name="AndAssetCondition") diff --git a/python_modules/dagster/setup.py b/python_modules/dagster/setup.py index 98f9cefa2d2fe..e68a16937697b 100644 --- a/python_modules/dagster/setup.py +++ b/python_modules/dagster/setup.py @@ -95,7 +95,7 @@ def get_version() -> str: "tabulate", "tomli<3", "tqdm<5", - "typing_extensions>=4.4.0,<5", + "typing_extensions>=4.10.0,<5", 'tzdata; platform_system=="Windows"', "structlog", "sqlalchemy>=1.0,<3",