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

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

                Author: ASF GitHub Bot
            Created on: 07/May/20 21:16
            Start Date: 07/May/20 21:16
    Worklog Time Spent: 10m 
      Work Description: chadrik commented on a change in pull request #11632:
URL: https://github.com/apache/beam/pull/11632#discussion_r421799103



##########
File path: sdks/python/apache_beam/dataframe/transforms.py
##########
@@ -248,7 +261,12 @@ def _dict_union(dicts):
   return result
 
 
-def _flatten(valueish, root=()):
+def _flatten(
+    valueish,  # type: Union[T, Tuple[T, ...], Dict[Any, T]]

Review comment:
       I should mention that typing provides a lot of opportunity to go down 
rabbit-holes, so the right answer is often "it would be more accurate, but it's 
not that valuable".   A common motivator behind investing in accurately typing 
utility functions is when it allows you to avoid adding manual / explicit types 
or casts elsewhere in the code.   Imagine a scenario where mypy knows key of 
the `valueish` map, but after it passes through `_flatten`, you need to re-type 
the result because it becomes `Any`.
   
   
   




----------------------------------------------------------------
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:
[email protected]


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

    Worklog Id:     (was: 431899)
    Time Spent: 81.5h  (was: 81h 20m)

> Add type hints to python code
> -----------------------------
>
>                 Key: BEAM-7746
>                 URL: https://issues.apache.org/jira/browse/BEAM-7746
>             Project: Beam
>          Issue Type: New Feature
>          Components: sdk-py-core
>            Reporter: Chad Dombrova
>            Assignee: Chad Dombrova
>            Priority: Major
>          Time Spent: 81.5h
>  Remaining Estimate: 0h
>
> As a developer of the beam source code, I would like the code to use pep484 
> type hints so that I can clearly see what types are required, get completion 
> in my IDE, and enforce code correctness via a static analyzer like mypy.
> This may be considered a precursor to BEAM-7060
> Work has been started here:  [https://github.com/apache/beam/pull/9056]
>  
>  



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

Reply via email to