You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ro...@apache.org on 2017/09/01 22:09:52 UTC
[3/4] beam git commit: Isort the libraries
Isort the libraries
Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/3151f26c
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/3151f26c
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/3151f26c
Branch: refs/heads/master
Commit: 3151f26c028ef7886aaa1adeb64600e07ff0a23a
Parents: 7d53878
Author: Holden Karau <ho...@us.ibm.com>
Authored: Tue Aug 29 12:56:34 2017 -0700
Committer: Robert Bradshaw <ro...@gmail.com>
Committed: Fri Sep 1 15:07:43 2017 -0700
----------------------------------------------------------------------
sdks/python/apache_beam/coders/coder_impl.py | 4 ++--
sdks/python/apache_beam/coders/coders.py | 3 ++-
sdks/python/apache_beam/coders/coders_test.py | 2 +-
.../apache_beam/coders/coders_test_common.py | 9 ++++----
.../apache_beam/coders/observable_test.py | 1 -
.../coders/proto2_coder_test_messages_pb2.py | 4 +++-
.../apache_beam/coders/standard_coders_test.py | 6 ++---
sdks/python/apache_beam/coders/stream_test.py | 1 -
sdks/python/apache_beam/coders/typecoders.py | 1 -
.../examples/complete/estimate_pi.py | 5 ++--
.../examples/complete/estimate_pi_test.py | 2 +-
.../complete/juliaset/juliaset/juliaset_test.py | 1 -
.../examples/complete/juliaset/juliaset_main.py | 2 --
.../examples/complete/juliaset/setup.py | 2 +-
.../apache_beam/examples/complete/tfidf.py | 2 +-
.../apache_beam/examples/complete/tfidf_test.py | 1 -
.../examples/complete/top_wikipedia_sessions.py | 5 ++--
.../complete/top_wikipedia_sessions_test.py | 1 -
.../examples/cookbook/bigquery_side_input.py | 5 ++--
.../cookbook/bigquery_tornadoes_it_test.py | 2 +-
.../examples/cookbook/custom_ptransform.py | 2 +-
.../examples/cookbook/datastore_wordcount.py | 3 ++-
.../examples/cookbook/group_with_coder.py | 4 ++--
.../examples/cookbook/group_with_coder_test.py | 1 -
.../apache_beam/examples/snippets/snippets.py | 9 ++++----
.../examples/snippets/snippets_test.py | 6 ++---
.../apache_beam/examples/streaming_wordcount.py | 3 +--
.../apache_beam/examples/windowed_wordcount.py | 1 -
.../apache_beam/examples/wordcount_it_test.py | 2 +-
sdks/python/apache_beam/internal/gcp/auth.py | 1 -
.../apache_beam/internal/gcp/json_value.py | 1 -
.../apache_beam/internal/gcp/json_value_test.py | 3 +--
sdks/python/apache_beam/internal/util.py | 2 +-
sdks/python/apache_beam/io/avroio.py | 4 ++--
sdks/python/apache_beam/io/avroio_test.py | 21 ++++++++---------
.../python/apache_beam/io/concat_source_test.py | 1 -
sdks/python/apache_beam/io/filebasedsink.py | 4 ++--
.../python/apache_beam/io/filebasedsink_test.py | 3 +--
sdks/python/apache_beam/io/filebasedsource.py | 16 ++++++-------
.../apache_beam/io/filebasedsource_test.py | 8 +++----
sdks/python/apache_beam/io/filesystem.py | 4 ++--
sdks/python/apache_beam/io/filesystem_test.py | 5 ++--
sdks/python/apache_beam/io/filesystems.py | 1 -
sdks/python/apache_beam/io/filesystems_test.py | 4 ++--
sdks/python/apache_beam/io/gcp/bigquery.py | 4 ++--
sdks/python/apache_beam/io/gcp/bigquery_test.py | 4 ++--
.../gcp/datastore/v1/adaptive_throttler_test.py | 1 +
.../io/gcp/datastore/v1/datastoreio.py | 23 ++++++++++---------
.../io/gcp/datastore/v1/datastoreio_test.py | 6 +++--
.../apache_beam/io/gcp/datastore/v1/helper.py | 10 +++++---
.../io/gcp/datastore/v1/helper_test.py | 5 ++--
.../apache_beam/io/gcp/gcsfilesystem_test.py | 1 +
sdks/python/apache_beam/io/gcp/gcsio.py | 1 +
.../clients/bigquery/bigquery_v2_messages.py | 3 ---
.../clients/storage/storage_v1_messages.py | 3 ---
sdks/python/apache_beam/io/gcp/pubsub.py | 5 ++--
sdks/python/apache_beam/io/gcp/pubsub_test.py | 5 ++--
.../io/gcp/tests/bigquery_matcher_test.py | 3 ++-
.../apache_beam/io/gcp/tests/utils_test.py | 4 +++-
sdks/python/apache_beam/io/iobase.py | 7 +++---
.../apache_beam/io/localfilesystem_test.py | 4 ++--
sdks/python/apache_beam/io/source_test_utils.py | 4 ++--
.../apache_beam/io/source_test_utils_test.py | 2 +-
sdks/python/apache_beam/io/sources_test.py | 1 -
sdks/python/apache_beam/io/textio.py | 5 ++--
sdks/python/apache_beam/io/textio_test.py | 18 ++++++---------
sdks/python/apache_beam/io/tfrecordio.py | 5 ++--
sdks/python/apache_beam/io/tfrecordio_test.py | 8 +++----
sdks/python/apache_beam/metrics/cells_test.py | 2 +-
sdks/python/apache_beam/metrics/execution.py | 5 ++--
.../apache_beam/metrics/execution_test.py | 4 ++--
sdks/python/apache_beam/metrics/metric.py | 3 ++-
sdks/python/apache_beam/metrics/metric_test.py | 2 +-
.../apache_beam/options/pipeline_options.py | 5 ++--
.../options/pipeline_options_test.py | 7 +++---
.../options/pipeline_options_validator_test.py | 3 ++-
.../apache_beam/options/value_provider.py | 1 -
sdks/python/apache_beam/pipeline.py | 15 ++++++------
sdks/python/apache_beam/pipeline_test.py | 11 +++++----
sdks/python/apache_beam/pvalue.py | 1 -
sdks/python/apache_beam/runners/common.py | 2 +-
sdks/python/apache_beam/runners/common_test.py | 2 +-
.../runners/dataflow/dataflow_metrics.py | 2 +-
.../runners/dataflow/dataflow_runner.py | 13 +++++------
.../runners/dataflow/dataflow_runner_test.py | 12 +++++-----
.../runners/dataflow/internal/apiclient.py | 11 ++++-----
.../runners/dataflow/internal/apiclient_test.py | 1 -
.../clients/dataflow/dataflow_v1b3_messages.py | 1 -
.../clients/dataflow/message_matchers.py | 1 -
.../clients/dataflow/message_matchers_test.py | 3 ++-
.../runners/dataflow/internal/dependency.py | 4 ++--
.../dataflow/internal/dependency_test.py | 5 ++--
.../runners/dataflow/native_io/iobase_test.py | 22 ++++++++----------
.../dataflow/native_io/streaming_create.py | 2 +-
.../runners/dataflow/template_runner_test.py | 2 +-
.../runners/dataflow/test_dataflow_runner.py | 4 ++--
.../consumer_tracking_pipeline_visitor_test.py | 2 +-
.../runners/direct/direct_metrics.py | 2 +-
.../runners/direct/direct_metrics_test.py | 8 +++----
.../apache_beam/runners/direct/direct_runner.py | 9 ++++----
.../runners/direct/evaluation_context.py | 6 ++---
.../runners/direct/helper_transforms.py | 2 +-
.../runners/direct/transform_evaluator.py | 24 ++++++++++----------
.../python_rpc_direct_runner.py | 1 -
.../experimental/python_rpc_direct/server.py | 6 ++---
.../apache_beam/runners/pipeline_context.py | 2 +-
.../runners/portability/fn_api_runner.py | 7 +++---
.../portability/maptask_executor_runner.py | 7 +++---
.../portability/maptask_executor_runner_test.py | 6 ++---
sdks/python/apache_beam/runners/runner.py | 1 -
sdks/python/apache_beam/runners/runner_test.py | 2 +-
.../runners/worker/bundle_processor.py | 4 ++--
.../apache_beam/runners/worker/data_plane.py | 3 ++-
.../runners/worker/data_plane_test.py | 2 +-
.../apache_beam/runners/worker/log_handler.py | 3 ++-
.../runners/worker/log_handler_test.py | 2 +-
.../apache_beam/runners/worker/opcounters.py | 1 +
.../runners/worker/opcounters_test.py | 1 -
.../apache_beam/runners/worker/operations.py | 4 ++--
.../runners/worker/sdk_worker_test.py | 2 +-
.../apache_beam/testing/pipeline_verifiers.py | 1 -
.../testing/pipeline_verifiers_test.py | 5 ++--
.../python/apache_beam/testing/test_pipeline.py | 6 ++---
.../apache_beam/testing/test_pipeline_test.py | 4 ++--
sdks/python/apache_beam/testing/test_stream.py | 1 -
.../apache_beam/testing/test_stream_test.py | 3 ++-
sdks/python/apache_beam/testing/test_utils.py | 5 ++--
.../apache_beam/testing/test_utils_test.py | 1 +
sdks/python/apache_beam/testing/util.py | 3 +--
sdks/python/apache_beam/testing/util_test.py | 4 +++-
sdks/python/apache_beam/transforms/combiners.py | 3 +--
.../apache_beam/transforms/combiners_test.py | 5 ++--
sdks/python/apache_beam/transforms/core.py | 15 ++++++------
.../apache_beam/transforms/create_test.py | 6 ++---
sdks/python/apache_beam/transforms/display.py | 4 ++--
.../apache_beam/transforms/display_test.py | 6 ++---
.../python/apache_beam/transforms/ptransform.py | 5 ++--
.../apache_beam/transforms/ptransform_test.py | 15 ++++++------
.../apache_beam/transforms/sideinputs_test.py | 3 ++-
sdks/python/apache_beam/transforms/timeutil.py | 1 -
sdks/python/apache_beam/transforms/trigger.py | 6 ++---
.../apache_beam/transforms/trigger_test.py | 9 ++++----
sdks/python/apache_beam/transforms/util.py | 1 -
sdks/python/apache_beam/transforms/window.py | 3 +--
.../apache_beam/transforms/window_test.py | 9 ++++----
.../transforms/write_ptransform_test.py | 4 ++--
sdks/python/apache_beam/typehints/decorators.py | 3 +--
.../typehints/native_type_compatibility.py | 1 +
.../typehints/native_type_compatibility_test.py | 5 ++--
sdks/python/apache_beam/typehints/opcodes.py | 12 ++++++++--
.../typehints/trivial_inference_test.py | 1 -
sdks/python/apache_beam/typehints/typecheck.py | 6 ++---
.../typehints/typed_pipeline_test.py | 6 ++---
sdks/python/apache_beam/typehints/typehints.py | 1 -
.../apache_beam/typehints/typehints_test.py | 3 +--
.../apache_beam/utils/annotations_test.py | 1 +
sdks/python/apache_beam/utils/counters.py | 3 +--
sdks/python/apache_beam/utils/processes_test.py | 1 -
sdks/python/apache_beam/utils/retry_test.py | 3 ++-
sdks/python/apache_beam/utils/urns.py | 1 -
sdks/python/run_pylint.sh | 20 ++++++++++++++++
161 files changed, 371 insertions(+), 377 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/coders/coder_impl.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/coders/coder_impl.py b/sdks/python/apache_beam/coders/coder_impl.py
index 2670250..5070297 100644
--- a/sdks/python/apache_beam/coders/coder_impl.py
+++ b/sdks/python/apache_beam/coders/coder_impl.py
@@ -29,10 +29,10 @@ For internal use only; no backwards-compatibility guarantees.
from types import NoneType
from apache_beam.coders import observable
-from apache_beam.utils.timestamp import Timestamp
+from apache_beam.utils import windowed_value
from apache_beam.utils.timestamp import MAX_TIMESTAMP
from apache_beam.utils.timestamp import MIN_TIMESTAMP
-from apache_beam.utils import windowed_value
+from apache_beam.utils.timestamp import Timestamp
# pylint: disable=wrong-import-order, wrong-import-position, ungrouped-imports
try:
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/coders/coders.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/coders/coders.py b/sdks/python/apache_beam/coders/coders.py
index 10fb07b..3021da5 100644
--- a/sdks/python/apache_beam/coders/coders.py
+++ b/sdks/python/apache_beam/coders/coders.py
@@ -22,12 +22,13 @@ Only those coders listed in __all__ are part of the public API of this module.
import base64
import cPickle as pickle
+
import google.protobuf
from apache_beam.coders import coder_impl
from apache_beam.portability.api import beam_runner_api_pb2
-from apache_beam.utils import urns
from apache_beam.utils import proto_utils
+from apache_beam.utils import urns
# pylint: disable=wrong-import-order, wrong-import-position, ungrouped-imports
try:
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/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 c89e810..705de89 100644
--- a/sdks/python/apache_beam/coders/coders_test.py
+++ b/sdks/python/apache_beam/coders/coders_test.py
@@ -20,8 +20,8 @@ import base64
import logging
import unittest
-from apache_beam.coders import coders
from apache_beam.coders import proto2_coder_test_messages_pb2 as test_message
+from apache_beam.coders import coders
from apache_beam.coders.typecoders import registry as coders_registry
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/coders/coders_test_common.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/coders/coders_test_common.py b/sdks/python/apache_beam/coders/coders_test_common.py
index 8b0353d..29ff229 100644
--- a/sdks/python/apache_beam/coders/coders_test_common.py
+++ b/sdks/python/apache_beam/coders/coders_test_common.py
@@ -23,16 +23,15 @@ import unittest
import dill
-from apache_beam.transforms.window import GlobalWindow
-from apache_beam.utils.timestamp import MIN_TIMESTAMP
import observable
+from apache_beam.coders import proto2_coder_test_messages_pb2 as test_message
+from apache_beam.coders import coders
from apache_beam.runners import pipeline_context
from apache_beam.transforms import window
+from apache_beam.transforms.window import GlobalWindow
from apache_beam.utils import timestamp
from apache_beam.utils import windowed_value
-
-from apache_beam.coders import coders
-from apache_beam.coders import proto2_coder_test_messages_pb2 as test_message
+from apache_beam.utils.timestamp import MIN_TIMESTAMP
# Defined out of line for picklability.
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/coders/observable_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/coders/observable_test.py b/sdks/python/apache_beam/coders/observable_test.py
index eaf1aec..09ca304 100644
--- a/sdks/python/apache_beam/coders/observable_test.py
+++ b/sdks/python/apache_beam/coders/observable_test.py
@@ -20,7 +20,6 @@
import logging
import unittest
-
from apache_beam.coders import observable
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/coders/proto2_coder_test_messages_pb2.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/coders/proto2_coder_test_messages_pb2.py b/sdks/python/apache_beam/coders/proto2_coder_test_messages_pb2.py
index 16b1b4d..98667c8 100644
--- a/sdks/python/apache_beam/coders/proto2_coder_test_messages_pb2.py
+++ b/sdks/python/apache_beam/coders/proto2_coder_test_messages_pb2.py
@@ -19,12 +19,14 @@
# source: sdks/java/core/src/main/proto/proto2_coder_test_messages.proto
import sys
-_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
+
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
+
+_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/coders/standard_coders_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/coders/standard_coders_test.py b/sdks/python/apache_beam/coders/standard_coders_test.py
index 5f98455..ca4dffb 100644
--- a/sdks/python/apache_beam/coders/standard_coders_test.py
+++ b/sdks/python/apache_beam/coders/standard_coders_test.py
@@ -26,12 +26,12 @@ import unittest
import yaml
-from apache_beam.coders import coders
from apache_beam.coders import coder_impl
+from apache_beam.coders import coders
+from apache_beam.transforms import window
+from apache_beam.transforms.window import IntervalWindow
from apache_beam.utils import windowed_value
from apache_beam.utils.timestamp import Timestamp
-from apache_beam.transforms.window import IntervalWindow
-from apache_beam.transforms import window
STANDARD_CODERS_YAML = os.path.join(
os.path.dirname(__file__), '..', 'testing', 'data', 'standard_coders.yaml')
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/coders/stream_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/coders/stream_test.py b/sdks/python/apache_beam/coders/stream_test.py
index e6108b6..15bc5eb 100644
--- a/sdks/python/apache_beam/coders/stream_test.py
+++ b/sdks/python/apache_beam/coders/stream_test.py
@@ -21,7 +21,6 @@ import logging
import math
import unittest
-
from apache_beam.coders import slow_stream
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/coders/typecoders.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/coders/typecoders.py b/sdks/python/apache_beam/coders/typecoders.py
index 3894bb5..797aee5 100644
--- a/sdks/python/apache_beam/coders/typecoders.py
+++ b/sdks/python/apache_beam/coders/typecoders.py
@@ -70,7 +70,6 @@ import warnings
from apache_beam.coders import coders
from apache_beam.typehints import typehints
-
__all__ = ['registry']
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/examples/complete/estimate_pi.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/complete/estimate_pi.py b/sdks/python/apache_beam/examples/complete/estimate_pi.py
index 7e3c4cd..d0a5fb7 100644
--- a/sdks/python/apache_beam/examples/complete/estimate_pi.py
+++ b/sdks/python/apache_beam/examples/complete/estimate_pi.py
@@ -31,14 +31,13 @@ import json
import logging
import random
-
import apache_beam as beam
from apache_beam.io import WriteToText
+from apache_beam.options.pipeline_options import PipelineOptions
+from apache_beam.options.pipeline_options import SetupOptions
from apache_beam.typehints import Any
from apache_beam.typehints import Iterable
from apache_beam.typehints import Tuple
-from apache_beam.options.pipeline_options import PipelineOptions
-from apache_beam.options.pipeline_options import SetupOptions
@beam.typehints.with_output_types(Tuple[int, int, int])
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/examples/complete/estimate_pi_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/complete/estimate_pi_test.py b/sdks/python/apache_beam/examples/complete/estimate_pi_test.py
index f1cbb0a..3463313 100644
--- a/sdks/python/apache_beam/examples/complete/estimate_pi_test.py
+++ b/sdks/python/apache_beam/examples/complete/estimate_pi_test.py
@@ -22,8 +22,8 @@ import unittest
from apache_beam.examples.complete import estimate_pi
from apache_beam.testing.test_pipeline import TestPipeline
-from apache_beam.testing.util import assert_that
from apache_beam.testing.util import BeamAssertException
+from apache_beam.testing.util import assert_that
def in_between(lower, upper):
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/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 91c75aa..e498627 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
@@ -23,7 +23,6 @@ import re
import tempfile
import unittest
-
from apache_beam.examples.complete.juliaset.juliaset import juliaset
from apache_beam.testing.util import open_shards
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/examples/complete/juliaset/juliaset_main.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/complete/juliaset/juliaset_main.py b/sdks/python/apache_beam/examples/complete/juliaset/juliaset_main.py
index 0db5431..1d521be 100644
--- a/sdks/python/apache_beam/examples/complete/juliaset/juliaset_main.py
+++ b/sdks/python/apache_beam/examples/complete/juliaset/juliaset_main.py
@@ -49,10 +49,8 @@ python juliaset_main.py \
import logging
-
from apache_beam.examples.complete.juliaset.juliaset import juliaset
-
if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)
juliaset.run()
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/examples/complete/juliaset/setup.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/complete/juliaset/setup.py b/sdks/python/apache_beam/examples/complete/juliaset/setup.py
index 589e47c..2062e2a 100644
--- a/sdks/python/apache_beam/examples/complete/juliaset/setup.py
+++ b/sdks/python/apache_beam/examples/complete/juliaset/setup.py
@@ -25,8 +25,8 @@ This behavior is triggered by specifying the --setup_file command line option
when running the workflow for remote execution.
"""
-from distutils.command.build import build as _build
import subprocess
+from distutils.command.build import build as _build
import setuptools
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/examples/complete/tfidf.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/complete/tfidf.py b/sdks/python/apache_beam/examples/complete/tfidf.py
index a88ff82..2132fbb 100644
--- a/sdks/python/apache_beam/examples/complete/tfidf.py
+++ b/sdks/python/apache_beam/examples/complete/tfidf.py
@@ -31,9 +31,9 @@ import re
import apache_beam as beam
from apache_beam.io import ReadFromText
from apache_beam.io import WriteToText
-from apache_beam.pvalue import AsSingleton
from apache_beam.options.pipeline_options import PipelineOptions
from apache_beam.options.pipeline_options import SetupOptions
+from apache_beam.pvalue import AsSingleton
def read_documents(pipeline, uris):
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/examples/complete/tfidf_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/complete/tfidf_test.py b/sdks/python/apache_beam/examples/complete/tfidf_test.py
index b6f8825..518a47c 100644
--- a/sdks/python/apache_beam/examples/complete/tfidf_test.py
+++ b/sdks/python/apache_beam/examples/complete/tfidf_test.py
@@ -30,7 +30,6 @@ from apache_beam.testing.util import assert_that
from apache_beam.testing.util import equal_to
from apache_beam.testing.util import open_shards
-
EXPECTED_RESULTS = set([
('ghi', '1.txt', 0.3662040962227032),
('abc', '1.txt', 0.0),
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/examples/complete/top_wikipedia_sessions.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/complete/top_wikipedia_sessions.py b/sdks/python/apache_beam/examples/complete/top_wikipedia_sessions.py
index 9a9ad78..dd827bc 100644
--- a/sdks/python/apache_beam/examples/complete/top_wikipedia_sessions.py
+++ b/sdks/python/apache_beam/examples/complete/top_wikipedia_sessions.py
@@ -49,12 +49,11 @@ import apache_beam as beam
from apache_beam import combiners
from apache_beam.io import ReadFromText
from apache_beam.io import WriteToText
+from apache_beam.options.pipeline_options import PipelineOptions
+from apache_beam.options.pipeline_options import SetupOptions
from apache_beam.transforms.window import FixedWindows
from apache_beam.transforms.window import Sessions
from apache_beam.transforms.window import TimestampedValue
-from apache_beam.options.pipeline_options import PipelineOptions
-from apache_beam.options.pipeline_options import SetupOptions
-
ONE_HOUR_IN_SECONDS = 3600
THIRTY_DAYS_IN_SECONDS = 30 * 24 * ONE_HOUR_IN_SECONDS
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/examples/complete/top_wikipedia_sessions_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/complete/top_wikipedia_sessions_test.py b/sdks/python/apache_beam/examples/complete/top_wikipedia_sessions_test.py
index ced8a44..a0b368f 100644
--- a/sdks/python/apache_beam/examples/complete/top_wikipedia_sessions_test.py
+++ b/sdks/python/apache_beam/examples/complete/top_wikipedia_sessions_test.py
@@ -20,7 +20,6 @@
import json
import unittest
-
import apache_beam as beam
from apache_beam.examples.complete import top_wikipedia_sessions
from apache_beam.testing.test_pipeline import TestPipeline
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/examples/cookbook/bigquery_side_input.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/cookbook/bigquery_side_input.py b/sdks/python/apache_beam/examples/cookbook/bigquery_side_input.py
index 9911a67..e16ae73 100644
--- a/sdks/python/apache_beam/examples/cookbook/bigquery_side_input.py
+++ b/sdks/python/apache_beam/examples/cookbook/bigquery_side_input.py
@@ -32,12 +32,11 @@ import logging
from random import randrange
import apache_beam as beam
-
from apache_beam.io import WriteToText
-from apache_beam.pvalue import AsList
-from apache_beam.pvalue import AsSingleton
from apache_beam.options.pipeline_options import PipelineOptions
from apache_beam.options.pipeline_options import SetupOptions
+from apache_beam.pvalue import AsList
+from apache_beam.pvalue import AsSingleton
def create_groups(group_ids, corpus, word, ignore_corpus, ignore_word):
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/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 05ee3c5..9612849 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
@@ -25,8 +25,8 @@ from hamcrest.core.core.allof import all_of
from nose.plugins.attrib import attr
from apache_beam.examples.cookbook import bigquery_tornadoes
-from apache_beam.io.gcp.tests.bigquery_matcher import BigqueryMatcher
from apache_beam.io.gcp.tests import utils
+from apache_beam.io.gcp.tests.bigquery_matcher import BigqueryMatcher
from apache_beam.testing.pipeline_verifiers import PipelineStateMatcher
from apache_beam.testing.test_pipeline import TestPipeline
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/examples/cookbook/custom_ptransform.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/cookbook/custom_ptransform.py b/sdks/python/apache_beam/examples/cookbook/custom_ptransform.py
index aee69d2..db86003 100644
--- a/sdks/python/apache_beam/examples/cookbook/custom_ptransform.py
+++ b/sdks/python/apache_beam/examples/cookbook/custom_ptransform.py
@@ -30,10 +30,10 @@ from apache_beam.io import ReadFromText
from apache_beam.io import WriteToText
from apache_beam.options.pipeline_options import PipelineOptions
-
# pylint doesn't understand our pipeline syntax:
# pylint:disable=expression-not-assigned
+
class Count1(beam.PTransform):
"""Count as a subclass of PTransform, with an apply method."""
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/examples/cookbook/datastore_wordcount.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/cookbook/datastore_wordcount.py b/sdks/python/apache_beam/examples/cookbook/datastore_wordcount.py
index 7161cff..c42596f 100644
--- a/sdks/python/apache_beam/examples/cookbook/datastore_wordcount.py
+++ b/sdks/python/apache_beam/examples/cookbook/datastore_wordcount.py
@@ -68,7 +68,8 @@ import uuid
from google.cloud.proto.datastore.v1 import entity_pb2
from google.cloud.proto.datastore.v1 import query_pb2
-from googledatastore import helper as datastore_helper, PropertyFilter
+from googledatastore import helper as datastore_helper
+from googledatastore import PropertyFilter
import apache_beam as beam
from apache_beam.io import ReadFromText
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/examples/cookbook/group_with_coder.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/cookbook/group_with_coder.py b/sdks/python/apache_beam/examples/cookbook/group_with_coder.py
index 9c0d04b..4c86f46 100644
--- a/sdks/python/apache_beam/examples/cookbook/group_with_coder.py
+++ b/sdks/python/apache_beam/examples/cookbook/group_with_coder.py
@@ -35,10 +35,10 @@ import apache_beam as beam
from apache_beam import coders
from apache_beam.io import ReadFromText
from apache_beam.io import WriteToText
-from apache_beam.typehints import typehints
-from apache_beam.typehints.decorators import with_output_types
from apache_beam.options.pipeline_options import PipelineOptions
from apache_beam.options.pipeline_options import SetupOptions
+from apache_beam.typehints import typehints
+from apache_beam.typehints.decorators import with_output_types
class Player(object):
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/examples/cookbook/group_with_coder_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/cookbook/group_with_coder_test.py b/sdks/python/apache_beam/examples/cookbook/group_with_coder_test.py
index fb630ba..ed38b5d 100644
--- a/sdks/python/apache_beam/examples/cookbook/group_with_coder_test.py
+++ b/sdks/python/apache_beam/examples/cookbook/group_with_coder_test.py
@@ -24,7 +24,6 @@ import unittest
from apache_beam.examples.cookbook import group_with_coder
from apache_beam.testing.util import open_shards
-
# Patch group_with_coder.PlayerCoder.decode(). To test that the PlayerCoder was
# used, we do not strip the prepended 'x:' string when decoding a Player object.
group_with_coder.PlayerCoder.decode = lambda self, s: group_with_coder.Player(s)
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/examples/snippets/snippets.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/snippets/snippets.py b/sdks/python/apache_beam/examples/snippets/snippets.py
index 27b8120..105e3a9 100644
--- a/sdks/python/apache_beam/examples/snippets/snippets.py
+++ b/sdks/python/apache_beam/examples/snippets/snippets.py
@@ -31,10 +31,14 @@ string. The tags can contain only letters, digits and _.
"""
import apache_beam as beam
+from apache_beam.io import iobase
+from apache_beam.io.range_trackers import OffsetRangeTracker
from apache_beam.metrics import Metrics
+from apache_beam.options.pipeline_options import PipelineOptions
from apache_beam.testing.test_pipeline import TestPipeline
from apache_beam.testing.util import assert_that
from apache_beam.testing.util import equal_to
+from apache_beam.transforms.core import PTransform
# Quiet some pylint warnings that happen because of the somewhat special
# format for the code snippets.
@@ -655,11 +659,6 @@ def examples_ptransforms_templated(renames):
result.wait_until_finish()
-import apache_beam as beam
-from apache_beam.io import iobase
-from apache_beam.io.range_trackers import OffsetRangeTracker
-from apache_beam.transforms.core import PTransform
-from apache_beam.options.pipeline_options import PipelineOptions
# Defining a new source.
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/examples/snippets/snippets_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/snippets/snippets_test.py b/sdks/python/apache_beam/examples/snippets/snippets_test.py
index 9183d0d..ee1e50e 100644
--- a/sdks/python/apache_beam/examples/snippets/snippets_test.py
+++ b/sdks/python/apache_beam/examples/snippets/snippets_test.py
@@ -30,17 +30,15 @@ from apache_beam import coders
from apache_beam import pvalue
from apache_beam import typehints
from apache_beam.coders.coders import ToStringCoder
-from apache_beam.options.pipeline_options import PipelineOptions
from apache_beam.examples.snippets import snippets
from apache_beam.metrics import Metrics
from apache_beam.metrics.metric import MetricsFilter
+from apache_beam.options.pipeline_options import PipelineOptions
+from apache_beam.testing.test_pipeline import TestPipeline
from apache_beam.testing.util import assert_that
from apache_beam.testing.util import equal_to
from apache_beam.utils.windowed_value import WindowedValue
-# pylint: disable=expression-not-assigned
-from apache_beam.testing.test_pipeline import TestPipeline
-
# Protect against environments where apitools library is not available.
# pylint: disable=wrong-import-order, wrong-import-position
try:
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/examples/streaming_wordcount.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/streaming_wordcount.py b/sdks/python/apache_beam/examples/streaming_wordcount.py
index 7696d77..94d4c70 100644
--- a/sdks/python/apache_beam/examples/streaming_wordcount.py
+++ b/sdks/python/apache_beam/examples/streaming_wordcount.py
@@ -26,11 +26,10 @@ from __future__ import absolute_import
import argparse
import logging
-
import apache_beam as beam
+import apache_beam.transforms.window as window
from apache_beam.options.pipeline_options import PipelineOptions
from apache_beam.options.pipeline_options import StandardOptions
-import apache_beam.transforms.window as window
def split_fn(lines):
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/examples/windowed_wordcount.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/windowed_wordcount.py b/sdks/python/apache_beam/examples/windowed_wordcount.py
index bd57847..508f18d 100644
--- a/sdks/python/apache_beam/examples/windowed_wordcount.py
+++ b/sdks/python/apache_beam/examples/windowed_wordcount.py
@@ -26,7 +26,6 @@ from __future__ import absolute_import
import argparse
import logging
-
import apache_beam as beam
import apache_beam.transforms.window as window
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/examples/wordcount_it_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/wordcount_it_test.py b/sdks/python/apache_beam/examples/wordcount_it_test.py
index 8d2e73e..21ff3ce 100644
--- a/sdks/python/apache_beam/examples/wordcount_it_test.py
+++ b/sdks/python/apache_beam/examples/wordcount_it_test.py
@@ -25,10 +25,10 @@ from hamcrest.core.core.allof import all_of
from nose.plugins.attrib import attr
from apache_beam.examples import wordcount
-from apache_beam.testing.test_utils import delete_files
from apache_beam.testing.pipeline_verifiers import FileChecksumMatcher
from apache_beam.testing.pipeline_verifiers import PipelineStateMatcher
from apache_beam.testing.test_pipeline import TestPipeline
+from apache_beam.testing.test_utils import delete_files
class WordCountIT(unittest.TestCase):
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/internal/gcp/auth.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/internal/gcp/auth.py b/sdks/python/apache_beam/internal/gcp/auth.py
index 9f32092..35676f1 100644
--- a/sdks/python/apache_beam/internal/gcp/auth.py
+++ b/sdks/python/apache_beam/internal/gcp/auth.py
@@ -28,7 +28,6 @@ from oauth2client.client import OAuth2Credentials
from apache_beam.utils import retry
-
# When we are running in GCE, we can authenticate with VM credentials.
is_running_in_gce = False
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/internal/gcp/json_value.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/internal/gcp/json_value.py b/sdks/python/apache_beam/internal/gcp/json_value.py
index 167b173..7a5dc54 100644
--- a/sdks/python/apache_beam/internal/gcp/json_value.py
+++ b/sdks/python/apache_beam/internal/gcp/json_value.py
@@ -27,7 +27,6 @@ except ImportError:
from apache_beam.options.value_provider import ValueProvider
-
_MAXINT64 = (1 << 63) - 1
_MININT64 = - (1 << 63)
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/internal/gcp/json_value_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/internal/gcp/json_value_test.py b/sdks/python/apache_beam/internal/gcp/json_value_test.py
index b1fd63f..14223f1 100644
--- a/sdks/python/apache_beam/internal/gcp/json_value_test.py
+++ b/sdks/python/apache_beam/internal/gcp/json_value_test.py
@@ -21,9 +21,8 @@ import unittest
from apache_beam.internal.gcp.json_value import from_json_value
from apache_beam.internal.gcp.json_value import to_json_value
-from apache_beam.options.value_provider import StaticValueProvider
from apache_beam.options.value_provider import RuntimeValueProvider
-
+from apache_beam.options.value_provider import StaticValueProvider
# Protect against environments where apitools library is not available.
# pylint: disable=wrong-import-order, wrong-import-position
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/internal/util.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/internal/util.py b/sdks/python/apache_beam/internal/util.py
index dbbeafc..3e943b0 100644
--- a/sdks/python/apache_beam/internal/util.py
+++ b/sdks/python/apache_beam/internal/util.py
@@ -21,9 +21,9 @@ For internal use only. No backwards compatibility guarantees.
"""
import logging
-from multiprocessing.pool import ThreadPool
import threading
import weakref
+from multiprocessing.pool import ThreadPool
class ArgumentPlaceholder(object):
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/avroio.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/avroio.py b/sdks/python/apache_beam/io/avroio.py
index cb14c65..30fc890 100644
--- a/sdks/python/apache_beam/io/avroio.py
+++ b/sdks/python/apache_beam/io/avroio.py
@@ -48,13 +48,13 @@ import zlib
from functools import partial
import avro
-from avro import datafile
from avro import io as avroio
+from avro import datafile
from avro import schema
import apache_beam as beam
-from apache_beam.io import filebasedsource
from apache_beam.io import filebasedsink
+from apache_beam.io import filebasedsource
from apache_beam.io import iobase
from apache_beam.io.filesystem import CompressionTypes
from apache_beam.io.iobase import Read
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/avroio_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/avroio_test.py b/sdks/python/apache_beam/io/avroio_test.py
index 969f440..8a34427 100644
--- a/sdks/python/apache_beam/io/avroio_test.py
+++ b/sdks/python/apache_beam/io/avroio_test.py
@@ -21,29 +21,26 @@ import os
import tempfile
import unittest
+import avro.datafile
+import avro.schema
+from avro.datafile import DataFileWriter
+from avro.io import DatumWriter
+import hamcrest as hc
+
import apache_beam as beam
from apache_beam import Create
-from apache_beam.io import iobase
from apache_beam.io import avroio
from apache_beam.io import filebasedsource
+from apache_beam.io import iobase
from apache_beam.io import source_test_utils
+from apache_beam.io.avroio import _AvroSink as AvroSink # For testing
+from apache_beam.io.avroio import _AvroSource as AvroSource # For testing
from apache_beam.testing.test_pipeline import TestPipeline
from apache_beam.testing.util import assert_that
from apache_beam.testing.util import equal_to
from apache_beam.transforms.display import DisplayData
from apache_beam.transforms.display_test import DisplayDataItemMatcher
-# Importing following private class for testing purposes.
-from apache_beam.io.avroio import _AvroSource as AvroSource
-from apache_beam.io.avroio import _AvroSink as AvroSink
-
-import avro.datafile
-from avro.datafile import DataFileWriter
-from avro.io import DatumWriter
-import avro.schema
-import hamcrest as hc
-
-
# Import snappy optionally; some tests will be skipped when import fails.
try:
import snappy # pylint: disable=import-error
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/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 4a8f519..0f7dd54 100644
--- a/sdks/python/apache_beam/io/concat_source_test.py
+++ b/sdks/python/apache_beam/io/concat_source_test.py
@@ -21,7 +21,6 @@ import logging
import unittest
import apache_beam as beam
-
from apache_beam.io import iobase
from apache_beam.io import range_trackers
from apache_beam.io import source_test_utils
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/filebasedsink.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/filebasedsink.py b/sdks/python/apache_beam/io/filebasedsink.py
index eb99d08..ba1a495 100644
--- a/sdks/python/apache_beam/io/filebasedsink.py
+++ b/sdks/python/apache_beam/io/filebasedsink.py
@@ -30,10 +30,10 @@ from apache_beam.io import iobase
from apache_beam.io.filesystem import BeamIOError
from apache_beam.io.filesystem import CompressionTypes
from apache_beam.io.filesystems import FileSystems
-from apache_beam.transforms.display import DisplayDataItem
-from apache_beam.options.value_provider import ValueProvider
from apache_beam.options.value_provider import StaticValueProvider
+from apache_beam.options.value_provider import ValueProvider
from apache_beam.options.value_provider import check_accessible
+from apache_beam.transforms.display import DisplayDataItem
DEFAULT_SHARD_NAME_TEMPLATE = '-SSSSS-of-NNNNN'
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/filebasedsink_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/filebasedsink_test.py b/sdks/python/apache_beam/io/filebasedsink_test.py
index 7c8ddb4..156251a 100644
--- a/sdks/python/apache_beam/io/filebasedsink_test.py
+++ b/sdks/python/apache_beam/io/filebasedsink_test.py
@@ -31,12 +31,11 @@ import mock
import apache_beam as beam
from apache_beam.coders import coders
from apache_beam.io import filebasedsink
+from apache_beam.options.value_provider import StaticValueProvider
from apache_beam.testing.test_pipeline import TestPipeline
from apache_beam.transforms.display import DisplayData
from apache_beam.transforms.display_test import DisplayDataItemMatcher
-from apache_beam.options.value_provider import StaticValueProvider
-
# TODO: Refactor code so all io tests are using same library
# TestCaseWithTempDirCleanup class.
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/filebasedsource.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/filebasedsource.py b/sdks/python/apache_beam/io/filebasedsource.py
index 6496930..7b019ed 100644
--- a/sdks/python/apache_beam/io/filebasedsource.py
+++ b/sdks/python/apache_beam/io/filebasedsource.py
@@ -27,12 +27,6 @@ For an example implementation of :class:`FileBasedSource` see
"""
import uuid
-from apache_beam.transforms.core import DoFn
-from apache_beam.transforms.core import ParDo
-from apache_beam.transforms.core import GroupByKey
-from apache_beam.transforms.core import PTransform
-from apache_beam.transforms.core import FlatMap
-from apache_beam.transforms.core import Map
from apache_beam.internal import pickler
from apache_beam.io import concat_source
from apache_beam.io import iobase
@@ -40,10 +34,16 @@ from apache_beam.io import range_trackers
from apache_beam.io.filesystem import CompressionTypes
from apache_beam.io.filesystems import FileSystems
from apache_beam.io.range_trackers import OffsetRange
-from apache_beam.transforms.display import DisplayDataItem
-from apache_beam.options.value_provider import ValueProvider
from apache_beam.options.value_provider import StaticValueProvider
+from apache_beam.options.value_provider import ValueProvider
from apache_beam.options.value_provider import check_accessible
+from apache_beam.transforms.core import DoFn
+from apache_beam.transforms.core import FlatMap
+from apache_beam.transforms.core import GroupByKey
+from apache_beam.transforms.core import Map
+from apache_beam.transforms.core import ParDo
+from apache_beam.transforms.core import PTransform
+from apache_beam.transforms.display import DisplayDataItem
from apache_beam.transforms.trigger import DefaultTrigger
MAX_NUM_THREADS_FOR_SIZE_ESTIMATION = 25
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/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 afb340d..0999510 100644
--- a/sdks/python/apache_beam/io/filebasedsource_test.py
+++ b/sdks/python/apache_beam/io/filebasedsource_test.py
@@ -20,8 +20,8 @@ import cStringIO
import gzip
import logging
import math
-import random
import os
+import random
import tempfile
import unittest
@@ -31,15 +31,13 @@ import apache_beam as beam
from apache_beam.io import filebasedsource
from apache_beam.io import iobase
from apache_beam.io import range_trackers
-from apache_beam.io.filesystem import CompressionTypes
-
# importing following private classes for testing
from apache_beam.io.concat_source import ConcatSource
from apache_beam.io.filebasedsource import _SingleFileSource as SingleFileSource
-
from apache_beam.io.filebasedsource import FileBasedSource
-from apache_beam.options.value_provider import StaticValueProvider
+from apache_beam.io.filesystem import CompressionTypes
from apache_beam.options.value_provider import RuntimeValueProvider
+from apache_beam.options.value_provider import StaticValueProvider
from apache_beam.testing.test_pipeline import TestPipeline
from apache_beam.testing.util import assert_that
from apache_beam.testing.util import equal_to
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/filesystem.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/filesystem.py b/sdks/python/apache_beam/io/filesystem.py
index 5804d00..69049ae 100644
--- a/sdks/python/apache_beam/io/filesystem.py
+++ b/sdks/python/apache_beam/io/filesystem.py
@@ -21,10 +21,10 @@ from __future__ import absolute_import
import abc
import bz2
import cStringIO
-import os
-import zlib
import logging
+import os
import time
+import zlib
from apache_beam.utils.plugin import BeamPlugin
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/filesystem_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/filesystem_test.py b/sdks/python/apache_beam/io/filesystem_test.py
index 607393d..1c6cdd7 100644
--- a/sdks/python/apache_beam/io/filesystem_test.py
+++ b/sdks/python/apache_beam/io/filesystem_test.py
@@ -20,11 +20,12 @@
import bz2
import gzip
import os
-import unittest
import tempfile
+import unittest
from StringIO import StringIO
-from apache_beam.io.filesystem import CompressedFile, CompressionTypes
+from apache_beam.io.filesystem import CompressedFile
+from apache_beam.io.filesystem import CompressionTypes
class TestCompressedFile(unittest.TestCase):
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/filesystems.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/filesystems.py b/sdks/python/apache_beam/io/filesystems.py
index e039686..f9ce553 100644
--- a/sdks/python/apache_beam/io/filesystems.py
+++ b/sdks/python/apache_beam/io/filesystems.py
@@ -22,7 +22,6 @@ import re
from apache_beam.io.filesystem import BeamIOError
from apache_beam.io.filesystem import CompressionTypes
from apache_beam.io.filesystem import FileSystem
-
# All filesystem implements should be added here
# pylint: disable=wrong-import-position, unused-import
from apache_beam.io.localfilesystem import LocalFileSystem
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/filesystems_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/filesystems_test.py b/sdks/python/apache_beam/io/filesystems_test.py
index 9a6f013..eaaa40f 100644
--- a/sdks/python/apache_beam/io/filesystems_test.py
+++ b/sdks/python/apache_beam/io/filesystems_test.py
@@ -18,12 +18,12 @@
"""Unit tests for LocalFileSystem."""
-import unittest
-
import filecmp
import os
import shutil
import tempfile
+import unittest
+
import mock
from apache_beam.io import localfilesystem
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/gcp/bigquery.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/gcp/bigquery.py b/sdks/python/apache_beam/io/gcp/bigquery.py
index 33d67bf..40611ac 100644
--- a/sdks/python/apache_beam/io/gcp/bigquery.py
+++ b/sdks/python/apache_beam/io/gcp/bigquery.py
@@ -114,14 +114,14 @@ from apache_beam import coders
from apache_beam.internal.gcp import auth
from apache_beam.internal.gcp.json_value import from_json_value
from apache_beam.internal.gcp.json_value import to_json_value
+from apache_beam.io.gcp.internal.clients import bigquery
+from apache_beam.options.pipeline_options import GoogleCloudOptions
from apache_beam.runners.dataflow.native_io import iobase as dataflow_io
from apache_beam.transforms import DoFn
from apache_beam.transforms import ParDo
from apache_beam.transforms import PTransform
from apache_beam.transforms.display import DisplayDataItem
from apache_beam.utils import retry
-from apache_beam.options.pipeline_options import GoogleCloudOptions
-from apache_beam.io.gcp.internal.clients import bigquery
# Protect against environments where bigquery library is not available.
# pylint: disable=wrong-import-order, wrong-import-position
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/gcp/bigquery_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/gcp/bigquery_test.py b/sdks/python/apache_beam/io/gcp/bigquery_test.py
index bfd06ac..8490481 100644
--- a/sdks/python/apache_beam/io/gcp/bigquery_test.py
+++ b/sdks/python/apache_beam/io/gcp/bigquery_test.py
@@ -27,14 +27,14 @@ import hamcrest as hc
import mock
import apache_beam as beam
+from apache_beam.internal.gcp.json_value import to_json_value
from apache_beam.io.gcp.bigquery import RowAsDictJsonCoder
from apache_beam.io.gcp.bigquery import TableRowJsonCoder
from apache_beam.io.gcp.bigquery import parse_table_schema_from_json
from apache_beam.io.gcp.internal.clients import bigquery
-from apache_beam.internal.gcp.json_value import to_json_value
+from apache_beam.options.pipeline_options import PipelineOptions
from apache_beam.transforms.display import DisplayData
from apache_beam.transforms.display_test import DisplayDataItemMatcher
-from apache_beam.options.pipeline_options import PipelineOptions
# Protect against environments where bigquery library is not available.
# pylint: disable=wrong-import-order, wrong-import-position
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/gcp/datastore/v1/adaptive_throttler_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/gcp/datastore/v1/adaptive_throttler_test.py b/sdks/python/apache_beam/io/gcp/datastore/v1/adaptive_throttler_test.py
index 93b91ad..1ac2393 100644
--- a/sdks/python/apache_beam/io/gcp/datastore/v1/adaptive_throttler_test.py
+++ b/sdks/python/apache_beam/io/gcp/datastore/v1/adaptive_throttler_test.py
@@ -16,6 +16,7 @@
#
import unittest
+
from mock import patch
from apache_beam.io.gcp.datastore.v1.adaptive_throttler import AdaptiveThrottler
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/gcp/datastore/v1/datastoreio.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/gcp/datastore/v1/datastoreio.py b/sdks/python/apache_beam/io/gcp/datastore/v1/datastoreio.py
index 3cfba93..078002c 100644
--- a/sdks/python/apache_beam/io/gcp/datastore/v1/datastoreio.py
+++ b/sdks/python/apache_beam/io/gcp/datastore/v1/datastoreio.py
@@ -20,28 +20,29 @@
import logging
import time
-# Protect against environments where datastore library is not available.
-# pylint: disable=wrong-import-order, wrong-import-position
-try:
- from google.cloud.proto.datastore.v1 import datastore_pb2
- from googledatastore import helper as datastore_helper
-except ImportError:
- pass
-# pylint: enable=wrong-import-order, wrong-import-position
-
from apache_beam.io.gcp.datastore.v1 import helper
from apache_beam.io.gcp.datastore.v1 import query_splitter
from apache_beam.io.gcp.datastore.v1 import util
from apache_beam.io.gcp.datastore.v1.adaptive_throttler import AdaptiveThrottler
+from apache_beam.metrics.metric import Metrics
from apache_beam.transforms import Create
from apache_beam.transforms import DoFn
from apache_beam.transforms import FlatMap
from apache_beam.transforms import GroupByKey
from apache_beam.transforms import Map
-from apache_beam.transforms import PTransform
from apache_beam.transforms import ParDo
+from apache_beam.transforms import PTransform
from apache_beam.transforms.util import Values
-from apache_beam.metrics.metric import Metrics
+
+# Protect against environments where datastore library is not available.
+# pylint: disable=wrong-import-order, wrong-import-position
+try:
+ from google.cloud.proto.datastore.v1 import datastore_pb2
+ from googledatastore import helper as datastore_helper
+except ImportError:
+ pass
+# pylint: enable=wrong-import-order, wrong-import-position
+
__all__ = ['ReadFromDatastore', 'WriteToDatastore', 'DeleteFromDatastore']
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/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 72c4c8c..fa7310f 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
@@ -17,14 +17,16 @@
import unittest
-from mock import MagicMock, call, patch
+from mock import MagicMock
+from mock import call
+from mock import patch
from apache_beam.io.gcp.datastore.v1 import fake_datastore
from apache_beam.io.gcp.datastore.v1 import helper
from apache_beam.io.gcp.datastore.v1 import query_splitter
-from apache_beam.io.gcp.datastore.v1.datastoreio import _Mutate
from apache_beam.io.gcp.datastore.v1.datastoreio import ReadFromDatastore
from apache_beam.io.gcp.datastore.v1.datastoreio import WriteToDatastore
+from apache_beam.io.gcp.datastore.v1.datastoreio import _Mutate
# Protect against environments where datastore library is not available.
# pylint: disable=wrong-import-order, wrong-import-position, ungrouped-imports
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/gcp/datastore/v1/helper.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/gcp/datastore/v1/helper.py b/sdks/python/apache_beam/io/gcp/datastore/v1/helper.py
index 5cde255..5f74db6 100644
--- a/sdks/python/apache_beam/io/gcp/datastore/v1/helper.py
+++ b/sdks/python/apache_beam/io/gcp/datastore/v1/helper.py
@@ -21,10 +21,14 @@ For internal use only; no backwards-compatibility guarantees.
"""
import errno
-from socket import error as SocketError
import logging
import sys
import time
+from socket import error as SocketError
+
+# pylint: disable=ungrouped-imports
+from apache_beam.internal.gcp import auth
+from apache_beam.utils import retry
# Protect against environments where datastore library is not available.
# pylint: disable=wrong-import-order, wrong-import-position
@@ -41,8 +45,8 @@ except ImportError:
pass
# pylint: enable=wrong-import-order, wrong-import-position
-from apache_beam.internal.gcp import auth
-from apache_beam.utils import retry
+# pylint: enable=ungrouped-imports
+
def key_comparator(k1, k2):
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/gcp/datastore/v1/helper_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/gcp/datastore/v1/helper_test.py b/sdks/python/apache_beam/io/gcp/datastore/v1/helper_test.py
index a8b1bb1..36cfb15 100644
--- a/sdks/python/apache_beam/io/gcp/datastore/v1/helper_test.py
+++ b/sdks/python/apache_beam/io/gcp/datastore/v1/helper_test.py
@@ -18,17 +18,17 @@
"""Tests for datastore helper."""
import errno
import random
-from socket import error as SocketError
import sys
import unittest
+from socket import error as SocketError
from mock import MagicMock
+# pylint: disable=ungrouped-imports
from apache_beam.io.gcp.datastore.v1 import fake_datastore
from apache_beam.io.gcp.datastore.v1 import helper
from apache_beam.testing.test_utils import patch_retry
-
# Protect against environments where apitools library is not available.
# pylint: disable=wrong-import-order, wrong-import-position
try:
@@ -42,6 +42,7 @@ try:
except ImportError:
datastore_helper = None
# pylint: enable=wrong-import-order, wrong-import-position
+# pylint: enable=ungrouped-imports
@unittest.skipIf(datastore_helper is None, 'GCP dependencies are not installed')
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/gcp/gcsfilesystem_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/gcp/gcsfilesystem_test.py b/sdks/python/apache_beam/io/gcp/gcsfilesystem_test.py
index 923fc7d..88a601f 100644
--- a/sdks/python/apache_beam/io/gcp/gcsfilesystem_test.py
+++ b/sdks/python/apache_beam/io/gcp/gcsfilesystem_test.py
@@ -21,6 +21,7 @@
import unittest
import mock
+
from apache_beam.io.filesystem import BeamIOError
from apache_beam.io.filesystem import FileMetadata
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/gcp/gcsio.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/gcp/gcsio.py b/sdks/python/apache_beam/io/gcp/gcsio.py
index b18a287..0db4ba5 100644
--- a/sdks/python/apache_beam/io/gcp/gcsio.py
+++ b/sdks/python/apache_beam/io/gcp/gcsio.py
@@ -31,6 +31,7 @@ import re
import threading
import time
import traceback
+
import httplib2
from apache_beam.utils import retry
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/gcp/internal/clients/bigquery/bigquery_v2_messages.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/gcp/internal/clients/bigquery/bigquery_v2_messages.py b/sdks/python/apache_beam/io/gcp/internal/clients/bigquery/bigquery_v2_messages.py
index 4045428..3e741cd 100644
--- a/sdks/python/apache_beam/io/gcp/internal/clients/bigquery/bigquery_v2_messages.py
+++ b/sdks/python/apache_beam/io/gcp/internal/clients/bigquery/bigquery_v2_messages.py
@@ -25,7 +25,6 @@ from apitools.base.protorpclite import messages as _messages
from apitools.base.py import encoding
from apitools.base.py import extra_types
-
package = 'bigquery'
@@ -1906,5 +1905,3 @@ class ViewDefinition(_messages.Message):
query = _messages.StringField(1)
userDefinedFunctionResources = _messages.MessageField('UserDefinedFunctionResource', 2, repeated=True)
-
-
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/gcp/internal/clients/storage/storage_v1_messages.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/gcp/internal/clients/storage/storage_v1_messages.py b/sdks/python/apache_beam/io/gcp/internal/clients/storage/storage_v1_messages.py
index dc9e5e6..3c180a6 100644
--- a/sdks/python/apache_beam/io/gcp/internal/clients/storage/storage_v1_messages.py
+++ b/sdks/python/apache_beam/io/gcp/internal/clients/storage/storage_v1_messages.py
@@ -26,7 +26,6 @@ from apitools.base.protorpclite import messages as _messages
from apitools.base.py import encoding
from apitools.base.py import extra_types
-
package = 'storage'
@@ -1916,5 +1915,3 @@ class StorageObjectsWatchAllRequest(_messages.Message):
prefix = _messages.StringField(6)
projection = _messages.EnumField('ProjectionValueValuesEnum', 7)
versions = _messages.BooleanField(8)
-
-
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/gcp/pubsub.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/gcp/pubsub.py b/sdks/python/apache_beam/io/gcp/pubsub.py
index 7d1f355..98aa884 100644
--- a/sdks/python/apache_beam/io/gcp/pubsub.py
+++ b/sdks/python/apache_beam/io/gcp/pubsub.py
@@ -30,13 +30,12 @@ from apache_beam import coders
from apache_beam.io.iobase import Read
from apache_beam.io.iobase import Write
from apache_beam.runners.dataflow.native_io import iobase as dataflow_io
-from apache_beam.transforms import core
-from apache_beam.transforms import PTransform
from apache_beam.transforms import Map
+from apache_beam.transforms import PTransform
+from apache_beam.transforms import core
from apache_beam.transforms import window
from apache_beam.transforms.display import DisplayDataItem
-
__all__ = ['ReadStringsFromPubSub', 'WriteStringsToPubSub']
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/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 0dcc3c3..0c4ba02 100644
--- a/sdks/python/apache_beam/io/gcp/pubsub_test.py
+++ b/sdks/python/apache_beam/io/gcp/pubsub_test.py
@@ -22,15 +22,14 @@ import unittest
import hamcrest as hc
-from apache_beam.io.gcp.pubsub import _PubSubPayloadSink
-from apache_beam.io.gcp.pubsub import _PubSubPayloadSource
from apache_beam.io.gcp.pubsub import ReadStringsFromPubSub
from apache_beam.io.gcp.pubsub import WriteStringsToPubSub
+from apache_beam.io.gcp.pubsub import _PubSubPayloadSink
+from apache_beam.io.gcp.pubsub import _PubSubPayloadSource
from apache_beam.testing.test_pipeline import TestPipeline
from apache_beam.transforms.display import DisplayData
from apache_beam.transforms.display_test import DisplayDataItemMatcher
-
# Protect against environments where the PubSub library is not available.
# pylint: disable=wrong-import-order, wrong-import-position
try:
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/gcp/tests/bigquery_matcher_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/gcp/tests/bigquery_matcher_test.py b/sdks/python/apache_beam/io/gcp/tests/bigquery_matcher_test.py
index 5b72285..a097718 100644
--- a/sdks/python/apache_beam/io/gcp/tests/bigquery_matcher_test.py
+++ b/sdks/python/apache_beam/io/gcp/tests/bigquery_matcher_test.py
@@ -21,7 +21,8 @@ import logging
import unittest
from hamcrest import assert_that as hc_assert_that
-from mock import Mock, patch
+from mock import Mock
+from mock import patch
from apache_beam.io.gcp.tests import bigquery_matcher as bq_verifier
from apache_beam.testing.test_utils import patch_retry
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/gcp/tests/utils_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/gcp/tests/utils_test.py b/sdks/python/apache_beam/io/gcp/tests/utils_test.py
index 270750a..340aa6d 100644
--- a/sdks/python/apache_beam/io/gcp/tests/utils_test.py
+++ b/sdks/python/apache_beam/io/gcp/tests/utils_test.py
@@ -19,7 +19,9 @@
import logging
import unittest
-from mock import Mock, patch
+
+from mock import Mock
+from mock import patch
from apache_beam.io.gcp.tests import utils
from apache_beam.testing.test_utils import patch_retry
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/iobase.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/iobase.py b/sdks/python/apache_beam/io/iobase.py
index db75fe3..043666d 100644
--- a/sdks/python/apache_beam/io/iobase.py
+++ b/sdks/python/apache_beam/io/iobase.py
@@ -29,22 +29,21 @@ returns a writer object supporting writing records of serialized data to
the sink.
"""
-from collections import namedtuple
-
import logging
import random
import uuid
+from collections import namedtuple
-from apache_beam import pvalue
from apache_beam import coders
+from apache_beam import pvalue
from apache_beam.portability.api import beam_runner_api_pb2
from apache_beam.pvalue import AsIter
from apache_beam.pvalue import AsSingleton
from apache_beam.transforms import core
from apache_beam.transforms import ptransform
from apache_beam.transforms import window
-from apache_beam.transforms.display import HasDisplayData
from apache_beam.transforms.display import DisplayDataItem
+from apache_beam.transforms.display import HasDisplayData
from apache_beam.utils import urns
from apache_beam.utils.windowed_value import WindowedValue
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/localfilesystem_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/localfilesystem_test.py b/sdks/python/apache_beam/io/localfilesystem_test.py
index 04cf5b7..8c34ecd 100644
--- a/sdks/python/apache_beam/io/localfilesystem_test.py
+++ b/sdks/python/apache_beam/io/localfilesystem_test.py
@@ -18,12 +18,12 @@
"""Unit tests for LocalFileSystem."""
-import unittest
-
import filecmp
import os
import shutil
import tempfile
+import unittest
+
import mock
from apache_beam.io import localfilesystem
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/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 bea9708..712049b 100644
--- a/sdks/python/apache_beam/io/source_test_utils.py
+++ b/sdks/python/apache_beam/io/source_test_utils.py
@@ -44,12 +44,12 @@ For example usages, see the unit tests of modules such as
* apache_beam.io.avroio_test.py
"""
-from collections import namedtuple
import logging
import threading
import weakref
-
+from collections import namedtuple
from multiprocessing.pool import ThreadPool
+
from apache_beam.io import iobase
__all__ = ['read_from_source', 'assert_sources_equal_reference_source',
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/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 00522c9..af2d4b8 100644
--- a/sdks/python/apache_beam/io/source_test_utils_test.py
+++ b/sdks/python/apache_beam/io/source_test_utils_test.py
@@ -19,8 +19,8 @@ import logging
import tempfile
import unittest
-from apache_beam.io.filebasedsource_test import LineSource
import apache_beam.io.source_test_utils as source_test_utils
+from apache_beam.io.filebasedsource_test import LineSource
class SourceTestUtilsTest(unittest.TestCase):
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/sources_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/sources_test.py b/sdks/python/apache_beam/io/sources_test.py
index 10d401b..8f885e5 100644
--- a/sdks/python/apache_beam/io/sources_test.py
+++ b/sdks/python/apache_beam/io/sources_test.py
@@ -23,7 +23,6 @@ import tempfile
import unittest
import apache_beam as beam
-
from apache_beam import coders
from apache_beam.io import iobase
from apache_beam.io import range_trackers
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/textio.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/textio.py b/sdks/python/apache_beam/io/textio.py
index 9708df7..c25181d 100644
--- a/sdks/python/apache_beam/io/textio.py
+++ b/sdks/python/apache_beam/io/textio.py
@@ -19,12 +19,13 @@
from __future__ import absolute_import
-from functools import partial
+
import logging
+from functools import partial
from apache_beam.coders import coders
-from apache_beam.io import filebasedsource
from apache_beam.io import filebasedsink
+from apache_beam.io import filebasedsource
from apache_beam.io import iobase
from apache_beam.io.filebasedsource import ReadAllFiles
from apache_beam.io.filesystem import CompressionTypes
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/io/textio_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/textio_test.py b/sdks/python/apache_beam/io/textio_test.py
index b29ca5a..475848f 100644
--- a/sdks/python/apache_beam/io/textio_test.py
+++ b/sdks/python/apache_beam/io/textio_test.py
@@ -27,26 +27,22 @@ import tempfile
import unittest
import apache_beam as beam
-from apache_beam.io import iobase, ReadAllFromText
import apache_beam.io.source_test_utils as source_test_utils
-
-# Importing following private classes for testing.
-from apache_beam.io.textio import _TextSink as TextSink
-from apache_beam.io.textio import _TextSource as TextSource
-
-from apache_beam.io.textio import ReadFromText
-from apache_beam.io.textio import WriteToText
-
from apache_beam import coders
+from apache_beam.io import ReadAllFromText
+from apache_beam.io import iobase
from apache_beam.io.filebasedsource_test import EOL
from apache_beam.io.filebasedsource_test import write_data
from apache_beam.io.filebasedsource_test import write_pattern
from apache_beam.io.filesystem import CompressionTypes
-
+from apache_beam.io.textio import _TextSink as TextSink
+from apache_beam.io.textio import _TextSource as TextSource
+# Importing following private classes for testing.
+from apache_beam.io.textio import ReadFromText
+from apache_beam.io.textio import WriteToText
from apache_beam.testing.test_pipeline import TestPipeline
from apache_beam.testing.util import assert_that
from apache_beam.testing.util import equal_to
-
from apache_beam.transforms.core import Create
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/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 d7eb932..5af0716 100644
--- a/sdks/python/apache_beam/io/tfrecordio.py
+++ b/sdks/python/apache_beam/io/tfrecordio.py
@@ -21,14 +21,15 @@ from __future__ import absolute_import
import logging
import struct
+import crcmod
+
from apache_beam import coders
-from apache_beam.io import filebasedsource
from apache_beam.io import filebasedsink
+from apache_beam.io import filebasedsource
from apache_beam.io.filesystem import CompressionTypes
from apache_beam.io.iobase import Read
from apache_beam.io.iobase import Write
from apache_beam.transforms import PTransform
-import crcmod
__all__ = ['ReadFromTFRecord', 'WriteToTFRecord']
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/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 3c70ade..f7a160a 100644
--- a/sdks/python/apache_beam/io/tfrecordio_test.py
+++ b/sdks/python/apache_beam/io/tfrecordio_test.py
@@ -27,19 +27,19 @@ import shutil
import tempfile
import unittest
+import crcmod
+
import apache_beam as beam
from apache_beam import coders
from apache_beam.io.filesystem import CompressionTypes
+from apache_beam.io.tfrecordio import ReadFromTFRecord
+from apache_beam.io.tfrecordio import WriteToTFRecord
from apache_beam.io.tfrecordio import _TFRecordSink
from apache_beam.io.tfrecordio import _TFRecordSource
from apache_beam.io.tfrecordio import _TFRecordUtil
-from apache_beam.io.tfrecordio import ReadFromTFRecord
-from apache_beam.io.tfrecordio import WriteToTFRecord
from apache_beam.testing.test_pipeline import TestPipeline
from apache_beam.testing.util import assert_that
from apache_beam.testing.util import equal_to
-import crcmod
-
try:
import tensorflow as tf # pylint: disable=import-error
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/metrics/cells_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/metrics/cells_test.py b/sdks/python/apache_beam/metrics/cells_test.py
index a4c8a43..c0664ab 100644
--- a/sdks/python/apache_beam/metrics/cells_test.py
+++ b/sdks/python/apache_beam/metrics/cells_test.py
@@ -18,10 +18,10 @@
import threading
import unittest
+from apache_beam.metrics.cells import CellCommitState
from apache_beam.metrics.cells import CounterCell
from apache_beam.metrics.cells import DistributionCell
from apache_beam.metrics.cells import DistributionData
-from apache_beam.metrics.cells import CellCommitState
class TestCounterCell(unittest.TestCase):
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/metrics/execution.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/metrics/execution.py b/sdks/python/apache_beam/metrics/execution.py
index 675e49c..1704b98 100644
--- a/sdks/python/apache_beam/metrics/execution.py
+++ b/sdks/python/apache_beam/metrics/execution.py
@@ -29,10 +29,11 @@ Available classes:
- MetricsContainer - Holds the metrics of a single step and a single
unit-of-commit (bundle).
"""
-from collections import defaultdict
import threading
+from collections import defaultdict
-from apache_beam.metrics.cells import CounterCell, DistributionCell
+from apache_beam.metrics.cells import CounterCell
+from apache_beam.metrics.cells import DistributionCell
class MetricKey(object):
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/metrics/execution_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/metrics/execution_test.py b/sdks/python/apache_beam/metrics/execution_test.py
index 54569c1..abf23e3 100644
--- a/sdks/python/apache_beam/metrics/execution_test.py
+++ b/sdks/python/apache_beam/metrics/execution_test.py
@@ -18,10 +18,10 @@
import unittest
from apache_beam.metrics.cells import CellCommitState
+from apache_beam.metrics.execution import MetricKey
from apache_beam.metrics.execution import MetricsContainer
-from apache_beam.metrics.execution import ScopedMetricsContainer
from apache_beam.metrics.execution import MetricsEnvironment
-from apache_beam.metrics.execution import MetricKey
+from apache_beam.metrics.execution import ScopedMetricsContainer
from apache_beam.metrics.metric import Metrics
from apache_beam.metrics.metricbase import MetricName
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/metrics/metric.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/metrics/metric.py b/sdks/python/apache_beam/metrics/metric.py
index f99c0c4..8fbf980 100644
--- a/sdks/python/apache_beam/metrics/metric.py
+++ b/sdks/python/apache_beam/metrics/metric.py
@@ -27,7 +27,8 @@ and displayed as part of their pipeline execution.
import inspect
from apache_beam.metrics.execution import MetricsEnvironment
-from apache_beam.metrics.metricbase import Counter, Distribution
+from apache_beam.metrics.metricbase import Counter
+from apache_beam.metrics.metricbase import Distribution
from apache_beam.metrics.metricbase import MetricName
__all__ = ['Metrics', 'MetricsFilter']
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/metrics/metric_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/metrics/metric_test.py b/sdks/python/apache_beam/metrics/metric_test.py
index 56b7468..75c3aa0 100644
--- a/sdks/python/apache_beam/metrics/metric_test.py
+++ b/sdks/python/apache_beam/metrics/metric_test.py
@@ -21,9 +21,9 @@ from apache_beam.metrics.cells import DistributionData
from apache_beam.metrics.execution import MetricKey
from apache_beam.metrics.execution import MetricsContainer
from apache_beam.metrics.execution import MetricsEnvironment
+from apache_beam.metrics.metric import MetricResults
from apache_beam.metrics.metric import Metrics
from apache_beam.metrics.metric import MetricsFilter
-from apache_beam.metrics.metric import MetricResults
from apache_beam.metrics.metricbase import MetricName
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/options/pipeline_options.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/options/pipeline_options.py b/sdks/python/apache_beam/options/pipeline_options.py
index db65b3c..3abcbf2 100644
--- a/sdks/python/apache_beam/options/pipeline_options.py
+++ b/sdks/python/apache_beam/options/pipeline_options.py
@@ -19,11 +19,10 @@
import argparse
-from apache_beam.transforms.display import HasDisplayData
-from apache_beam.options.value_provider import StaticValueProvider
from apache_beam.options.value_provider import RuntimeValueProvider
+from apache_beam.options.value_provider import StaticValueProvider
from apache_beam.options.value_provider import ValueProvider
-
+from apache_beam.transforms.display import HasDisplayData
__all__ = [
'PipelineOptions',
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/options/pipeline_options_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/options/pipeline_options_test.py b/sdks/python/apache_beam/options/pipeline_options_test.py
index f4dd4d9..66c69bd 100644
--- a/sdks/python/apache_beam/options/pipeline_options_test.py
+++ b/sdks/python/apache_beam/options/pipeline_options_test.py
@@ -21,11 +21,12 @@ import logging
import unittest
import hamcrest as hc
-from apache_beam.transforms.display import DisplayData
-from apache_beam.transforms.display_test import DisplayDataItemMatcher
+
from apache_beam.options.pipeline_options import PipelineOptions
-from apache_beam.options.value_provider import StaticValueProvider
from apache_beam.options.value_provider import RuntimeValueProvider
+from apache_beam.options.value_provider import StaticValueProvider
+from apache_beam.transforms.display import DisplayData
+from apache_beam.transforms.display_test import DisplayDataItemMatcher
class PipelineOptionsTest(unittest.TestCase):
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/options/pipeline_options_validator_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/options/pipeline_options_validator_test.py b/sdks/python/apache_beam/options/pipeline_options_validator_test.py
index 97834cc..8ff66c7 100644
--- a/sdks/python/apache_beam/options/pipeline_options_validator_test.py
+++ b/sdks/python/apache_beam/options/pipeline_options_validator_test.py
@@ -20,10 +20,11 @@
import logging
import unittest
+from hamcrest.core.base_matcher import BaseMatcher
+
from apache_beam.internal import pickler
from apache_beam.options.pipeline_options import PipelineOptions
from apache_beam.options.pipeline_options_validator import PipelineOptionsValidator
-from hamcrest.core.base_matcher import BaseMatcher
# Mock runners to use for validations.
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/options/value_provider.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/options/value_provider.py b/sdks/python/apache_beam/options/value_provider.py
index f7630bd..fe4614d 100644
--- a/sdks/python/apache_beam/options/value_provider.py
+++ b/sdks/python/apache_beam/options/value_provider.py
@@ -23,7 +23,6 @@ from functools import wraps
from apache_beam import error
-
__all__ = [
'ValueProvider',
'StaticValueProvider',
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/pipeline.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/pipeline.py b/sdks/python/apache_beam/pipeline.py
index 1ade6c0..1ebd099 100644
--- a/sdks/python/apache_beam/pipeline.py
+++ b/sdks/python/apache_beam/pipeline.py
@@ -55,20 +55,19 @@ import tempfile
from apache_beam import pvalue
from apache_beam.internal import pickler
-from apache_beam.pvalue import PCollection
-from apache_beam.runners import create_runner
-from apache_beam.runners import PipelineRunner
-from apache_beam.transforms import ptransform
-from apache_beam.typehints import typehints
-from apache_beam.typehints import TypeCheckError
from apache_beam.options.pipeline_options import PipelineOptions
from apache_beam.options.pipeline_options import SetupOptions
from apache_beam.options.pipeline_options import StandardOptions
from apache_beam.options.pipeline_options import TypeOptions
from apache_beam.options.pipeline_options_validator import PipelineOptionsValidator
-from apache_beam.utils.annotations import deprecated
+from apache_beam.pvalue import PCollection
+from apache_beam.runners import PipelineRunner
+from apache_beam.runners import create_runner
+from apache_beam.transforms import ptransform
+from apache_beam.typehints import TypeCheckError
+from apache_beam.typehints import typehints
from apache_beam.utils import urns
-
+from apache_beam.utils.annotations import deprecated
__all__ = ['Pipeline']
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/pipeline_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/pipeline_test.py b/sdks/python/apache_beam/pipeline_test.py
index b3ac100..27304b1 100644
--- a/sdks/python/apache_beam/pipeline_test.py
+++ b/sdks/python/apache_beam/pipeline_test.py
@@ -21,16 +21,13 @@ import logging
import platform
import unittest
-# TODO(BEAM-1555): Test is failing on the service, with FakeSource.
-# from nose.plugins.attrib import attr
-
import apache_beam as beam
from apache_beam.io import Read
from apache_beam.metrics import Metrics
from apache_beam.pipeline import Pipeline
-from apache_beam.pipeline import PTransformOverride
from apache_beam.pipeline import PipelineOptions
from apache_beam.pipeline import PipelineVisitor
+from apache_beam.pipeline import PTransformOverride
from apache_beam.pvalue import AsSingleton
from apache_beam.runners import DirectRunner
from apache_beam.runners.dataflow.native_io.iobase import NativeSource
@@ -39,9 +36,9 @@ from apache_beam.testing.util import assert_that
from apache_beam.testing.util import equal_to
from apache_beam.transforms import CombineGlobally
from apache_beam.transforms import Create
+from apache_beam.transforms import DoFn
from apache_beam.transforms import FlatMap
from apache_beam.transforms import Map
-from apache_beam.transforms import DoFn
from apache_beam.transforms import ParDo
from apache_beam.transforms import PTransform
from apache_beam.transforms import WindowInto
@@ -49,6 +46,10 @@ from apache_beam.transforms.window import SlidingWindows
from apache_beam.transforms.window import TimestampedValue
from apache_beam.utils.timestamp import MIN_TIMESTAMP
+# TODO(BEAM-1555): Test is failing on the service, with FakeSource.
+# from nose.plugins.attrib import attr
+
+
class FakeSource(NativeSource):
"""Fake source returning a fixed list of values."""
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/pvalue.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/pvalue.py b/sdks/python/apache_beam/pvalue.py
index 35686f7..53a6121 100644
--- a/sdks/python/apache_beam/pvalue.py
+++ b/sdks/python/apache_beam/pvalue.py
@@ -30,7 +30,6 @@ import itertools
from apache_beam import typehints
-
__all__ = [
'PCollection',
'TaggedOutput',
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/common.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/common.py b/sdks/python/apache_beam/runners/common.py
index 8453569..66c033f 100644
--- a/sdks/python/apache_beam/runners/common.py
+++ b/sdks/python/apache_beam/runners/common.py
@@ -29,9 +29,9 @@ from apache_beam.internal import util
from apache_beam.metrics.execution import ScopedMetricsContainer
from apache_beam.pvalue import TaggedOutput
from apache_beam.transforms import core
+from apache_beam.transforms.window import GlobalWindow
from apache_beam.transforms.window import TimestampedValue
from apache_beam.transforms.window import WindowFn
-from apache_beam.transforms.window import GlobalWindow
from apache_beam.utils.windowed_value import WindowedValue
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/common_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/common_test.py b/sdks/python/apache_beam/runners/common_test.py
index 62a6955..e0f628c7 100644
--- a/sdks/python/apache_beam/runners/common_test.py
+++ b/sdks/python/apache_beam/runners/common_test.py
@@ -17,8 +17,8 @@
import unittest
-from apache_beam.transforms.core import DoFn
from apache_beam.runners.common import DoFnSignature
+from apache_beam.transforms.core import DoFn
class DoFnSignatureTest(unittest.TestCase):
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/dataflow/dataflow_metrics.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/dataflow/dataflow_metrics.py b/sdks/python/apache_beam/runners/dataflow/dataflow_metrics.py
index 24916fd..c7eb88e 100644
--- a/sdks/python/apache_beam/runners/dataflow/dataflow_metrics.py
+++ b/sdks/python/apache_beam/runners/dataflow/dataflow_metrics.py
@@ -21,8 +21,8 @@ responding to queries of current metrics by going to the dataflow
service.
"""
-from collections import defaultdict
import numbers
+from collections import defaultdict
from apache_beam.metrics.cells import DistributionData
from apache_beam.metrics.cells import DistributionResult