Repository: beam Updated Branches: refs/heads/python-sdk a779ac15d -> 020daa96c
Updated ptransform.apply() to ptransform.expand() in the comments. Project: http://git-wip-us.apache.org/repos/asf/beam/repo Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/c534cf1a Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/c534cf1a Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/c534cf1a Branch: refs/heads/python-sdk Commit: c534cf1a9ae497f801381113278ea051b13f153f Parents: a779ac1 Author: Younghee Kwon <[email protected]> Authored: Fri Dec 30 14:32:58 2016 -0800 Committer: Robert Bradshaw <[email protected]> Committed: Tue Jan 3 10:43:49 2017 -0800 ---------------------------------------------------------------------- sdks/python/apache_beam/transforms/core.py | 4 ++-- sdks/python/apache_beam/transforms/ptransform.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/beam/blob/c534cf1a/sdks/python/apache_beam/transforms/core.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/transforms/core.py b/sdks/python/apache_beam/transforms/core.py index 6a7bd2e..72f7cd4 100644 --- a/sdks/python/apache_beam/transforms/core.py +++ b/sdks/python/apache_beam/transforms/core.py @@ -122,7 +122,7 @@ class DoFnProcessContext(DoFnContext): class DoFn(WithTypeHints, HasDisplayData): """A function object used by a transform with custom processing. - The ParDo transform is such a transform. The ParDo.apply + The ParDo transform is such a transform. The ParDo.expand() method will take an object of type DoFn and apply it to all elements of a PCollection object. @@ -551,7 +551,7 @@ class ParDo(PTransformWithSideInputs): returning the accumulated results into an output PCollection. The type of the elements is not fixed as long as the DoFn can deal with it. In reality the type is restrained to some extent because the elements sometimes must be - persisted to external storage. See the apply() method comments for a detailed + persisted to external storage. See the expand() method comments for a detailed description of all possible arguments. Note that the DoFn must return an iterable for each element of the input http://git-wip-us.apache.org/repos/asf/beam/blob/c534cf1a/sdks/python/apache_beam/transforms/ptransform.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/transforms/ptransform.py b/sdks/python/apache_beam/transforms/ptransform.py index c022c5e..006a937 100644 --- a/sdks/python/apache_beam/transforms/ptransform.py +++ b/sdks/python/apache_beam/transforms/ptransform.py @@ -21,11 +21,11 @@ A PTransform is an object describing (not executing) a computation. The actual execution semantics for a transform is captured by a runner object. A transform object always belongs to a pipeline object. -A PTransform derived class needs to define the apply() method that describes +A PTransform derived class needs to define the expand() method that describes how one or more PValues are created by the transform. The module defines a few standard transforms: FlatMap (parallel do), -GroupByKey (group by key), etc. Note that the apply() methods for these +GroupByKey (group by key), etc. Note that the expand() methods for these classes contain code that will add nodes to the processing graph associated with a pipeline. @@ -172,12 +172,12 @@ class ZipPValues(_PValueishTransform): class PTransform(WithTypeHints, HasDisplayData): """A transform object used to modify one or more PCollections. - Subclasses must define an apply() method that will be used when the transform + Subclasses must define an expand() method that will be used when the transform is applied to some arguments. Typical usage pattern will be: input | CustomTransform(...) - The apply() method of the CustomTransform object passed in will be called + The expand() method of the CustomTransform object passed in will be called with input as an argument. """ # By default, transforms don't have any side inputs. @@ -683,7 +683,7 @@ def ptransform_fn(fn): A CallablePTransform instance wrapping the function-based PTransform. This wrapper provides an alternative, simpler way to define a PTransform. - The standard method is to subclass from PTransform and override the apply() + The standard method is to subclass from PTransform and override the expand() method. An equivalent effect can be obtained by defining a function that an input PCollection and additional optional arguments and returns a resulting PCollection. For example:: @@ -739,4 +739,4 @@ class _NamedPTransform(PTransform): return self.transform.__ror__(pvalueish, self.label) def expand(self, pvalue): - raise RuntimeError("Should never be applied directly.") + raise RuntimeError("Should never be expanded directly.")
