You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/06/09 16:30:24 UTC

[GitHub] [beam] robertwb commented on a diff in pull request #17822: Allow creation of dynamically defined transforms in the Python expansion service.

robertwb commented on code in PR #17822:
URL: https://github.com/apache/beam/pull/17822#discussion_r893724451


##########
sdks/python/apache_beam/transforms/fully_qualified_named_transform.py:
##########
@@ -52,16 +52,37 @@ def __init__(self, constructor, args, kwargs):
     self._kwargs = kwargs
 
   def expand(self, pinput):
-    return pinput | self._resolve(self._constructor)(
-        *self._args, **self._kwargs)
+    if self._constructor in ('__callable__', '__constructor__'):
+      self._check_allowed(self._constructor)
+      if self._args:
+        source, *args = tuple(self._args)
+        kwargs = self._kwargs
+      else:
+        args = self._args
+        kwargs = dict(self._kwargs)
+        source = kwargs.pop('source')
+
+      if self._constructor == '__constructor__':

Review Comment:
   Fair point. 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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org