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

[jira] [Commented] (BEAM-8588) MapTuple(fn) fails if fn has type hints but no default args

    [ https://issues.apache.org/jira/browse/BEAM-8588?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16969686#comment-16969686 ] 

Udi Meiri commented on BEAM-8588:
---------------------------------

One subtlety here is that it seems that the correct type hint for the input element is a Tuple (Tuple[int, int] in this case).


> MapTuple(fn) fails if fn has type hints but no default args
> -----------------------------------------------------------
>
>                 Key: BEAM-8588
>                 URL: https://issues.apache.org/jira/browse/BEAM-8588
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-py-core
>            Reporter: Udi Meiri
>            Assignee: Udi Meiri
>            Priority: Major
>
> {code}
>   def test_typed_maptuple(self):
>     def fn(e1: int, e2: int) -> int:
>       return e1 * e2
>     result = [(1, 1), (2, 2)] | beam.MapTuple(fn)
>     self.assertEqual([2, 4], sorted(result))
> {code}
> Fails in getcallargs_forhints_impl_py3 with:
> {code}
> >       raise TypeCheckError(e)
> E       apache_beam.typehints.decorators.TypeCheckError: too many positional arguments
> {code}



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