You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by al...@apache.org on 2017/04/26 02:03:01 UTC
[1/2] beam git commit: [BEAM-1749] Upgrade to pycodestyle
Repository: beam
Updated Branches:
refs/heads/master 9213f34d3 -> 1675f03f7
[BEAM-1749] Upgrade to pycodestyle
Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/6571bae3
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/6571bae3
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/6571bae3
Branch: refs/heads/master
Commit: 6571bae30acff45575f7397b92aef8c3d2d228fe
Parents: 9213f34
Author: Sourabh Bajaj <so...@google.com>
Authored: Tue Apr 25 16:00:18 2017 -0700
Committer: Ahmet Altay <al...@google.com>
Committed: Tue Apr 25 19:02:32 2017 -0700
----------------------------------------------------------------------
sdks/python/apache_beam/coders/coders_test.py | 1 +
sdks/python/apache_beam/coders/fast_coders_test.py | 1 +
sdks/python/apache_beam/coders/slow_coders_test.py | 1 +
sdks/python/apache_beam/examples/complete/autocomplete_test.py | 1 +
.../apache_beam/examples/complete/game/hourly_team_score.py | 1 +
.../examples/complete/game/hourly_team_score_test.py | 1 +
sdks/python/apache_beam/examples/complete/game/user_score.py | 1 +
.../apache_beam/examples/complete/game/user_score_test.py | 1 +
.../examples/complete/juliaset/juliaset/juliaset_test.py | 1 +
.../apache_beam/examples/cookbook/bigquery_tornadoes_it_test.py | 1 +
sdks/python/apache_beam/examples/wordcount.py | 1 +
sdks/python/apache_beam/examples/wordcount_debugging_test.py | 1 +
sdks/python/apache_beam/internal/module_test.py | 1 +
sdks/python/apache_beam/internal/pickler.py | 3 +++
sdks/python/apache_beam/internal/pickler_test.py | 1 +
sdks/python/apache_beam/io/concat_source_test.py | 1 +
sdks/python/apache_beam/io/filebasedsource_test.py | 1 +
sdks/python/apache_beam/io/gcp/datastore/v1/datastoreio_test.py | 1 +
sdks/python/apache_beam/io/gcp/pubsub_test.py | 1 +
sdks/python/apache_beam/io/source_test_utils.py | 1 +
sdks/python/apache_beam/io/source_test_utils_test.py | 1 +
sdks/python/apache_beam/io/tfrecordio.py | 2 ++
sdks/python/apache_beam/io/tfrecordio_test.py | 1 +
.../apache_beam/runners/dataflow/dataflow_metrics_test.py | 1 +
sdks/python/apache_beam/runners/dataflow/native_io/iobase.py | 1 +
sdks/python/apache_beam/transforms/window.py | 4 ++++
sdks/python/apache_beam/transforms/window_test.py | 2 ++
sdks/python/apache_beam/typehints/decorators.py | 1 +
sdks/python/apache_beam/typehints/opcodes.py | 5 ++++-
sdks/python/apache_beam/typehints/typehints_test.py | 1 +
sdks/python/apache_beam/utils/annotations.py | 1 +
.../python/apache_beam/utils/pipeline_options_validator_test.py | 1 +
sdks/python/apache_beam/utils/test_stream_test.py | 1 +
sdks/python/run_pylint.sh | 4 ++--
sdks/python/tox.ini | 4 ++--
35 files changed, 47 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/coders/coders_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/coders/coders_test.py b/sdks/python/apache_beam/coders/coders_test.py
index ba505db..575503b 100644
--- a/sdks/python/apache_beam/coders/coders_test.py
+++ b/sdks/python/apache_beam/coders/coders_test.py
@@ -110,6 +110,7 @@ class FallbackCoderTest(unittest.TestCase):
self.assertEqual(coder, coders.FastPrimitivesCoder())
self.assertEqual(DummyClass(), coder.decode(coder.encode(DummyClass())))
+
if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
unittest.main()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/coders/fast_coders_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/coders/fast_coders_test.py b/sdks/python/apache_beam/coders/fast_coders_test.py
index 55cf16c..a13334a 100644
--- a/sdks/python/apache_beam/coders/fast_coders_test.py
+++ b/sdks/python/apache_beam/coders/fast_coders_test.py
@@ -32,6 +32,7 @@ class FastCoders(unittest.TestCase):
# pylint: disable=unused-variable
import apache_beam.coders.stream
+
if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
unittest.main()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/coders/slow_coders_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/coders/slow_coders_test.py b/sdks/python/apache_beam/coders/slow_coders_test.py
index 1f22e3d..97aa39c 100644
--- a/sdks/python/apache_beam/coders/slow_coders_test.py
+++ b/sdks/python/apache_beam/coders/slow_coders_test.py
@@ -40,6 +40,7 @@ class SlowCoders(unittest.TestCase):
# pylint: disable=unused-variable
import apache_beam.coders.stream
+
if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
unittest.main()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/examples/complete/autocomplete_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/complete/autocomplete_test.py b/sdks/python/apache_beam/examples/complete/autocomplete_test.py
index edf95f0..d59d0f5 100644
--- a/sdks/python/apache_beam/examples/complete/autocomplete_test.py
+++ b/sdks/python/apache_beam/examples/complete/autocomplete_test.py
@@ -48,5 +48,6 @@ class AutocompleteTest(unittest.TestCase):
]))
p.run()
+
if __name__ == '__main__':
unittest.main()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/examples/complete/game/hourly_team_score.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/complete/game/hourly_team_score.py b/sdks/python/apache_beam/examples/complete/game/hourly_team_score.py
index 6ddf014..1d1cee8 100644
--- a/sdks/python/apache_beam/examples/complete/game/hourly_team_score.py
+++ b/sdks/python/apache_beam/examples/complete/game/hourly_team_score.py
@@ -289,6 +289,7 @@ def run(argv=None):
result = p.run()
result.wait_until_finish()
+
if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
run()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/examples/complete/game/hourly_team_score_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/complete/game/hourly_team_score_test.py b/sdks/python/apache_beam/examples/complete/game/hourly_team_score_test.py
index 1d93c34..0eaa8c6 100644
--- a/sdks/python/apache_beam/examples/complete/game/hourly_team_score_test.py
+++ b/sdks/python/apache_beam/examples/complete/game/hourly_team_score_test.py
@@ -47,6 +47,7 @@ class HourlyTeamScoreTest(unittest.TestCase):
beam.assert_that(result, beam.equal_to([
('team1', 18), ('team2', 2), ('team3', 13)]))
+
if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
unittest.main()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/examples/complete/game/user_score.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/complete/game/user_score.py b/sdks/python/apache_beam/examples/complete/game/user_score.py
index b53d5e9..02d4775 100644
--- a/sdks/python/apache_beam/examples/complete/game/user_score.py
+++ b/sdks/python/apache_beam/examples/complete/game/user_score.py
@@ -212,6 +212,7 @@ def run(argv=None):
result = p.run()
result.wait_until_finish()
+
if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
run()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/examples/complete/game/user_score_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/complete/game/user_score_test.py b/sdks/python/apache_beam/examples/complete/game/user_score_test.py
index 6ed1462..750729d 100644
--- a/sdks/python/apache_beam/examples/complete/game/user_score_test.py
+++ b/sdks/python/apache_beam/examples/complete/game/user_score_test.py
@@ -44,6 +44,7 @@ class UserScoreTest(unittest.TestCase):
('user1_team1', 50), ('user2_team2', 2), ('user3_team3', 8),
('user4_team3', 5)]))
+
if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
unittest.main()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/examples/complete/juliaset/juliaset/juliaset_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/complete/juliaset/juliaset/juliaset_test.py b/sdks/python/apache_beam/examples/complete/juliaset/juliaset/juliaset_test.py
index c13e857..17d9cf3 100644
--- a/sdks/python/apache_beam/examples/complete/juliaset/juliaset/juliaset_test.py
+++ b/sdks/python/apache_beam/examples/complete/juliaset/juliaset/juliaset_test.py
@@ -81,6 +81,7 @@ class JuliaSetTest(unittest.TestCase):
# TODO(silviuc): Reactivate the test when --image_output is supported.
# self.assertTrue(os.stat(temp_image_file).st_size > 0)
+
if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
unittest.main()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/examples/cookbook/bigquery_tornadoes_it_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/cookbook/bigquery_tornadoes_it_test.py b/sdks/python/apache_beam/examples/cookbook/bigquery_tornadoes_it_test.py
index 709e3d5..3e302d1 100644
--- a/sdks/python/apache_beam/examples/cookbook/bigquery_tornadoes_it_test.py
+++ b/sdks/python/apache_beam/examples/cookbook/bigquery_tornadoes_it_test.py
@@ -60,6 +60,7 @@ class BigqueryTornadoesIT(unittest.TestCase):
bigquery_tornadoes.run(
test_pipeline.get_full_options_as_args(**extra_opts))
+
if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
unittest.main()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/examples/wordcount.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/wordcount.py b/sdks/python/apache_beam/examples/wordcount.py
index a155148..e93fd2b 100644
--- a/sdks/python/apache_beam/examples/wordcount.py
+++ b/sdks/python/apache_beam/examples/wordcount.py
@@ -119,6 +119,7 @@ def run(argv=None):
logging.info('number of empty lines: %d', empty_lines_counter.committed)
# TODO(pabloem)(BEAM-1366): Add querying of MEAN metrics.
+
if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
run()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/examples/wordcount_debugging_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/wordcount_debugging_test.py b/sdks/python/apache_beam/examples/wordcount_debugging_test.py
index 91679dd..900a8e7 100644
--- a/sdks/python/apache_beam/examples/wordcount_debugging_test.py
+++ b/sdks/python/apache_beam/examples/wordcount_debugging_test.py
@@ -54,6 +54,7 @@ class WordCountTest(unittest.TestCase):
results = self.get_results(temp_path)
self.assertEqual(sorted(results), sorted(expected_words))
+
if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
unittest.main()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/internal/module_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/internal/module_test.py b/sdks/python/apache_beam/internal/module_test.py
index 4ffd25c..c7bb320 100644
--- a/sdks/python/apache_beam/internal/module_test.py
+++ b/sdks/python/apache_beam/internal/module_test.py
@@ -59,4 +59,5 @@ def create_class(datum):
return 'Z:%s' % datum
return Z()
+
XYZ_OBJECT = Xyz()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/internal/pickler.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/internal/pickler.py b/sdks/python/apache_beam/internal/pickler.py
index 3f3f657..ed429fe 100644
--- a/sdks/python/apache_beam/internal/pickler.py
+++ b/sdks/python/apache_beam/internal/pickler.py
@@ -94,6 +94,7 @@ def _nested_type_wrapper(fun):
return wrapper
+
# Monkey patch the standard pickler dispatch table entry for type objects.
# Dill, for certain types, defers to the standard pickler (including type
# objects). We wrap the standard handler using type_wrapper() because
@@ -109,6 +110,8 @@ dill.dill.Pickler.dispatch[type] = _nested_type_wrapper(
# on some versions of Python.
def reject_generators(unused_pickler, unused_obj):
raise TypeError("can't (safely) pickle generator objects")
+
+
dill.dill.Pickler.dispatch[types.GeneratorType] = reject_generators
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/internal/pickler_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/internal/pickler_test.py b/sdks/python/apache_beam/internal/pickler_test.py
index 0952a26..05062d2 100644
--- a/sdks/python/apache_beam/internal/pickler_test.py
+++ b/sdks/python/apache_beam/internal/pickler_test.py
@@ -80,5 +80,6 @@ class PicklerTest(unittest.TestCase):
with self.assertRaises(TypeError):
dumps((_ for _ in range(10)))
+
if __name__ == '__main__':
unittest.main()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/io/concat_source_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/concat_source_test.py b/sdks/python/apache_beam/io/concat_source_test.py
index 7c16e63..807c3fd 100644
--- a/sdks/python/apache_beam/io/concat_source_test.py
+++ b/sdks/python/apache_beam/io/concat_source_test.py
@@ -226,6 +226,7 @@ class ConcatSourceTest(unittest.TestCase):
])
source_test_utils.assert_split_at_fraction_exhaustive(source)
+
if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
unittest.main()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/io/filebasedsource_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/filebasedsource_test.py b/sdks/python/apache_beam/io/filebasedsource_test.py
index 5318c4d..f6cdf26 100644
--- a/sdks/python/apache_beam/io/filebasedsource_test.py
+++ b/sdks/python/apache_beam/io/filebasedsource_test.py
@@ -726,6 +726,7 @@ class TestSingleFileSource(unittest.TestCase):
read_data.extend(data_from_split)
self.assertItemsEqual(expected_data[2:9], read_data)
+
if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
unittest.main()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/io/gcp/datastore/v1/datastoreio_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/gcp/datastore/v1/datastoreio_test.py b/sdks/python/apache_beam/io/gcp/datastore/v1/datastoreio_test.py
index 8eed0f8..6adc08a 100644
--- a/sdks/python/apache_beam/io/gcp/datastore/v1/datastoreio_test.py
+++ b/sdks/python/apache_beam/io/gcp/datastore/v1/datastoreio_test.py
@@ -241,5 +241,6 @@ class DatastoreioTest(unittest.TestCase):
split_queries.append(q)
return split_queries
+
if __name__ == '__main__':
unittest.main()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/io/gcp/pubsub_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/gcp/pubsub_test.py b/sdks/python/apache_beam/io/gcp/pubsub_test.py
index a83e9a8..1642a95 100644
--- a/sdks/python/apache_beam/io/gcp/pubsub_test.py
+++ b/sdks/python/apache_beam/io/gcp/pubsub_test.py
@@ -58,6 +58,7 @@ class TestPubSubSink(unittest.TestCase):
hc.assert_that(dd.items, hc.contains_inanyorder(*expected_items))
+
if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
unittest.main()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/io/source_test_utils.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/source_test_utils.py b/sdks/python/apache_beam/io/source_test_utils.py
index 5584fa7..91aae33 100644
--- a/sdks/python/apache_beam/io/source_test_utils.py
+++ b/sdks/python/apache_beam/io/source_test_utils.py
@@ -479,6 +479,7 @@ def assert_split_at_fraction_binary(
source, expected_items, num_items_to_read_before_split,
middle_fraction, middle_result, right_fraction, right_result, stats)
+
MAX_CONCURRENT_SPLITTING_TRIALS_PER_ITEM = 100
MAX_CONCURRENT_SPLITTING_TRIALS_TOTAL = 1000
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/io/source_test_utils_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/source_test_utils_test.py b/sdks/python/apache_beam/io/source_test_utils_test.py
index b822fc5..00522c9 100644
--- a/sdks/python/apache_beam/io/source_test_utils_test.py
+++ b/sdks/python/apache_beam/io/source_test_utils_test.py
@@ -117,6 +117,7 @@ class SourceTestUtilsTest(unittest.TestCase):
source = self._create_source(data)
source_test_utils.assert_split_at_fraction_exhaustive(source)
+
if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
unittest.main()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/io/tfrecordio.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/tfrecordio.py b/sdks/python/apache_beam/io/tfrecordio.py
index e2b41bf..2f7f4dc 100644
--- a/sdks/python/apache_beam/io/tfrecordio.py
+++ b/sdks/python/apache_beam/io/tfrecordio.py
@@ -46,6 +46,8 @@ def _default_crc32c_fn(value):
'be.')
_default_crc32c_fn.fn = crcmod.predefined.mkPredefinedCrcFun('crc-32c')
return _default_crc32c_fn.fn(value)
+
+
_default_crc32c_fn.fn = None
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/io/tfrecordio_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/tfrecordio_test.py b/sdks/python/apache_beam/io/tfrecordio_test.py
index d8c706e..29a9fb8 100644
--- a/sdks/python/apache_beam/io/tfrecordio_test.py
+++ b/sdks/python/apache_beam/io/tfrecordio_test.py
@@ -402,6 +402,7 @@ class TestEnd2EndWriteAndRead(_TestCaseWithTempDirCleanUp):
actual_data = p | ReadFromTFRecord(path+'-*', validate=True)
beam.assert_that(actual_data, beam.equal_to(expected_data))
+
if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
unittest.main()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/runners/dataflow/dataflow_metrics_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/dataflow/dataflow_metrics_test.py b/sdks/python/apache_beam/runners/dataflow/dataflow_metrics_test.py
index ffee3e5..51a186d 100644
--- a/sdks/python/apache_beam/runners/dataflow/dataflow_metrics_test.py
+++ b/sdks/python/apache_beam/runners/dataflow/dataflow_metrics_test.py
@@ -194,5 +194,6 @@ class TestDataflowMetrics(unittest.TestCase):
sorted(expected_counters,
key=lambda x: x.key.metric.name))
+
if __name__ == '__main__':
unittest.main()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/runners/dataflow/native_io/iobase.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/dataflow/native_io/iobase.py b/sdks/python/apache_beam/runners/dataflow/native_io/iobase.py
index 26ebe08..188b4af 100644
--- a/sdks/python/apache_beam/runners/dataflow/native_io/iobase.py
+++ b/sdks/python/apache_beam/runners/dataflow/native_io/iobase.py
@@ -33,6 +33,7 @@ def _dict_printable_fields(dict_object, skip_fields):
if (value or value == 0)
and name not in skip_fields]
+
_minor_fields = ['coder', 'key_coder', 'value_coder',
'config_bytes', 'elements',
'append_trailing_newlines', 'strip_trailing_newlines',
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/transforms/window.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/transforms/window.py b/sdks/python/apache_beam/transforms/window.py
index 643cb99..7e56c23 100644
--- a/sdks/python/apache_beam/transforms/window.py
+++ b/sdks/python/apache_beam/transforms/window.py
@@ -322,6 +322,7 @@ class GlobalWindows(NonMergingWindowFn):
def to_runner_api_parameter(self, context):
return urns.GLOBAL_WINDOWS_FN, None
+
WindowFn.register_urn(
urns.GLOBAL_WINDOWS_FN, None, GlobalWindows.from_runner_api_parameter)
@@ -372,6 +373,7 @@ class FixedWindows(NonMergingWindowFn):
proto_utils.pack_Struct(size=self.size.micros,
offset=self.offset.micros))
+
WindowFn.register_urn(
urns.FIXED_WINDOWS_FN,
struct_pb2.Struct,
@@ -431,6 +433,7 @@ class SlidingWindows(NonMergingWindowFn):
offset=self.offset.micros,
period=self.period.micros))
+
WindowFn.register_urn(
urns.SLIDING_WINDOWS_FN,
struct_pb2.Struct,
@@ -492,6 +495,7 @@ class Sessions(WindowFn):
return (urns.SESSION_WINDOWS_FN,
proto_utils.pack_Struct(gap_size=self.gap_size.micros))
+
WindowFn.register_urn(
urns.SESSION_WINDOWS_FN,
struct_pb2.Struct,
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/transforms/window_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/transforms/window_test.py b/sdks/python/apache_beam/transforms/window_test.py
index cbfd0b2..38a2df8 100644
--- a/sdks/python/apache_beam/transforms/window_test.py
+++ b/sdks/python/apache_beam/transforms/window_test.py
@@ -57,6 +57,8 @@ class ReifyWindowsFn(core.DoFn):
def process(self, element, window=core.DoFn.WindowParam):
key, values = element
yield "%s @ %s" % (key, window), values
+
+
reify_windows = core.ParDo(ReifyWindowsFn())
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/typehints/decorators.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/typehints/decorators.py b/sdks/python/apache_beam/typehints/decorators.py
index af6c499..4eabdba 100644
--- a/sdks/python/apache_beam/typehints/decorators.py
+++ b/sdks/python/apache_beam/typehints/decorators.py
@@ -126,6 +126,7 @@ def getargspec(func):
else:
raise
+
inspect.getargspec = getargspec
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/typehints/opcodes.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/typehints/opcodes.py b/sdks/python/apache_beam/typehints/opcodes.py
index 3cc0a4b..042acc0 100644
--- a/sdks/python/apache_beam/typehints/opcodes.py
+++ b/sdks/python/apache_beam/typehints/opcodes.py
@@ -107,6 +107,8 @@ def symmetric_binary_op(state, unused_arg):
state.stack.append(type(a)(union(element_type(a), element_type(b))))
else:
state.stack.append(Any)
+
+
# Except for int ** -int
binary_power = inplace_power = symmetric_binary_op
binary_multiply = inplace_multiply = symmetric_binary_op
@@ -138,6 +140,7 @@ def binary_subscr(state, unused_arg):
out = element_type(tos)
state.stack.append(out)
+
# As far as types are concerned.
binary_lshift = inplace_lshift = binary_rshift = inplace_rshift = pop_top
@@ -275,10 +278,10 @@ import_from = push_value(Any)
def load_global(state, arg):
state.stack.append(state.get_global(arg))
+
# setup_loop
# setup_except
# setup_finally
-
store_map = pop_two
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/typehints/typehints_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/typehints/typehints_test.py b/sdks/python/apache_beam/typehints/typehints_test.py
index 8ebe3e4..f90b5e9 100644
--- a/sdks/python/apache_beam/typehints/typehints_test.py
+++ b/sdks/python/apache_beam/typehints/typehints_test.py
@@ -1057,5 +1057,6 @@ class DecoratorHelpers(TypeHintTestCase):
{'a': int, 'b': str, 'c': Any, 'd': Tuple[Any, ...]},
getcallargs_forhints(func, *[int, Tuple[str, Any]]))
+
if __name__ == '__main__':
unittest.main()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/utils/annotations.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/utils/annotations.py b/sdks/python/apache_beam/utils/annotations.py
index 1ec0848..263eb94 100644
--- a/sdks/python/apache_beam/utils/annotations.py
+++ b/sdks/python/apache_beam/utils/annotations.py
@@ -96,6 +96,7 @@ def annotate(label, since, current):
return inner
return _annotate
+
# Use partial application to customize each annotation.
# 'current' will be optional in both deprecated and experimental
# while 'since' will be mandatory for deprecated.
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/utils/pipeline_options_validator_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/utils/pipeline_options_validator_test.py b/sdks/python/apache_beam/utils/pipeline_options_validator_test.py
index cb7cd84..4b03c1f 100644
--- a/sdks/python/apache_beam/utils/pipeline_options_validator_test.py
+++ b/sdks/python/apache_beam/utils/pipeline_options_validator_test.py
@@ -337,6 +337,7 @@ class SetupTest(unittest.TestCase):
self.assertEqual(
self.check_errors_for_arguments(errors, case['errors']), [])
+
if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
unittest.main()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/apache_beam/utils/test_stream_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/utils/test_stream_test.py b/sdks/python/apache_beam/utils/test_stream_test.py
index cc207ee..b5b5c69 100644
--- a/sdks/python/apache_beam/utils/test_stream_test.py
+++ b/sdks/python/apache_beam/utils/test_stream_test.py
@@ -78,5 +78,6 @@ class TestStreamTest(unittest.TestCase):
TimestampedValue('a', timestamp.MAX_TIMESTAMP)
]))
+
if __name__ == '__main__':
unittest.main()
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/run_pylint.sh
----------------------------------------------------------------------
diff --git a/sdks/python/run_pylint.sh b/sdks/python/run_pylint.sh
index 11e0526..a5e3fa1 100755
--- a/sdks/python/run_pylint.sh
+++ b/sdks/python/run_pylint.sh
@@ -62,5 +62,5 @@ echo "Skipping lint for generated files: $FILES_TO_IGNORE"
echo "Running pylint for module $MODULE:"
pylint $MODULE --ignore-patterns="$FILES_TO_IGNORE"
-echo "Running pep8 for module $MODULE:"
-pep8 $MODULE --exclude="$FILES_TO_IGNORE"
+echo "Running pycodestyle for module $MODULE:"
+pycodestyle $MODULE --exclude="$FILES_TO_IGNORE"
http://git-wip-us.apache.org/repos/asf/beam/blob/6571bae3/sdks/python/tox.ini
----------------------------------------------------------------------
diff --git a/sdks/python/tox.ini b/sdks/python/tox.ini
index 1dd464e..9c40eb5 100644
--- a/sdks/python/tox.ini
+++ b/sdks/python/tox.ini
@@ -19,7 +19,7 @@
envlist = py27,py27gcp,py27cython,lint,docs
toxworkdir = {toxinidir}/target/.tox
-[pep8]
+[pycodestyle]
# Disable all errors and warnings except for the ones related to blank lines.
# pylint does not check the number of blank lines.
select = E3
@@ -72,7 +72,7 @@ passenv = TRAVIS*
[testenv:lint]
deps=
nose==1.3.7
- pep8==1.7.0
+ pycodestyle==2.3.1
pylint==1.7.1
commands =
pip install -e .[test]
[2/2] beam git commit: This closes #2686
Posted by al...@apache.org.
This closes #2686
Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/1675f03f
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/1675f03f
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/1675f03f
Branch: refs/heads/master
Commit: 1675f03f7fb70bcdbbc36dbe094bd7ece4b82fac
Parents: 9213f34 6571bae
Author: Ahmet Altay <al...@google.com>
Authored: Tue Apr 25 19:02:50 2017 -0700
Committer: Ahmet Altay <al...@google.com>
Committed: Tue Apr 25 19:02:50 2017 -0700
----------------------------------------------------------------------
sdks/python/apache_beam/coders/coders_test.py | 1 +
sdks/python/apache_beam/coders/fast_coders_test.py | 1 +
sdks/python/apache_beam/coders/slow_coders_test.py | 1 +
sdks/python/apache_beam/examples/complete/autocomplete_test.py | 1 +
.../apache_beam/examples/complete/game/hourly_team_score.py | 1 +
.../examples/complete/game/hourly_team_score_test.py | 1 +
sdks/python/apache_beam/examples/complete/game/user_score.py | 1 +
.../apache_beam/examples/complete/game/user_score_test.py | 1 +
.../examples/complete/juliaset/juliaset/juliaset_test.py | 1 +
.../apache_beam/examples/cookbook/bigquery_tornadoes_it_test.py | 1 +
sdks/python/apache_beam/examples/wordcount.py | 1 +
sdks/python/apache_beam/examples/wordcount_debugging_test.py | 1 +
sdks/python/apache_beam/internal/module_test.py | 1 +
sdks/python/apache_beam/internal/pickler.py | 3 +++
sdks/python/apache_beam/internal/pickler_test.py | 1 +
sdks/python/apache_beam/io/concat_source_test.py | 1 +
sdks/python/apache_beam/io/filebasedsource_test.py | 1 +
sdks/python/apache_beam/io/gcp/datastore/v1/datastoreio_test.py | 1 +
sdks/python/apache_beam/io/gcp/pubsub_test.py | 1 +
sdks/python/apache_beam/io/source_test_utils.py | 1 +
sdks/python/apache_beam/io/source_test_utils_test.py | 1 +
sdks/python/apache_beam/io/tfrecordio.py | 2 ++
sdks/python/apache_beam/io/tfrecordio_test.py | 1 +
.../apache_beam/runners/dataflow/dataflow_metrics_test.py | 1 +
sdks/python/apache_beam/runners/dataflow/native_io/iobase.py | 1 +
sdks/python/apache_beam/transforms/window.py | 4 ++++
sdks/python/apache_beam/transforms/window_test.py | 2 ++
sdks/python/apache_beam/typehints/decorators.py | 1 +
sdks/python/apache_beam/typehints/opcodes.py | 5 ++++-
sdks/python/apache_beam/typehints/typehints_test.py | 1 +
sdks/python/apache_beam/utils/annotations.py | 1 +
.../python/apache_beam/utils/pipeline_options_validator_test.py | 1 +
sdks/python/apache_beam/utils/test_stream_test.py | 1 +
sdks/python/run_pylint.sh | 4 ++--
sdks/python/tox.ini | 4 ++--
35 files changed, 47 insertions(+), 5 deletions(-)
----------------------------------------------------------------------