TheNeuralBit commented on code in PR #17253:
URL: https://github.com/apache/beam/pull/17253#discussion_r856667025


##########
sdks/python/apache_beam/transforms/core.py:
##########
@@ -685,6 +690,53 @@ def infer_output_type(self, input_type):
         self._strip_output_annotations(
             trivial_inference.infer_return_type(self.process, [input_type])))
 
+  @property
+  def process_defined(self) -> bool:
+    return (
+        self.process.__func__  # type: ignore
+        if hasattr(self.process, '__self__') else self.process) != DoFn.process
+
+  @property
+  def process_batch_defined(self) -> bool:
+    return (
+        self.process_batch.__func__  # type: ignore
+        if hasattr(self.process_batch, '__self__')
+        else self.process_batch) != DoFn.process_batch
+
+  def get_input_batch_type(self) -> typing.Optional[TypeConstraint]:
+    if not self.process_batch_defined:
+      return None
+    input_type = list(
+        
inspect.signature(self.process_batch).parameters.values())[0].annotation
+    if input_type == inspect.Signature.empty:
+      # TODO(BEAM-14340): Consider supporting an alternative (dynamic?) 
approach
+      # for declaring input type
+      raise TypeError(
+          f"{self.__class__.__name__}.process_batch() does not have a type "
+          "annotation on it's first parameter. This is reqired for "

Review Comment:
   thank you! I put in a superfluous apostrophe too :man_facepalming: 
   
   https://github.com/apache/beam/pull/17452



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to