Skip to content

Commit d9dc22f

Browse files
committed
style: fix provider mypy error
1 parent 8e0baf5 commit d9dc22f

File tree

6 files changed

+13
-9
lines changed

6 files changed

+13
-9
lines changed

providers/atlassian/jira/src/airflow/providers/atlassian/jira/sensors/jira.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def __init__(
5252
if result_processor is not None:
5353
self.result_processor = result_processor
5454
self.method_name = method_name
55-
self.method_params = method_params
55+
self.method_params = method_params or {}
5656

5757
def poke(self, context: Context) -> Any:
5858
hook = JiraHook(jira_conn_id=self.jira_conn_id)

providers/edge3/src/airflow/providers/edge3/executors/edge_executor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class EdgeExecutor(BaseExecutor):
5555

5656
def __init__(self, *args, **kwargs):
5757
super().__init__(*args, **kwargs)
58-
self.last_reported_state: dict[TaskInstanceKey, TaskInstanceState] = {}
58+
self.last_reported_state: dict[TaskInstanceKey, TaskInstanceState | str] = {}
5959

6060
# Check if self has the ExecutorConf set on the self.conf attribute with all required methods.
6161
# In Airflow 2.x, ExecutorConf exists but lacks methods like getint, getboolean, getsection, etc.

providers/github/src/airflow/providers/github/sensors/github.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def __init__(
5454
if result_processor is not None:
5555
self.result_processor = result_processor
5656
self.method_name = method_name
57-
self.method_params = method_params
57+
self.method_params = method_params or {}
5858

5959
def poke(self, context: Context) -> bool:
6060
hook = GithubHook(github_conn_id=self.github_conn_id)

providers/google/src/airflow/providers/google/cloud/triggers/cloud_composer.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import json
2323
from collections.abc import Collection, Iterable, Sequence
2424
from datetime import datetime
25-
from typing import Any
25+
from typing import TYPE_CHECKING, Any
2626

2727
from dateutil import parser
2828
from google.api_core.exceptions import NotFound
@@ -32,6 +32,9 @@
3232
from airflow.providers.google.cloud.hooks.cloud_composer import CloudComposerAsyncHook
3333
from airflow.triggers.base import BaseTrigger, TriggerEvent
3434

35+
if TYPE_CHECKING:
36+
from airflow.utils.state import TerminalTIState
37+
3538

3639
class CloudComposerExecutionTrigger(BaseTrigger):
3740
"""The trigger handles the async communication with the Google Cloud Composer."""
@@ -183,7 +186,7 @@ def __init__(
183186
composer_dag_id: str,
184187
start_date: datetime,
185188
end_date: datetime,
186-
allowed_states: list[str],
189+
allowed_states: list[str] | list[TerminalTIState],
187190
composer_dag_run_id: str | None = None,
188191
gcp_conn_id: str = "google_cloud_default",
189192
impersonation_chain: str | Sequence[str] | None = None,
@@ -358,7 +361,7 @@ def __init__(
358361
environment_id: str,
359362
start_date: datetime,
360363
end_date: datetime,
361-
allowed_states: list[str],
364+
allowed_states: list[str] | list[TerminalTIState],
362365
skipped_states: list[str],
363366
failed_states: list[str],
364367
composer_external_dag_id: str,

providers/standard/src/airflow/providers/standard/sensors/external_task.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353

5454
if not AIRFLOW_V_3_0_PLUS:
5555
from airflow.utils.session import NEW_SESSION, provide_session
56+
from airflow.utils.state import TerminalTIState
5657

5758
if AIRFLOW_V_3_2_PLUS:
5859
from airflow.dag_processing.dagbag import DagBag
@@ -321,7 +322,7 @@ def _poke_af3(self, context: Context, dttm_filter: Sequence[datetime.datetime])
321322
self._has_checked_existence = True
322323
ti = context["ti"]
323324

324-
def _get_count(states: list[str]) -> int:
325+
def _get_count(states: list[str] | list[TerminalTIState]) -> int:
325326
if self.external_task_ids:
326327
return ti.get_ti_count(
327328
dag_id=self.external_dag_id,

task-sdk/src/airflow/sdk/types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from collections.abc import Iterable
2222
from typing import TYPE_CHECKING, Any, NamedTuple, Protocol, TypeAlias
2323

24-
from airflow.sdk.api.datamodels._generated import WeightRule
24+
from airflow.sdk.api.datamodels._generated import TerminalTIState, WeightRule
2525
from airflow.sdk.bases.xcom import BaseXCom
2626
from airflow.sdk.definitions._internal.types import NOTSET, ArgNotSet
2727

@@ -160,7 +160,7 @@ def get_ti_count(
160160
task_group_id: str | None = None,
161161
logical_dates: list[AwareDatetime] | None = None,
162162
run_ids: list[str] | None = None,
163-
states: list[str] | None = None,
163+
states: list[str] | list[TerminalTIState] | None = None,
164164
) -> int: ...
165165

166166
@staticmethod

0 commit comments

Comments
 (0)