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 2021/11/16 03:38:39 UTC

[GitHub] [airflow] josh-fell commented on a change in pull request #19608: Enhance `multiple_outputs` inference of dict typing

josh-fell commented on a change in pull request #19608:
URL: https://github.com/apache/airflow/pull/19608#discussion_r749875334



##########
File path: airflow/decorators/base.py
##########
@@ -202,7 +202,16 @@ def task_decorator_factory(
     # try to infer from  type annotation
     if python_callable and multiple_outputs is None:
         sig = signature(python_callable).return_annotation
-        ttype = getattr(sig, "__origin__", None)
+
+        # If the return type annotation is already the builtins ``dict`` type, use it for the inference.
+        if sig == dict:
+            ttype = sig

Review comment:
       That particular check handles the simple `def func(...) -> dict:` case.  The remaining checks handle the `typing.Dict` and `typing.Dict[str, typing.Any]` cases.




-- 
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