Udi Meiri created BEAM-10323:
--------------------------------

             Summary: Python type hints: make WindowedValue, TimestampValue 
Generic
                 Key: BEAM-10323
                 URL: https://issues.apache.org/jira/browse/BEAM-10323
             Project: Beam
          Issue Type: Bug
          Components: sdk-py-core
            Reporter: Udi Meiri


The above classes are used as return value wrappers, thus when converting 
return value annotations to type hints, the argument of these should be used as 
the hint.

Example (this should pass but doesn't currently):
{code}
  def test_timestamped_value(self):
    def timestamped(e: int) -> beam.window.TimestampedValue[int]:
      return beam.window.TimestampedValue(e, 0)

    with TestPipeline() as p:
      pcoll = p | beam.Create([1, 2, 3]) | beam.Map(timestamped)
      self.assertEqual(int, pcoll.element_type)
{code}



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

Reply via email to