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 2020/12/08 23:05:56 UTC

[GitHub] [airflow] casassg commented on a change in pull request #10349: infer multiple_output from return type annotation

casassg commented on a change in pull request #10349:
URL: https://github.com/apache/airflow/pull/10349#discussion_r538875525



##########
File path: airflow/operators/python.py
##########
@@ -258,6 +258,12 @@ def task(
     :type multiple_outputs: bool
 
     """
+    # 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)
+
+        multiple_outputs = sig != inspect.Signature.empty and ttype in (dict, Dict)

Review comment:
       We decided not to automatically unroll tuples/lists: https://github.com/apache/airflow/pull/8962#discussion_r429146569




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org