You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2019/11/08 18:01:00 UTC

[jira] [Work logged] (BEAM-8492) Python typehints: don't try to strip_iterable from None

     [ https://issues.apache.org/jira/browse/BEAM-8492?focusedWorklogId=340638&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-340638 ]

ASF GitHub Bot logged work on BEAM-8492:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 08/Nov/19 18:00
            Start Date: 08/Nov/19 18:00
    Worklog Time Spent: 10m 
      Work Description: udim commented on pull request #9895: [BEAM-8492] Allow None, Optional return hints for DoFn.process and friends
URL: https://github.com/apache/beam/pull/9895#discussion_r344296879
 
 

 ##########
 File path: sdks/python/apache_beam/typehints/decorators.py
 ##########
 @@ -306,7 +311,20 @@ def strip_iterable(self):
     """
     if not self.has_simple_output_type():
       return self
-    yielded_type = typehints.get_yielded_type(self.output_types[0][0])
+    output_type = self.output_types[0][0]
+    if output_type is None or isinstance(output_type, type(None)):
+      return self
+    # If output_type == Optional[T]: output_type = T.
 
 Review comment:
   Use `extract_optional_type`.
 
----------------------------------------------------------------
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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 340638)
    Time Spent: 20m  (was: 10m)

> Python typehints: don't try to strip_iterable from None
> -------------------------------------------------------
>
>                 Key: BEAM-8492
>                 URL: https://issues.apache.org/jira/browse/BEAM-8492
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-py-core
>            Reporter: Udi Meiri
>            Assignee: Udi Meiri
>            Priority: Major
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> The return value of DoFn.process can be an iterable of elements or None.
> Handle the case when the output type hint of process is None.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)