Abacn commented on code in PR #36703:
URL: https://github.com/apache/beam/pull/36703#discussion_r2487089160


##########
sdks/python/apache_beam/transforms/core.py:
##########
@@ -1507,25 +1507,29 @@ def _check_fn_use_yield_and_return(fn):
     source_code = _get_function_body_without_inners(fn)
     has_yield = False
     has_return = False
-    return_none_warning = (
-        "No iterator is returned by the process method in %s.",
-        fn.__self__.__class__)
+    has_return_none = False
     for line in source_code.split("\n"):
       lstripped_line = line.lstrip()
       if lstripped_line.startswith("yield ") or lstripped_line.startswith(
           "yield("):
         has_yield = True
-      if lstripped_line.startswith("return ") or lstripped_line.startswith(
-          "return("):
+      elif lstripped_line.rstrip() == "return":
         has_return = True
-        if lstripped_line.startswith(
-            "return None") or lstripped_line.rstrip() == "return":
-          _LOGGER.warning(return_none_warning)
-      if has_yield and has_return:
+      elif lstripped_line.startswith("return ") or lstripped_line.startswith(
+          "return("):
+        if lstripped_line.startswith("return None"):
+          has_return_none = True
+        else:

Review Comment:
   done



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