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



##########
File path: airflow/operators/python.py
##########
@@ -255,6 +255,16 @@ 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)
+
+        if sig != inspect.Signature.empty and ttype in (dict, Dict):
+            multiple_outputs = True

Review comment:
       ```suggestion
           sig = signature(python_callable).return_annotation
           ttype = getattr(sig, "__origin__", None)
           multiple_outputs = sig != inspect.Signature.empty and ttype in 
(dict, Dict)
   ```




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to