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

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

                Author: ASF GitHub Bot
            Created on: 23/Mar/20 19:24
            Start Date: 23/Mar/20 19:24
    Worklog Time Spent: 10m 
      Work Description: chadrik commented on pull request #11038: [BEAM-7746] 
More typing fixes
URL: https://github.com/apache/beam/pull/11038#discussion_r396700454
 
 

 ##########
 File path: sdks/python/apache_beam/coders/coders.py
 ##########
 @@ -387,8 +387,11 @@ def register_structured_urn(urn, cls):
     """Register a coder that's completely defined by its urn and its
     component(s), if any, which are passed to construct the instance.
     """
-    cls.to_runner_api_parameter = (
-        lambda self, unused_context: (urn, None, self._get_component_coders()))
+    setattr(
 
 Review comment:
   mypy raises an error when overwriting a method: `Cannot assign to a method`. 
  using `setattr` avoids the error.  A similar situation arises when setting or 
getting dynamic attributes.  
   
   We need to decide on a policy for these cases:
   
   1) avoid the error using `setattr` and `getattr`
   2) silence the error with a `# type: ignore[xxx]` comment
   
   The second option provides more context, but could hinge on how you feel 
about the aesthetics of `type ignore` comments.
   
   Either way, I agree a comment should be made on the preceding line to 
clarify.
   
 
----------------------------------------------------------------
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: 408189)
    Time Spent: 77h 50m  (was: 77h 40m)

> 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: 77h 50m
>  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