You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/08/31 06:07:16 UTC
[GitHub] [airflow] uranusjr commented on a diff in pull request #26077: FIX Incorrect typing information
uranusjr commented on code in PR #26077:
URL: https://github.com/apache/airflow/pull/26077#discussion_r959191405
##########
airflow/models/dagrun.py:
##########
@@ -945,7 +945,7 @@ def _check_for_removed_or_restored_tasks(
def _get_task_creator(
self, created_counts: Dict[str, int], ti_mutation_hook: Callable, hook_is_noop: bool
- ) -> Callable:
+ ) -> Callable[[Operator, Tuple[int, ...]], Union[Iterator[Dict[str, Any]], Iterator[TI]]]:
Review Comment:
It’s probably a good idea to make this an overload
```python
@overload
def _get_task_creator(
self,
created_counts: Dict[str, int],
ti_mutation_hook: Callable,
hook_is_noop: Literal[True],
) -> Callable[[Operator, Tuple[int, ...]], Iterator[Dict[str, Any]]]:
...
@overload
def _get_task_creator(
self,
created_counts: Dict[str, int],
ti_mutation_hook: Callable,
hook_is_noop: Literal[False],
) -> Callable[[Operator, Tuple[int, ...]], Iterator[TI]]:
...
def _get_task_creator(
self,
created_counts: Dict[str, int],
ti_mutation_hook: Callable,
hook_is_noop: bool,
) -> Callable[[Operator, Tuple[int, ...]], Union[Iterator[Dict[str, Any]], Iterator[TI]]]:
# Actual implementation...
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org