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

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

                Author: ASF GitHub Bot
            Created on: 25/Oct/19 00:05
            Start Date: 25/Oct/19 00:05
    Worklog Time Spent: 10m 
      Work Description: robertwb commented on issue #9056: [BEAM-7746] Add 
python type hints
URL: https://github.com/apache/beam/pull/9056#issuecomment-546148032
 
 
   > ```
   > apache_beam/io/iobase.py:924: error: "SourceBase" has no attribute "coder" 
 [attr-defined]
   > ```
   > 
   > I can't find any sub-classes of `SourceBase` that have a coder attribute. 
Is this safe to remove or is this a dataflow thing?
   
   Good question. I think this is used by some Dataflow-only subclasses of 
NativeSource. Go ahead and add a coder @property there raising a 
NotImplementedException to suppress the warning. Hopefully we can just get rid 
of NativeSource soon. 
   
   > ```
   > apache_beam/runners/worker/statesampler_slow.py:77: error: "StateSampler" 
has no attribute "_states_by_name"  [attr-defined]
   > ```
   > 
   > `statesampler_slow.StateSampler` does not have `_states_by_name` 
attribute, but `statesampler.StateSampler` does. I could add this attribute to 
`statesampler_slow.StateSampler`, but I don't think it would be used. The more 
straightforward solution may be to edit 
`statesampler_slow.StateSampler.reset()` to do nothing. Right now I think it 
would error if it ran.
   
   Yes, just delete this for now. I'm surprised it's never called. 
   
   > ```
   > apache_beam/runners/portability/fn_api_runner_transforms.py:280: error: 
Invalid index type "Optional[str]" for "MutableMapping[str, Environment]"; 
expected type "str"  [index]
   > ```
   > 
   > It's unclear to me whether `Stage.environment` is meant to be `str` or 
`Optional[str]`. The way that it's initialized it _could_ be `Optional[str]`:
   > ...
   > In practice will there will always be at least one ParDo or Combine per 
stage? If so we should be asserting that `self.environment is not None` in 
`Stage.__init__`.
   
   In general, this should be the case, but I can't rule out, for example, a 
Flatten or similar becoming isolated into its own stage, even after fusion. I 
think we have to assume it can be None when stages are initialized. 
   
   > Alternately, we could assert that `self.environment is not None` just 
before this call in `executable_stage_transform`.
   > 
   > The bottom line is that there are currently no guarantees in the code that 
`self.environment` is not None at this point, and if it is, it will be an error.
   
   I'm fine with an assert there, though it seems noisy compared to the error 
that we'd just be getting at the next point. 
   
   > ```
   > apache_beam/runners/portability/fn_api_runner.py:933: error: 
"ParallelBundleManager" has no attribute "_skip_registration"  [attr-defined]
   > ```
   > 
   > I can't find anywhere in the code that refers to `_skip_registration`. Is 
this safe to remove?
   
   Hmm... Looks like this is an alias for registered that got mixed up in the 
multi-process refactor. 
https://github.com/apache/beam/blob/8d2997f8d7ad84649b8ecb2f7e2ca2eceb91b6d0/sdks/python/apache_beam/runners/portability/fn_api_runner.py#L1909
 Can you file a JIRA to follow up on this? 
 
----------------------------------------------------------------
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: 333782)
    Time Spent: 9h 40m  (was: 9.5h)

> 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: 9h 40m
>  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