Remove label guessing from PValue
Project: http://git-wip-us.apache.org/repos/asf/beam/repo Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/fe39ae1e Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/fe39ae1e Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/fe39ae1e Branch: refs/heads/master Commit: fe39ae1e25a4fdac38fe22d3b79cbfb0d9232c30 Parents: e67384c Author: Sourabh Bajaj <sourabhba...@google.com> Authored: Wed Feb 8 15:10:04 2017 -0800 Committer: Ahmet Altay <al...@google.com> Committed: Fri Feb 10 16:59:50 2017 -0800 ---------------------------------------------------------------------- sdks/python/apache_beam/pvalue.py | 2 -- sdks/python/apache_beam/transforms/ptransform_test.py | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/beam/blob/fe39ae1e/sdks/python/apache_beam/pvalue.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/pvalue.py b/sdks/python/apache_beam/pvalue.py index 4cfdfbe..c87728c 100644 --- a/sdks/python/apache_beam/pvalue.py +++ b/sdks/python/apache_beam/pvalue.py @@ -80,8 +80,6 @@ class PValue(object): optional first label and a transform/callable object. It will call the pipeline.apply() method with this modified argument list. """ - if isinstance(args[0], basestring): - kwargs['label'], args = args[0], args[1:] arglist = list(args) arglist.insert(1, self) return self.pipeline.apply(*arglist, **kwargs) http://git-wip-us.apache.org/repos/asf/beam/blob/fe39ae1e/sdks/python/apache_beam/transforms/ptransform_test.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/transforms/ptransform_test.py b/sdks/python/apache_beam/transforms/ptransform_test.py index e37fd43..3706f37 100644 --- a/sdks/python/apache_beam/transforms/ptransform_test.py +++ b/sdks/python/apache_beam/transforms/ptransform_test.py @@ -541,8 +541,8 @@ class PTransformTest(unittest.TestCase): pipeline = TestPipeline() pcoll = pipeline | 'Start' >> beam.Create( [(3, 1), (2, 1), (1, 1), (3, 2), (2, 2), (3, 3)]) - keys = pcoll.apply('keys', beam.Keys()) - vals = pcoll.apply('vals', beam.Values()) + keys = pcoll.apply(beam.Keys('keys')) + vals = pcoll.apply(beam.Values('vals')) assert_that(keys, equal_to([1, 2, 2, 3, 3, 3]), label='assert:keys') assert_that(vals, equal_to([1, 1, 1, 2, 2, 3]), label='assert:vals') pipeline.run() @@ -551,7 +551,7 @@ class PTransformTest(unittest.TestCase): pipeline = TestPipeline() pcoll = pipeline | 'Start' >> beam.Create( [(6, 3), (1, 2), (7, 1), (5, 2), (3, 2)]) - result = pcoll.apply('swap', beam.KvSwap()) + result = pcoll.apply(beam.KvSwap(), label='swap') assert_that(result, equal_to([(1, 7), (2, 1), (2, 3), (2, 5), (3, 6)])) pipeline.run() @@ -559,7 +559,7 @@ class PTransformTest(unittest.TestCase): pipeline = TestPipeline() pcoll = pipeline | 'Start' >> beam.Create( [6, 3, 1, 1, 9, 'pleat', 'pleat', 'kazoo', 'navel']) - result = pcoll.apply('nodupes', beam.RemoveDuplicates()) + result = pcoll.apply(beam.RemoveDuplicates()) assert_that(result, equal_to([1, 3, 6, 9, 'pleat', 'kazoo', 'navel'])) pipeline.run()