Adding license text to all files. Fixing one lint issue. Refactoring runner_test
Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/11022016 Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/11022016 Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/11022016 Branch: refs/heads/python-sdk Commit: 110220168d58330f54a3e8279fbb63af036dd7df Parents: 07885c8 Author: Pablo <pabl...@google.com> Authored: Mon Oct 17 15:10:59 2016 -0700 Committer: Robert Bradshaw <rober...@google.com> Committed: Thu Oct 27 10:39:32 2016 -0700 ---------------------------------------------------------------------- sdks/python/apache_beam/runners/runner_test.py | 25 +++++++------------- .../transforms/display/display_data.py | 18 ++++++++++++++ .../transforms/display/display_data_test.py | 19 +++++++++++++++ 3 files changed, 46 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/11022016/sdks/python/apache_beam/runners/runner_test.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/runners/runner_test.py b/sdks/python/apache_beam/runners/runner_test.py index 1f73a36..8663a15 100644 --- a/sdks/python/apache_beam/runners/runner_test.py +++ b/sdks/python/apache_beam/runners/runner_test.py @@ -39,6 +39,13 @@ from apache_beam.utils.options import PipelineOptions class RunnerTest(unittest.TestCase): + default_properties = [ + '--dataflow_endpoint=ignored', + '--job_name=test-job', + '--project=test-project', + '--staging_location=ignored', + '--temp_location=/dev/null', + '--no_auth=True'] def test_create_runner(self): self.assertTrue( @@ -54,14 +61,7 @@ class RunnerTest(unittest.TestCase): def test_remote_runner_translation(self): remote_runner = DataflowPipelineRunner() p = Pipeline(remote_runner, - options=PipelineOptions([ - '--dataflow_endpoint=ignored', - '--job_name=test-job', - '--project=test-project', - '--staging_location=ignored', - '--temp_location=/dev/null', - '--no_auth=True' - ])) + options=PipelineOptions(self.default_properties)) (p | 'create' >> ptransform.Create([1, 2, 3]) # pylint: disable=expression-not-assigned | 'do' >> ptransform.FlatMap(lambda x: [(x, x)]) @@ -72,14 +72,7 @@ class RunnerTest(unittest.TestCase): def test_remote_runner_display_data(self): remote_runner = DataflowPipelineRunner() p = Pipeline(remote_runner, - options=PipelineOptions([ - '--dataflow_endpoint=ignored', - '--job_name=test-job', - '--project=test-project', - '--staging_location=ignored', - '--temp_location=/dev/null', - '--no_auth=True' - ])) + options=PipelineOptions(self.default_properties)) class SpecialParDo(beam.ParDo): def __init__(self, fn, now, *args, **kwargs): http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/11022016/sdks/python/apache_beam/transforms/display/display_data.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/transforms/display/display_data.py b/sdks/python/apache_beam/transforms/display/display_data.py index 44909ad..cee7e74 100644 --- a/sdks/python/apache_beam/transforms/display/display_data.py +++ b/sdks/python/apache_beam/transforms/display/display_data.py @@ -1,3 +1,20 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + """ DisplayData, its classes, interfaces and methods. """ @@ -11,6 +28,7 @@ import json __all__ = ['HasDisplayData', 'DisplayDataItem', 'DisplayData'] + class HasDisplayData(object): """ Basic interface for elements that contain display data. http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/11022016/sdks/python/apache_beam/transforms/display/display_data_test.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/transforms/display/display_data_test.py b/sdks/python/apache_beam/transforms/display/display_data_test.py index a107334..345e137 100644 --- a/sdks/python/apache_beam/transforms/display/display_data_test.py +++ b/sdks/python/apache_beam/transforms/display/display_data_test.py @@ -1,3 +1,22 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +"""Unit tests for the DisplayData API.""" + from __future__ import absolute_import from datetime import datetime