beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rober...@apache.org
Subject [2/4] beam git commit: Isort the libraries
Date Fri, 01 Sep 2017 22:09:51 GMT
http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/dataflow/dataflow_runner.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/dataflow/dataflow_runner.py b/sdks/python/apache_beam/runners/dataflow/dataflow_runner.py
index 56cc46c..f4cf459 100644
--- a/sdks/python/apache_beam/runners/dataflow/dataflow_runner.py
+++ b/sdks/python/apache_beam/runners/dataflow/dataflow_runner.py
@@ -21,37 +21,36 @@ The runner will create a JSON description of the job graph and then submit it
 to the Dataflow Service for remote execution by a worker.
 """
 
-from collections import defaultdict
 import logging
 import threading
 import time
 import traceback
 import urllib
+from collections import defaultdict
 
 import apache_beam as beam
-from apache_beam import error
 from apache_beam import coders
+from apache_beam import error
 from apache_beam import pvalue
 from apache_beam.internal import pickler
 from apache_beam.internal.gcp import json_value
+from apache_beam.options.pipeline_options import SetupOptions
+from apache_beam.options.pipeline_options import StandardOptions
+from apache_beam.options.pipeline_options import TestOptions
 from apache_beam.pvalue import AsSideInput
 from apache_beam.runners.dataflow.dataflow_metrics import DataflowMetrics
 from apache_beam.runners.dataflow.internal import names
 from apache_beam.runners.dataflow.internal.clients import dataflow as dataflow_api
 from apache_beam.runners.dataflow.internal.names import PropertyNames
 from apache_beam.runners.dataflow.internal.names import TransformNames
-from apache_beam.runners.runner import PValueCache
 from apache_beam.runners.runner import PipelineResult
 from apache_beam.runners.runner import PipelineRunner
 from apache_beam.runners.runner import PipelineState
+from apache_beam.runners.runner import PValueCache
 from apache_beam.transforms.display import DisplayData
 from apache_beam.typehints import typehints
-from apache_beam.options.pipeline_options import SetupOptions
-from apache_beam.options.pipeline_options import StandardOptions
-from apache_beam.options.pipeline_options import TestOptions
 from apache_beam.utils.plugin import BeamPlugin
 
-
 __all__ = ['DataflowRunner']
 
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/dataflow/dataflow_runner_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/dataflow/dataflow_runner_test.py b/sdks/python/apache_beam/runners/dataflow/dataflow_runner_test.py
index 8e708e6..e73a94f 100644
--- a/sdks/python/apache_beam/runners/dataflow/dataflow_runner_test.py
+++ b/sdks/python/apache_beam/runners/dataflow/dataflow_runner_test.py
@@ -25,22 +25,22 @@ import mock
 
 import apache_beam as beam
 import apache_beam.transforms as ptransform
-
 from apache_beam.options.pipeline_options import PipelineOptions
-from apache_beam.pipeline import Pipeline, AppliedPTransform
+from apache_beam.pipeline import AppliedPTransform
+from apache_beam.pipeline import Pipeline
 from apache_beam.pvalue import PCollection
-from apache_beam.runners import create_runner
 from apache_beam.runners import DataflowRunner
 from apache_beam.runners import TestDataflowRunner
+from apache_beam.runners import create_runner
 from apache_beam.runners.dataflow.dataflow_runner import DataflowPipelineResult
 from apache_beam.runners.dataflow.dataflow_runner import DataflowRuntimeException
 from apache_beam.runners.dataflow.internal.clients import dataflow as dataflow_api
 from apache_beam.runners.runner import PipelineState
 from apache_beam.testing.test_pipeline import TestPipeline
-from apache_beam.transforms.display import DisplayDataItem
-from apache_beam.transforms.core import _GroupByKeyOnly
-from apache_beam.transforms.core import Windowing
 from apache_beam.transforms import window
+from apache_beam.transforms.core import Windowing
+from apache_beam.transforms.core import _GroupByKeyOnly
+from apache_beam.transforms.display import DisplayDataItem
 from apache_beam.typehints import typehints
 
 # Protect against environments where apitools library is not available.

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/dataflow/internal/apiclient.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/dataflow/internal/apiclient.py b/sdks/python/apache_beam/runners/dataflow/internal/apiclient.py
index a1f9301..d010065 100644
--- a/sdks/python/apache_beam/runners/dataflow/internal/apiclient.py
+++ b/sdks/python/apache_beam/runners/dataflow/internal/apiclient.py
@@ -26,8 +26,8 @@ import logging
 import os
 import re
 import time
-from StringIO import StringIO
 from datetime import datetime
+from StringIO import StringIO
 
 from apitools.base.py import encoding
 from apitools.base.py import exceptions
@@ -36,6 +36,10 @@ from apache_beam.internal.gcp.auth import get_service_credentials
 from apache_beam.internal.gcp.json_value import to_json_value
 from apache_beam.io.filesystems import FileSystems
 from apache_beam.io.gcp.internal.clients import storage
+from apache_beam.options.pipeline_options import DebugOptions
+from apache_beam.options.pipeline_options import GoogleCloudOptions
+from apache_beam.options.pipeline_options import StandardOptions
+from apache_beam.options.pipeline_options import WorkerOptions
 from apache_beam.runners.dataflow.internal import dependency
 from apache_beam.runners.dataflow.internal.clients import dataflow
 from apache_beam.runners.dataflow.internal.dependency import get_sdk_name_and_version
@@ -43,11 +47,6 @@ from apache_beam.runners.dataflow.internal.names import PropertyNames
 from apache_beam.transforms import cy_combiners
 from apache_beam.transforms.display import DisplayData
 from apache_beam.utils import retry
-from apache_beam.options.pipeline_options import DebugOptions
-from apache_beam.options.pipeline_options import GoogleCloudOptions
-from apache_beam.options.pipeline_options import StandardOptions
-from apache_beam.options.pipeline_options import WorkerOptions
-
 
 # Environment version information. It is passed to the service during a
 # a job submission and is used by the service to establish what features

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/dataflow/internal/apiclient_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/dataflow/internal/apiclient_test.py b/sdks/python/apache_beam/runners/dataflow/internal/apiclient_test.py
index 407ffcf..e7cced7 100644
--- a/sdks/python/apache_beam/runners/dataflow/internal/apiclient_test.py
+++ b/sdks/python/apache_beam/runners/dataflow/internal/apiclient_test.py
@@ -21,7 +21,6 @@ from mock import Mock
 
 from apache_beam.metrics.cells import DistributionData
 from apache_beam.options.pipeline_options import PipelineOptions
-
 from apache_beam.runners.dataflow.internal.clients import dataflow
 
 # Protect against environments where apitools library is not available.

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/dataflow/internal/clients/dataflow/dataflow_v1b3_messages.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/dataflow/internal/clients/dataflow/dataflow_v1b3_messages.py b/sdks/python/apache_beam/runners/dataflow/internal/clients/dataflow/dataflow_v1b3_messages.py
index e81329f..a517e7c 100644
--- a/sdks/python/apache_beam/runners/dataflow/internal/clients/dataflow/dataflow_v1b3_messages.py
+++ b/sdks/python/apache_beam/runners/dataflow/internal/clients/dataflow/dataflow_v1b3_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 = 'dataflow'
 
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/dataflow/internal/clients/dataflow/message_matchers.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/dataflow/internal/clients/dataflow/message_matchers.py b/sdks/python/apache_beam/runners/dataflow/internal/clients/dataflow/message_matchers.py
index 4dda47a..805473a 100644
--- a/sdks/python/apache_beam/runners/dataflow/internal/clients/dataflow/message_matchers.py
+++ b/sdks/python/apache_beam/runners/dataflow/internal/clients/dataflow/message_matchers.py
@@ -17,7 +17,6 @@
 
 from hamcrest.core.base_matcher import BaseMatcher
 
-
 IGNORED = object()
 
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/dataflow/internal/clients/dataflow/message_matchers_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/dataflow/internal/clients/dataflow/message_matchers_test.py b/sdks/python/apache_beam/runners/dataflow/internal/clients/dataflow/message_matchers_test.py
index 3163c9b..15bb9ef 100644
--- a/sdks/python/apache_beam/runners/dataflow/internal/clients/dataflow/message_matchers_test.py
+++ b/sdks/python/apache_beam/runners/dataflow/internal/clients/dataflow/message_matchers_test.py
@@ -15,9 +15,10 @@
 # limitations under the License.
 #
 import unittest
+
 import hamcrest as hc
-import apache_beam.runners.dataflow.internal.clients.dataflow as dataflow
 
+import apache_beam.runners.dataflow.internal.clients.dataflow as dataflow
 from apache_beam.internal.gcp.json_value import to_json_value
 from apache_beam.runners.dataflow.internal.clients.dataflow import message_matchers
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/dataflow/internal/dependency.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/dataflow/internal/dependency.py b/sdks/python/apache_beam/runners/dataflow/internal/dependency.py
index f5dd2bd..f4131dc 100644
--- a/sdks/python/apache_beam/runners/dataflow/internal/dependency.py
+++ b/sdks/python/apache_beam/runners/dataflow/internal/dependency.py
@@ -64,10 +64,10 @@ import tempfile
 from apache_beam import version as beam_version
 from apache_beam.internal import pickler
 from apache_beam.io.filesystems import FileSystems
-from apache_beam.runners.dataflow.internal import names
-from apache_beam.utils import processes
 from apache_beam.options.pipeline_options import GoogleCloudOptions
 from apache_beam.options.pipeline_options import SetupOptions
+from apache_beam.runners.dataflow.internal import names
+from apache_beam.utils import processes
 
 # All constants are for internal use only; no backwards-compatibility
 # guarantees.

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/dataflow/internal/dependency_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/dataflow/internal/dependency_test.py b/sdks/python/apache_beam/runners/dataflow/internal/dependency_test.py
index e555b69..6d9b061 100644
--- a/sdks/python/apache_beam/runners/dataflow/internal/dependency_test.py
+++ b/sdks/python/apache_beam/runners/dataflow/internal/dependency_test.py
@@ -24,12 +24,11 @@ import tempfile
 import unittest
 
 from apache_beam.io.filesystems import FileSystems
-from apache_beam.runners.dataflow.internal import dependency
-from apache_beam.runners.dataflow.internal import names
 from apache_beam.options.pipeline_options import GoogleCloudOptions
 from apache_beam.options.pipeline_options import PipelineOptions
 from apache_beam.options.pipeline_options import SetupOptions
-
+from apache_beam.runners.dataflow.internal import dependency
+from apache_beam.runners.dataflow.internal import names
 
 # Protect against environments where GCS 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/runners/dataflow/native_io/iobase_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/dataflow/native_io/iobase_test.py b/sdks/python/apache_beam/runners/dataflow/native_io/iobase_test.py
index 3d8c24f..01fd35f 100644
--- a/sdks/python/apache_beam/runners/dataflow/native_io/iobase_test.py
+++ b/sdks/python/apache_beam/runners/dataflow/native_io/iobase_test.py
@@ -23,18 +23,16 @@ import unittest
 from apache_beam import Create
 from apache_beam import error
 from apache_beam import pvalue
-from apache_beam.runners.dataflow.native_io.iobase import (
-    _dict_printable_fields,
-    _NativeWrite,
-    ConcatPosition,
-    DynamicSplitRequest,
-    DynamicSplitResultWithPosition,
-    NativeSink,
-    NativeSinkWriter,
-    NativeSource,
-    ReaderPosition,
-    ReaderProgress
-)
+from apache_beam.runners.dataflow.native_io.iobase import ConcatPosition
+from apache_beam.runners.dataflow.native_io.iobase import DynamicSplitRequest
+from apache_beam.runners.dataflow.native_io.iobase import DynamicSplitResultWithPosition
+from apache_beam.runners.dataflow.native_io.iobase import NativeSink
+from apache_beam.runners.dataflow.native_io.iobase import NativeSinkWriter
+from apache_beam.runners.dataflow.native_io.iobase import NativeSource
+from apache_beam.runners.dataflow.native_io.iobase import ReaderPosition
+from apache_beam.runners.dataflow.native_io.iobase import ReaderProgress
+from apache_beam.runners.dataflow.native_io.iobase import _dict_printable_fields
+from apache_beam.runners.dataflow.native_io.iobase import _NativeWrite
 from apache_beam.testing.test_pipeline import TestPipeline
 
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/dataflow/native_io/streaming_create.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/dataflow/native_io/streaming_create.py b/sdks/python/apache_beam/runners/dataflow/native_io/streaming_create.py
index 8c6c8d6..a54ee77 100644
--- a/sdks/python/apache_beam/runners/dataflow/native_io/streaming_create.py
+++ b/sdks/python/apache_beam/runners/dataflow/native_io/streaming_create.py
@@ -17,11 +17,11 @@
 
 """Create transform for streaming."""
 
-from apache_beam import pvalue
 from apache_beam import DoFn
 from apache_beam import ParDo
 from apache_beam import PTransform
 from apache_beam import Windowing
+from apache_beam import pvalue
 from apache_beam.transforms.window import GlobalWindows
 
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/dataflow/template_runner_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/dataflow/template_runner_test.py b/sdks/python/apache_beam/runners/dataflow/template_runner_test.py
index 7927219..88afe8a 100644
--- a/sdks/python/apache_beam/runners/dataflow/template_runner_test.py
+++ b/sdks/python/apache_beam/runners/dataflow/template_runner_test.py
@@ -24,8 +24,8 @@ import tempfile
 import unittest
 
 import apache_beam as beam
-from apache_beam.pipeline import Pipeline
 from apache_beam.options.pipeline_options import PipelineOptions
+from apache_beam.pipeline import Pipeline
 from apache_beam.runners.dataflow.dataflow_runner import DataflowRunner
 
 # Protect against environments where apitools library is not available.

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/dataflow/test_dataflow_runner.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/dataflow/test_dataflow_runner.py b/sdks/python/apache_beam/runners/dataflow/test_dataflow_runner.py
index 96e6a66..e7c8d06 100644
--- a/sdks/python/apache_beam/runners/dataflow/test_dataflow_runner.py
+++ b/sdks/python/apache_beam/runners/dataflow/test_dataflow_runner.py
@@ -18,10 +18,10 @@
 """Wrapper of Beam runners that's built for running and verifying e2e tests."""
 
 from apache_beam.internal import pickler
-from apache_beam.options.pipeline_options import TestOptions, GoogleCloudOptions
+from apache_beam.options.pipeline_options import GoogleCloudOptions
+from apache_beam.options.pipeline_options import TestOptions
 from apache_beam.runners.dataflow.dataflow_runner import DataflowRunner
 
-
 __all__ = ['TestDataflowRunner']
 
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/direct/consumer_tracking_pipeline_visitor_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/direct/consumer_tracking_pipeline_visitor_test.py b/sdks/python/apache_beam/runners/direct/consumer_tracking_pipeline_visitor_test.py
index 97d1ee8..4efaa27 100644
--- a/sdks/python/apache_beam/runners/direct/consumer_tracking_pipeline_visitor_test.py
+++ b/sdks/python/apache_beam/runners/direct/consumer_tracking_pipeline_visitor_test.py
@@ -21,8 +21,8 @@ import logging
 import unittest
 
 from apache_beam import pvalue
-from apache_beam.io import iobase
 from apache_beam.io import Read
+from apache_beam.io import iobase
 from apache_beam.pipeline import Pipeline
 from apache_beam.pvalue import AsList
 from apache_beam.runners.direct import DirectRunner

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/direct/direct_metrics.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/direct/direct_metrics.py b/sdks/python/apache_beam/runners/direct/direct_metrics.py
index 9d23487..aa35fb7 100644
--- a/sdks/python/apache_beam/runners/direct/direct_metrics.py
+++ b/sdks/python/apache_beam/runners/direct/direct_metrics.py
@@ -20,8 +20,8 @@ DirectRunner implementation of MetricResults. It is in charge not only of
 responding to queries of current metrics, but also of keeping the common
 state consistent.
 """
-from collections import defaultdict
 import threading
+from collections import defaultdict
 
 from apache_beam.metrics.cells import CounterAggregator
 from apache_beam.metrics.cells import DistributionAggregator

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/direct/direct_metrics_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/direct/direct_metrics_test.py b/sdks/python/apache_beam/runners/direct/direct_metrics_test.py
index 256b91f..f361786 100644
--- a/sdks/python/apache_beam/runners/direct/direct_metrics_test.py
+++ b/sdks/python/apache_beam/runners/direct/direct_metrics_test.py
@@ -19,12 +19,12 @@ import unittest
 
 import hamcrest as hc
 
-from apache_beam.metrics.metricbase import MetricName
-from apache_beam.metrics.execution import MetricUpdates
-from apache_beam.metrics.execution import MetricResult
-from apache_beam.metrics.execution import MetricKey
 from apache_beam.metrics.cells import DistributionData
 from apache_beam.metrics.cells import DistributionResult
+from apache_beam.metrics.execution import MetricKey
+from apache_beam.metrics.execution import MetricResult
+from apache_beam.metrics.execution import MetricUpdates
+from apache_beam.metrics.metricbase import MetricName
 from apache_beam.runners.direct.direct_metrics import DirectMetrics
 
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/direct/direct_runner.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/direct/direct_runner.py b/sdks/python/apache_beam/runners/direct/direct_runner.py
index 2deb7da..794a96b 100644
--- a/sdks/python/apache_beam/runners/direct/direct_runner.py
+++ b/sdks/python/apache_beam/runners/direct/direct_runner.py
@@ -31,19 +31,18 @@ from google.protobuf import wrappers_pb2
 import apache_beam as beam
 from apache_beam import typehints
 from apache_beam.metrics.execution import MetricsEnvironment
+from apache_beam.options.pipeline_options import DirectOptions
+from apache_beam.options.pipeline_options import StandardOptions
+from apache_beam.options.value_provider import RuntimeValueProvider
 from apache_beam.pvalue import PCollection
 from apache_beam.runners.direct.bundle_factory import BundleFactory
 from apache_beam.runners.runner import PipelineResult
 from apache_beam.runners.runner import PipelineRunner
 from apache_beam.runners.runner import PipelineState
 from apache_beam.runners.runner import PValueCache
-from apache_beam.transforms.ptransform import PTransform
 from apache_beam.transforms.core import _GroupAlsoByWindow
 from apache_beam.transforms.core import _GroupByKeyOnly
-from apache_beam.options.pipeline_options import DirectOptions
-from apache_beam.options.pipeline_options import StandardOptions
-from apache_beam.options.value_provider import RuntimeValueProvider
-
+from apache_beam.transforms.ptransform import PTransform
 
 __all__ = ['DirectRunner']
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/direct/evaluation_context.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/direct/evaluation_context.py b/sdks/python/apache_beam/runners/direct/evaluation_context.py
index 54c407c..9913813 100644
--- a/sdks/python/apache_beam/runners/direct/evaluation_context.py
+++ b/sdks/python/apache_beam/runners/direct/evaluation_context.py
@@ -22,11 +22,11 @@ from __future__ import absolute_import
 import collections
 import threading
 
-from apache_beam.transforms import sideinputs
 from apache_beam.runners.direct.clock import Clock
-from apache_beam.runners.direct.watermark_manager import WatermarkManager
-from apache_beam.runners.direct.executor import TransformExecutor
 from apache_beam.runners.direct.direct_metrics import DirectMetrics
+from apache_beam.runners.direct.executor import TransformExecutor
+from apache_beam.runners.direct.watermark_manager import WatermarkManager
+from apache_beam.transforms import sideinputs
 from apache_beam.transforms.trigger import InMemoryUnmergedState
 from apache_beam.utils import counters
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/direct/helper_transforms.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/direct/helper_transforms.py b/sdks/python/apache_beam/runners/direct/helper_transforms.py
index 374cd4e..26b0701 100644
--- a/sdks/python/apache_beam/runners/direct/helper_transforms.py
+++ b/sdks/python/apache_beam/runners/direct/helper_transforms.py
@@ -20,8 +20,8 @@ import itertools
 
 import apache_beam as beam
 from apache_beam import typehints
-from apache_beam.utils.windowed_value import WindowedValue
 from apache_beam.internal.util import ArgumentPlaceholder
+from apache_beam.utils.windowed_value import WindowedValue
 
 
 class LiftedCombinePerKey(beam.PTransform):

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/direct/transform_evaluator.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/direct/transform_evaluator.py b/sdks/python/apache_beam/runners/direct/transform_evaluator.py
index cb2ace2..8906ccb 100644
--- a/sdks/python/apache_beam/runners/direct/transform_evaluator.py
+++ b/sdks/python/apache_beam/runners/direct/transform_evaluator.py
@@ -23,36 +23,36 @@ import collections
 import random
 import time
 
+import apache_beam.io as io
 from apache_beam import coders
 from apache_beam import pvalue
 from apache_beam.internal import pickler
-import apache_beam.io as io
+from apache_beam.options.pipeline_options import TypeOptions
 from apache_beam.runners.common import DoFnRunner
 from apache_beam.runners.common import DoFnState
-from apache_beam.runners.direct.direct_runner import _StreamingGroupByKeyOnly
+from apache_beam.runners.dataflow.native_io.iobase import _NativeWrite  # pylint: disable=protected-access
 from apache_beam.runners.direct.direct_runner import _StreamingGroupAlsoByWindow
-from apache_beam.runners.direct.watermark_manager import WatermarkManager
+from apache_beam.runners.direct.direct_runner import _StreamingGroupByKeyOnly
 from apache_beam.runners.direct.util import KeyedWorkItem
 from apache_beam.runners.direct.util import TransformResult
-from apache_beam.runners.dataflow.native_io.iobase import _NativeWrite  # pylint: disable=protected-access
-from apache_beam.testing.test_stream import TestStream
+from apache_beam.runners.direct.watermark_manager import WatermarkManager
 from apache_beam.testing.test_stream import ElementEvent
-from apache_beam.testing.test_stream import WatermarkEvent
 from apache_beam.testing.test_stream import ProcessingTimeEvent
+from apache_beam.testing.test_stream import TestStream
+from apache_beam.testing.test_stream import WatermarkEvent
 from apache_beam.transforms import core
-from apache_beam.transforms.window import GlobalWindows
-from apache_beam.transforms.window import WindowedValue
-from apache_beam.transforms.trigger import create_trigger_driver
+from apache_beam.transforms.trigger import TimeDomain
 from apache_beam.transforms.trigger import _CombiningValueStateTag
 from apache_beam.transforms.trigger import _ListStateTag
-from apache_beam.transforms.trigger import TimeDomain
+from apache_beam.transforms.trigger import create_trigger_driver
+from apache_beam.transforms.window import GlobalWindows
+from apache_beam.transforms.window import WindowedValue
 from apache_beam.typehints.typecheck import OutputCheckWrapperDoFn
 from apache_beam.typehints.typecheck import TypeCheckError
 from apache_beam.typehints.typecheck import TypeCheckWrapperDoFn
 from apache_beam.utils import counters
-from apache_beam.utils.timestamp import Timestamp
 from apache_beam.utils.timestamp import MIN_TIMESTAMP
-from apache_beam.options.pipeline_options import TypeOptions
+from apache_beam.utils.timestamp import Timestamp
 
 
 class TransformEvaluatorRegistry(object):

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/experimental/python_rpc_direct/python_rpc_direct_runner.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/experimental/python_rpc_direct/python_rpc_direct_runner.py b/sdks/python/apache_beam/runners/experimental/python_rpc_direct/python_rpc_direct_runner.py
index 247ce1f..85e3f75 100644
--- a/sdks/python/apache_beam/runners/experimental/python_rpc_direct/python_rpc_direct_runner.py
+++ b/sdks/python/apache_beam/runners/experimental/python_rpc_direct/python_rpc_direct_runner.py
@@ -30,7 +30,6 @@ from apache_beam.runners.job.manager import DockerRPCManager
 from apache_beam.runners.runner import PipelineResult
 from apache_beam.runners.runner import PipelineRunner
 
-
 __all__ = ['PythonRPCDirectRunner']
 
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/experimental/python_rpc_direct/server.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/experimental/python_rpc_direct/server.py b/sdks/python/apache_beam/runners/experimental/python_rpc_direct/server.py
index bae25a4..1d07e71 100644
--- a/sdks/python/apache_beam/runners/experimental/python_rpc_direct/server.py
+++ b/sdks/python/apache_beam/runners/experimental/python_rpc_direct/server.py
@@ -19,14 +19,14 @@
 """
 import time
 import uuid
-
 from concurrent import futures
+
 import grpc
 
+from apache_beam.options.pipeline_options import PipelineOptions
+from apache_beam.pipeline import Pipeline
 from apache_beam.portability.api import beam_job_api_pb2
 from apache_beam.portability.api import beam_job_api_pb2_grpc
-from apache_beam.pipeline import Pipeline
-from apache_beam.options.pipeline_options import PipelineOptions
 from apache_beam.runners.runner import PipelineState
 
 _ONE_DAY_IN_SECONDS = 60 * 60 * 24

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/pipeline_context.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/pipeline_context.py b/sdks/python/apache_beam/runners/pipeline_context.py
index 42d7f5d..3506099 100644
--- a/sdks/python/apache_beam/runners/pipeline_context.py
+++ b/sdks/python/apache_beam/runners/pipeline_context.py
@@ -21,9 +21,9 @@ For internal use only; no backwards-compatibility guarantees.
 """
 
 
+from apache_beam import coders
 from apache_beam import pipeline
 from apache_beam import pvalue
-from apache_beam import coders
 from apache_beam.portability.api import beam_fn_api_pb2
 from apache_beam.portability.api import beam_runner_api_pb2
 from apache_beam.transforms import core

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/portability/fn_api_runner.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/portability/fn_api_runner.py b/sdks/python/apache_beam/runners/portability/fn_api_runner.py
index c9b3d9a..32dc50a 100644
--- a/sdks/python/apache_beam/runners/portability/fn_api_runner.py
+++ b/sdks/python/apache_beam/runners/portability/fn_api_runner.py
@@ -23,14 +23,14 @@ import copy
 import logging
 import Queue as queue
 import threading
-
 from concurrent import futures
-from google.protobuf import wrappers_pb2
+
 import grpc
+from google.protobuf import wrappers_pb2
 
 import apache_beam as beam  # pylint: disable=ungrouped-imports
-from apache_beam.coders import registry
 from apache_beam.coders import WindowedValueCoder
+from apache_beam.coders import registry
 from apache_beam.coders.coder_impl import create_InputStream
 from apache_beam.coders.coder_impl import create_OutputStream
 from apache_beam.internal import pickler
@@ -49,7 +49,6 @@ from apache_beam.transforms.window import GlobalWindows
 from apache_beam.utils import proto_utils
 from apache_beam.utils import urns
 
-
 # This module is experimental. No backwards-compatibility guarantees.
 
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/portability/maptask_executor_runner.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/portability/maptask_executor_runner.py b/sdks/python/apache_beam/runners/portability/maptask_executor_runner.py
index ddfc4cc..a20ceef 100644
--- a/sdks/python/apache_beam/runners/portability/maptask_executor_runner.py
+++ b/sdks/python/apache_beam/runners/portability/maptask_executor_runner.py
@@ -36,13 +36,14 @@ from apache_beam.runners.runner import PipelineRunner
 from apache_beam.runners.runner import PipelineState
 from apache_beam.runners.worker import operation_specs
 from apache_beam.runners.worker import operations
+from apache_beam.typehints import typehints
+from apache_beam.utils import profiler
+from apache_beam.utils.counters import CounterFactory
+
 try:
   from apache_beam.runners.worker import statesampler
 except ImportError:
   from apache_beam.runners.worker import statesampler_fake as statesampler
-from apache_beam.typehints import typehints
-from apache_beam.utils import profiler
-from apache_beam.utils.counters import CounterFactory
 
 # This module is experimental. No backwards-compatibility guarantees.
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/portability/maptask_executor_runner_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/portability/maptask_executor_runner_test.py b/sdks/python/apache_beam/runners/portability/maptask_executor_runner_test.py
index b7ba15a..519ab6e 100644
--- a/sdks/python/apache_beam/runners/portability/maptask_executor_runner_test.py
+++ b/sdks/python/apache_beam/runners/portability/maptask_executor_runner_test.py
@@ -21,18 +21,16 @@ import tempfile
 import unittest
 
 import apache_beam as beam
-
 from apache_beam.metrics import Metrics
 from apache_beam.metrics.execution import MetricKey
 from apache_beam.metrics.execution import MetricsEnvironment
 from apache_beam.metrics.metricbase import MetricName
-
 from apache_beam.pvalue import AsList
-from apache_beam.testing.util import assert_that
+from apache_beam.runners.portability import maptask_executor_runner
 from apache_beam.testing.util import BeamAssertException
+from apache_beam.testing.util import assert_that
 from apache_beam.testing.util import equal_to
 from apache_beam.transforms.window import TimestampedValue
-from apache_beam.runners.portability import maptask_executor_runner
 
 
 class MapTaskExecutorRunnerTest(unittest.TestCase):

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/runner.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/runner.py b/sdks/python/apache_beam/runners/runner.py
index 43ee27b..4ac6223 100644
--- a/sdks/python/apache_beam/runners/runner.py
+++ b/sdks/python/apache_beam/runners/runner.py
@@ -25,7 +25,6 @@ import shelve
 import shutil
 import tempfile
 
-
 __all__ = ['PipelineRunner', 'PipelineState', 'PipelineResult']
 
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/runner_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/runner_test.py b/sdks/python/apache_beam/runners/runner_test.py
index fa80b1c..063c8a2 100644
--- a/sdks/python/apache_beam/runners/runner_test.py
+++ b/sdks/python/apache_beam/runners/runner_test.py
@@ -33,12 +33,12 @@ from apache_beam.metrics.cells import DistributionResult
 from apache_beam.metrics.execution import MetricKey
 from apache_beam.metrics.execution import MetricResult
 from apache_beam.metrics.metricbase import MetricName
+from apache_beam.options.pipeline_options import PipelineOptions
 from apache_beam.pipeline import Pipeline
 from apache_beam.runners import DirectRunner
 from apache_beam.runners import create_runner
 from apache_beam.testing.util import assert_that
 from apache_beam.testing.util import equal_to
-from apache_beam.options.pipeline_options import PipelineOptions
 
 
 class RunnerTest(unittest.TestCase):

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/worker/bundle_processor.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/worker/bundle_processor.py b/sdks/python/apache_beam/runners/worker/bundle_processor.py
index 16c888c..068aa0a 100644
--- a/sdks/python/apache_beam/runners/worker/bundle_processor.py
+++ b/sdks/python/apache_beam/runners/worker/bundle_processor.py
@@ -29,14 +29,14 @@ import logging
 from google.protobuf import wrappers_pb2
 
 import apache_beam as beam
-from apache_beam.coders import coder_impl
 from apache_beam.coders import WindowedValueCoder
+from apache_beam.coders import coder_impl
 from apache_beam.internal import pickler
 from apache_beam.io import iobase
 from apache_beam.portability.api import beam_fn_api_pb2
 from apache_beam.portability.api import beam_runner_api_pb2
-from apache_beam.runners.dataflow.native_io import iobase as native_iobase
 from apache_beam.runners import pipeline_context
+from apache_beam.runners.dataflow.native_io import iobase as native_iobase
 from apache_beam.runners.worker import operation_specs
 from apache_beam.runners.worker import operations
 from apache_beam.utils import counters

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/worker/data_plane.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/worker/data_plane.py b/sdks/python/apache_beam/runners/worker/data_plane.py
index e713041..5c65a6d 100644
--- a/sdks/python/apache_beam/runners/worker/data_plane.py
+++ b/sdks/python/apache_beam/runners/worker/data_plane.py
@@ -27,9 +27,10 @@ import logging
 import Queue as queue
 import threading
 
+import grpc
+
 from apache_beam.coders import coder_impl
 from apache_beam.portability.api import beam_fn_api_pb2
-import grpc
 
 # This module is experimental. No backwards-compatibility guarantees.
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/worker/data_plane_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/worker/data_plane_test.py b/sdks/python/apache_beam/runners/worker/data_plane_test.py
index 360468a..db7ac0b 100644
--- a/sdks/python/apache_beam/runners/worker/data_plane_test.py
+++ b/sdks/python/apache_beam/runners/worker/data_plane_test.py
@@ -25,8 +25,8 @@ import logging
 import sys
 import threading
 import unittest
-
 from concurrent import futures
+
 import grpc
 
 from apache_beam.portability.api import beam_fn_api_pb2

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/worker/log_handler.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/worker/log_handler.py b/sdks/python/apache_beam/runners/worker/log_handler.py
index b8f6352..20bd49f 100644
--- a/sdks/python/apache_beam/runners/worker/log_handler.py
+++ b/sdks/python/apache_beam/runners/worker/log_handler.py
@@ -21,9 +21,10 @@ import math
 import Queue as queue
 import threading
 
-from apache_beam.portability.api import beam_fn_api_pb2
 import grpc
 
+from apache_beam.portability.api import beam_fn_api_pb2
+
 # This module is experimental. No backwards-compatibility guarantees.
 
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/worker/log_handler_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/worker/log_handler_test.py b/sdks/python/apache_beam/runners/worker/log_handler_test.py
index 2256bb5..7edf667 100644
--- a/sdks/python/apache_beam/runners/worker/log_handler_test.py
+++ b/sdks/python/apache_beam/runners/worker/log_handler_test.py
@@ -18,8 +18,8 @@
 
 import logging
 import unittest
-
 from concurrent import futures
+
 import grpc
 
 from apache_beam.portability.api import beam_fn_api_pb2

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/worker/opcounters.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/worker/opcounters.py b/sdks/python/apache_beam/runners/worker/opcounters.py
index 2bb15fa..f8f4b51 100644
--- a/sdks/python/apache_beam/runners/worker/opcounters.py
+++ b/sdks/python/apache_beam/runners/worker/opcounters.py
@@ -20,6 +20,7 @@
 """Counters collect the progress of the Worker for reporting to the service."""
 
 from __future__ import absolute_import
+
 import math
 import random
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/worker/opcounters_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/worker/opcounters_test.py b/sdks/python/apache_beam/runners/worker/opcounters_test.py
index 74561b8..008720f 100644
--- a/sdks/python/apache_beam/runners/worker/opcounters_test.py
+++ b/sdks/python/apache_beam/runners/worker/opcounters_test.py
@@ -25,7 +25,6 @@ from apache_beam.runners.worker.opcounters import OperationCounters
 from apache_beam.transforms.window import GlobalWindows
 from apache_beam.utils.counters import CounterFactory
 
-
 # Classes to test that we can handle a variety of objects.
 # These have to be at top level so the pickler can find them.
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/worker/operations.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/worker/operations.py b/sdks/python/apache_beam/runners/worker/operations.py
index c4f945b..1b61f8e 100644
--- a/sdks/python/apache_beam/runners/worker/operations.py
+++ b/sdks/python/apache_beam/runners/worker/operations.py
@@ -35,11 +35,11 @@ from apache_beam.runners.worker import logger
 from apache_beam.runners.worker import opcounters
 from apache_beam.runners.worker import operation_specs
 from apache_beam.runners.worker import sideinputs
+from apache_beam.transforms import sideinputs as apache_sideinputs
 from apache_beam.transforms import combiners
 from apache_beam.transforms import core
-from apache_beam.transforms import sideinputs as apache_sideinputs
-from apache_beam.transforms.combiners import curry_combine_fn
 from apache_beam.transforms.combiners import PhasedCombineFnExecutor
+from apache_beam.transforms.combiners import curry_combine_fn
 from apache_beam.transforms.window import GlobalWindows
 from apache_beam.utils.windowed_value import WindowedValue
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/runners/worker/sdk_worker_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/worker/sdk_worker_test.py b/sdks/python/apache_beam/runners/worker/sdk_worker_test.py
index dc72a5f..d371747 100644
--- a/sdks/python/apache_beam/runners/worker/sdk_worker_test.py
+++ b/sdks/python/apache_beam/runners/worker/sdk_worker_test.py
@@ -23,8 +23,8 @@ from __future__ import print_function
 
 import logging
 import unittest
-
 from concurrent import futures
+
 import grpc
 
 from apache_beam.portability.api import beam_fn_api_pb2

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/testing/pipeline_verifiers.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/testing/pipeline_verifiers.py b/sdks/python/apache_beam/testing/pipeline_verifiers.py
index 883343a..c421e25 100644
--- a/sdks/python/apache_beam/testing/pipeline_verifiers.py
+++ b/sdks/python/apache_beam/testing/pipeline_verifiers.py
@@ -32,7 +32,6 @@ from apache_beam.runners.runner import PipelineState
 from apache_beam.testing import test_utils as utils
 from apache_beam.utils import retry
 
-
 __all__ = [
     'PipelineStateMatcher',
     'FileChecksumMatcher',

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/testing/pipeline_verifiers_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/testing/pipeline_verifiers_test.py b/sdks/python/apache_beam/testing/pipeline_verifiers_test.py
index 15e0a04..3b02431 100644
--- a/sdks/python/apache_beam/testing/pipeline_verifiers_test.py
+++ b/sdks/python/apache_beam/testing/pipeline_verifiers_test.py
@@ -22,13 +22,14 @@ import tempfile
 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.localfilesystem import LocalFileSystem
 from apache_beam.runners.runner import PipelineResult
 from apache_beam.runners.runner import PipelineState
-from apache_beam.testing.test_utils import patch_retry
 from apache_beam.testing import pipeline_verifiers as verifiers
+from apache_beam.testing.test_utils import patch_retry
 
 try:
   # pylint: disable=wrong-import-order, wrong-import-position

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/testing/test_pipeline.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/testing/test_pipeline.py b/sdks/python/apache_beam/testing/test_pipeline.py
index 8380242..46eeb75 100644
--- a/sdks/python/apache_beam/testing/test_pipeline.py
+++ b/sdks/python/apache_beam/testing/test_pipeline.py
@@ -20,12 +20,12 @@
 import argparse
 import shlex
 
+from nose.plugins.skip import SkipTest
+
 from apache_beam.internal import pickler
+from apache_beam.options.pipeline_options import PipelineOptions
 from apache_beam.pipeline import Pipeline
 from apache_beam.runners.runner import PipelineState
-from apache_beam.options.pipeline_options import PipelineOptions
-from nose.plugins.skip import SkipTest
-
 
 __all__ = [
     'TestPipeline',

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/testing/test_pipeline_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/testing/test_pipeline_test.py b/sdks/python/apache_beam/testing/test_pipeline_test.py
index 747d64c7..c642c65 100644
--- a/sdks/python/apache_beam/testing/test_pipeline_test.py
+++ b/sdks/python/apache_beam/testing/test_pipeline_test.py
@@ -20,12 +20,12 @@
 import logging
 import unittest
 
-from hamcrest.core.base_matcher import BaseMatcher
 from hamcrest.core.assert_that import assert_that as hc_assert_that
+from hamcrest.core.base_matcher import BaseMatcher
 
 from apache_beam.internal import pickler
-from apache_beam.testing.test_pipeline import TestPipeline
 from apache_beam.options.pipeline_options import PipelineOptions
+from apache_beam.testing.test_pipeline import TestPipeline
 
 
 # A simple matcher that is ued for testing extra options appending.

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/testing/test_stream.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/testing/test_stream.py b/sdks/python/apache_beam/testing/test_stream.py
index 7989fb2..8a63e7b 100644
--- a/sdks/python/apache_beam/testing/test_stream.py
+++ b/sdks/python/apache_beam/testing/test_stream.py
@@ -32,7 +32,6 @@ from apache_beam.transforms.window import TimestampedValue
 from apache_beam.utils import timestamp
 from apache_beam.utils.windowed_value import WindowedValue
 
-
 __all__ = [
     'Event',
     'ElementEvent',

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/testing/test_stream_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/testing/test_stream_test.py b/sdks/python/apache_beam/testing/test_stream_test.py
index b7ca141..0f6691f 100644
--- a/sdks/python/apache_beam/testing/test_stream_test.py
+++ b/sdks/python/apache_beam/testing/test_stream_test.py
@@ -27,7 +27,8 @@ from apache_beam.testing.test_stream import ElementEvent
 from apache_beam.testing.test_stream import ProcessingTimeEvent
 from apache_beam.testing.test_stream import TestStream
 from apache_beam.testing.test_stream import WatermarkEvent
-from apache_beam.testing.util import assert_that, equal_to
+from apache_beam.testing.util import assert_that
+from apache_beam.testing.util import equal_to
 from apache_beam.transforms.window import FixedWindows
 from apache_beam.transforms.window import TimestampedValue
 from apache_beam.utils import timestamp

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/testing/test_utils.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/testing/test_utils.py b/sdks/python/apache_beam/testing/test_utils.py
index 26ca03d..41a02cf 100644
--- a/sdks/python/apache_beam/testing/test_utils.py
+++ b/sdks/python/apache_beam/testing/test_utils.py
@@ -22,12 +22,13 @@ For internal use only; no backwards-compatibility guarantees.
 
 import hashlib
 import imp
-from mock import Mock, patch
+
+from mock import Mock
+from mock import patch
 
 from apache_beam.io.filesystems import FileSystems
 from apache_beam.utils import retry
 
-
 DEFAULT_HASHING_ALG = 'sha1'
 
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/testing/test_utils_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/testing/test_utils_test.py b/sdks/python/apache_beam/testing/test_utils_test.py
index bee0bd3..093e1f1 100644
--- a/sdks/python/apache_beam/testing/test_utils_test.py
+++ b/sdks/python/apache_beam/testing/test_utils_test.py
@@ -20,6 +20,7 @@
 import logging
 import tempfile
 import unittest
+
 from mock import patch
 
 from apache_beam.io.filesystem import BeamIOError

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/testing/util.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/testing/util.py b/sdks/python/apache_beam/testing/util.py
index 959f25f..9bb18cc 100644
--- a/sdks/python/apache_beam/testing/util.py
+++ b/sdks/python/apache_beam/testing/util.py
@@ -27,11 +27,10 @@ from apache_beam.transforms import window
 from apache_beam.transforms.core import Create
 from apache_beam.transforms.core import Map
 from apache_beam.transforms.core import WindowInto
-from apache_beam.transforms.util import CoGroupByKey
 from apache_beam.transforms.ptransform import PTransform
+from apache_beam.transforms.util import CoGroupByKey
 from apache_beam.utils.annotations import experimental
 
-
 __all__ = [
     'assert_that',
     'equal_to',

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/testing/util_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/testing/util_test.py b/sdks/python/apache_beam/testing/util_test.py
index 1acebb6..9d38693 100644
--- a/sdks/python/apache_beam/testing/util_test.py
+++ b/sdks/python/apache_beam/testing/util_test.py
@@ -21,7 +21,9 @@ import unittest
 
 from apache_beam import Create
 from apache_beam.testing.test_pipeline import TestPipeline
-from apache_beam.testing.util import assert_that, equal_to, is_empty
+from apache_beam.testing.util import assert_that
+from apache_beam.testing.util import equal_to
+from apache_beam.testing.util import is_empty
 
 
 class UtilTest(unittest.TestCase):

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/transforms/combiners.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/transforms/combiners.py b/sdks/python/apache_beam/transforms/combiners.py
index 875306f..60bf2d1 100644
--- a/sdks/python/apache_beam/transforms/combiners.py
+++ b/sdks/python/apache_beam/transforms/combiners.py
@@ -26,9 +26,9 @@ from apache_beam.transforms import core
 from apache_beam.transforms import cy_combiners
 from apache_beam.transforms import ptransform
 from apache_beam.transforms.display import DisplayDataItem
+from apache_beam.typehints import KV
 from apache_beam.typehints import Any
 from apache_beam.typehints import Dict
-from apache_beam.typehints import KV
 from apache_beam.typehints import List
 from apache_beam.typehints import Tuple
 from apache_beam.typehints import TypeVariable
@@ -36,7 +36,6 @@ from apache_beam.typehints import Union
 from apache_beam.typehints import with_input_types
 from apache_beam.typehints import with_output_types
 
-
 __all__ = [
     'Count',
     'Mean',

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/transforms/combiners_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/transforms/combiners_test.py b/sdks/python/apache_beam/transforms/combiners_test.py
index cd2b595..8885d27 100644
--- a/sdks/python/apache_beam/transforms/combiners_test.py
+++ b/sdks/python/apache_beam/transforms/combiners_test.py
@@ -22,9 +22,10 @@ import unittest
 import hamcrest as hc
 
 import apache_beam as beam
-from apache_beam.testing.test_pipeline import TestPipeline
 import apache_beam.transforms.combiners as combine
-from apache_beam.testing.util import assert_that, equal_to
+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 CombineGlobally
 from apache_beam.transforms.core import Create
 from apache_beam.transforms.core import Map

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/transforms/core.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/transforms/core.py b/sdks/python/apache_beam/transforms/core.py
index d6f56d2..7f655a7 100644
--- a/sdks/python/apache_beam/transforms/core.py
+++ b/sdks/python/apache_beam/transforms/core.py
@@ -25,12 +25,13 @@ import types
 
 from google.protobuf import wrappers_pb2
 
+from apache_beam import coders
 from apache_beam import pvalue
 from apache_beam import typehints
-from apache_beam import coders
 from apache_beam.coders import typecoders
 from apache_beam.internal import pickler
 from apache_beam.internal import util
+from apache_beam.options.pipeline_options import TypeOptions
 from apache_beam.portability.api import beam_runner_api_pb2
 from apache_beam.transforms import ptransform
 from apache_beam.transforms.display import DisplayDataItem
@@ -38,25 +39,23 @@ from apache_beam.transforms.display import HasDisplayData
 from apache_beam.transforms.ptransform import PTransform
 from apache_beam.transforms.ptransform import PTransformWithSideInputs
 from apache_beam.transforms.window import MIN_TIMESTAMP
+from apache_beam.transforms.window import GlobalWindows
 from apache_beam.transforms.window import TimestampCombiner
-from apache_beam.transforms.window import WindowedValue
 from apache_beam.transforms.window import TimestampedValue
-from apache_beam.transforms.window import GlobalWindows
+from apache_beam.transforms.window import WindowedValue
 from apache_beam.transforms.window import WindowFn
+from apache_beam.typehints import KV
 from apache_beam.typehints import Any
 from apache_beam.typehints import Iterable
-from apache_beam.typehints import KV
-from apache_beam.typehints import trivial_inference
 from apache_beam.typehints import Union
-from apache_beam.typehints.decorators import get_type_hints
+from apache_beam.typehints import trivial_inference
 from apache_beam.typehints.decorators import TypeCheckError
 from apache_beam.typehints.decorators import WithTypeHints
+from apache_beam.typehints.decorators import get_type_hints
 from apache_beam.typehints.trivial_inference import element_type
 from apache_beam.typehints.typehints import is_consistent_with
 from apache_beam.utils import proto_utils
 from apache_beam.utils import urns
-from apache_beam.options.pipeline_options import TypeOptions
-
 
 __all__ = [
     'DoFn',

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/transforms/create_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/transforms/create_test.py b/sdks/python/apache_beam/transforms/create_test.py
index 55ad7f3..e586329 100644
--- a/sdks/python/apache_beam/transforms/create_test.py
+++ b/sdks/python/apache_beam/transforms/create_test.py
@@ -18,12 +18,12 @@
 """Unit tests for the Create and _CreateSource classes."""
 import unittest
 
-from apache_beam.io import source_test_utils
-
 from apache_beam import Create
 from apache_beam.coders import FastPrimitivesCoder
+from apache_beam.io import source_test_utils
 from apache_beam.testing.test_pipeline import TestPipeline
-from apache_beam.testing.util import assert_that, equal_to
+from apache_beam.testing.util import assert_that
+from apache_beam.testing.util import equal_to
 
 
 class CreateTest(unittest.TestCase):

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/transforms/display.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/transforms/display.py b/sdks/python/apache_beam/transforms/display.py
index 88a1fee..cb7b53e 100644
--- a/sdks/python/apache_beam/transforms/display.py
+++ b/sdks/python/apache_beam/transforms/display.py
@@ -39,10 +39,10 @@ Available classes:
 from __future__ import absolute_import
 
 import calendar
-from datetime import datetime, timedelta
 import inspect
 import json
-
+from datetime import datetime
+from datetime import timedelta
 
 __all__ = ['HasDisplayData', 'DisplayDataItem', 'DisplayData']
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/transforms/display_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/transforms/display_test.py b/sdks/python/apache_beam/transforms/display_test.py
index 15f1786..5c73cf3 100644
--- a/sdks/python/apache_beam/transforms/display_test.py
+++ b/sdks/python/apache_beam/transforms/display_test.py
@@ -19,17 +19,17 @@
 
 from __future__ import absolute_import
 
-from datetime import datetime
 import unittest
+from datetime import datetime
 
 import hamcrest as hc
 from hamcrest.core.base_matcher import BaseMatcher
 
 import apache_beam as beam
-from apache_beam.transforms.display import HasDisplayData
+from apache_beam.options.pipeline_options import PipelineOptions
 from apache_beam.transforms.display import DisplayData
 from apache_beam.transforms.display import DisplayDataItem
-from apache_beam.options.pipeline_options import PipelineOptions
+from apache_beam.transforms.display import HasDisplayData
 
 
 class DisplayDataItemMatcher(BaseMatcher):

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/transforms/ptransform.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/transforms/ptransform.py b/sdks/python/apache_beam/transforms/ptransform.py
index f6e08ca..eccaccd 100644
--- a/sdks/python/apache_beam/transforms/ptransform.py
+++ b/sdks/python/apache_beam/transforms/ptransform.py
@@ -48,18 +48,17 @@ from apache_beam import error
 from apache_beam import pvalue
 from apache_beam.internal import pickler
 from apache_beam.internal import util
-from apache_beam.transforms.display import HasDisplayData
 from apache_beam.transforms.display import DisplayDataItem
+from apache_beam.transforms.display import HasDisplayData
 from apache_beam.typehints import typehints
-from apache_beam.typehints.decorators import getcallargs_forhints
 from apache_beam.typehints.decorators import TypeCheckError
 from apache_beam.typehints.decorators import WithTypeHints
+from apache_beam.typehints.decorators import getcallargs_forhints
 from apache_beam.typehints.trivial_inference import instance_to_type
 from apache_beam.typehints.typehints import validate_composite_type_param
 from apache_beam.utils import proto_utils
 from apache_beam.utils import urns
 
-
 __all__ = [
     'PTransform',
     'ptransform_fn',

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/transforms/ptransform_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/transforms/ptransform_test.py b/sdks/python/apache_beam/transforms/ptransform_test.py
index efc5978..435270e 100644
--- a/sdks/python/apache_beam/transforms/ptransform_test.py
+++ b/sdks/python/apache_beam/transforms/ptransform_test.py
@@ -27,25 +27,26 @@ import hamcrest as hc
 from nose.plugins.attrib import attr
 
 import apache_beam as beam
+import apache_beam.pvalue as pvalue
+import apache_beam.transforms.combiners as combine
+import apache_beam.typehints as typehints
+from apache_beam.io.iobase import Read
 from apache_beam.metrics import Metrics
 from apache_beam.metrics.metric import MetricsFilter
-from apache_beam.io.iobase import Read
 from apache_beam.options.pipeline_options import TypeOptions
-import apache_beam.pvalue as pvalue
 from apache_beam.testing.test_pipeline import TestPipeline
-from apache_beam.testing.util import assert_that, equal_to
+from apache_beam.testing.util import assert_that
+from apache_beam.testing.util import equal_to
 from apache_beam.transforms import window
 from apache_beam.transforms.core import _GroupByKeyOnly
-import apache_beam.transforms.combiners as combine
-from apache_beam.transforms.display import DisplayData, DisplayDataItem
+from apache_beam.transforms.display import DisplayData
+from apache_beam.transforms.display import DisplayDataItem
 from apache_beam.transforms.ptransform import PTransform
-import apache_beam.typehints as typehints
 from apache_beam.typehints import with_input_types
 from apache_beam.typehints import with_output_types
 from apache_beam.typehints.typehints_test import TypeHintTestCase
 from apache_beam.utils.windowed_value import WindowedValue
 
-
 # Disable frequent lint warning due to pipe operator for chaining transforms.
 # pylint: disable=expression-not-assigned
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/transforms/sideinputs_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/transforms/sideinputs_test.py b/sdks/python/apache_beam/transforms/sideinputs_test.py
index 6500681..0a69c3b 100644
--- a/sdks/python/apache_beam/transforms/sideinputs_test.py
+++ b/sdks/python/apache_beam/transforms/sideinputs_test.py
@@ -24,7 +24,8 @@ from nose.plugins.attrib import attr
 
 import apache_beam as beam
 from apache_beam.testing.test_pipeline import TestPipeline
-from apache_beam.testing.util import assert_that, equal_to
+from apache_beam.testing.util import assert_that
+from apache_beam.testing.util import equal_to
 from apache_beam.transforms import window
 
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/transforms/timeutil.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/transforms/timeutil.py b/sdks/python/apache_beam/transforms/timeutil.py
index c0f9198..8d63d49 100644
--- a/sdks/python/apache_beam/transforms/timeutil.py
+++ b/sdks/python/apache_beam/transforms/timeutil.py
@@ -22,7 +22,6 @@ from __future__ import absolute_import
 from abc import ABCMeta
 from abc import abstractmethod
 
-
 __all__ = [
     'TimeDomain',
     ]

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/transforms/trigger.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/transforms/trigger.py b/sdks/python/apache_beam/transforms/trigger.py
index c1fbfc5..84d5be9 100644
--- a/sdks/python/apache_beam/transforms/trigger.py
+++ b/sdks/python/apache_beam/transforms/trigger.py
@@ -20,13 +20,14 @@
 Triggers control when in processing time windows get emitted.
 """
 
-from abc import ABCMeta
-from abc import abstractmethod
 import collections
 import copy
 import itertools
+from abc import ABCMeta
+from abc import abstractmethod
 
 from apache_beam.coders import observable
+from apache_beam.portability.api import beam_runner_api_pb2
 from apache_beam.transforms import combiners
 from apache_beam.transforms import core
 from apache_beam.transforms.timeutil import TimeDomain
@@ -34,7 +35,6 @@ from apache_beam.transforms.window import GlobalWindow
 from apache_beam.transforms.window import TimestampCombiner
 from apache_beam.transforms.window import WindowedValue
 from apache_beam.transforms.window import WindowFn
-from apache_beam.portability.api import beam_runner_api_pb2
 from apache_beam.utils.timestamp import MAX_TIMESTAMP
 from apache_beam.utils.timestamp import MIN_TIMESTAMP
 from apache_beam.utils.timestamp import TIME_GRANULARITY

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/transforms/trigger_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/transforms/trigger_test.py b/sdks/python/apache_beam/transforms/trigger_test.py
index 1ae1f02..b2fd761 100644
--- a/sdks/python/apache_beam/transforms/trigger_test.py
+++ b/sdks/python/apache_beam/transforms/trigger_test.py
@@ -27,25 +27,26 @@ import yaml
 import apache_beam as beam
 from apache_beam.runners import pipeline_context
 from apache_beam.testing.test_pipeline import TestPipeline
-from apache_beam.testing.util import assert_that, equal_to
+from apache_beam.testing.util import assert_that
+from apache_beam.testing.util import equal_to
 from apache_beam.transforms import trigger
 from apache_beam.transforms.core import Windowing
 from apache_beam.transforms.trigger import AccumulationMode
 from apache_beam.transforms.trigger import AfterAll
+from apache_beam.transforms.trigger import AfterAny
 from apache_beam.transforms.trigger import AfterCount
 from apache_beam.transforms.trigger import AfterEach
-from apache_beam.transforms.trigger import AfterAny
 from apache_beam.transforms.trigger import AfterWatermark
 from apache_beam.transforms.trigger import DefaultTrigger
 from apache_beam.transforms.trigger import GeneralTriggerDriver
 from apache_beam.transforms.trigger import InMemoryUnmergedState
 from apache_beam.transforms.trigger import Repeatedly
 from apache_beam.transforms.trigger import TriggerFn
+from apache_beam.transforms.window import MIN_TIMESTAMP
 from apache_beam.transforms.window import FixedWindows
 from apache_beam.transforms.window import IntervalWindow
-from apache_beam.transforms.window import MIN_TIMESTAMP
-from apache_beam.transforms.window import TimestampCombiner
 from apache_beam.transforms.window import Sessions
+from apache_beam.transforms.window import TimestampCombiner
 from apache_beam.transforms.window import TimestampedValue
 from apache_beam.transforms.window import WindowedValue
 from apache_beam.transforms.window import WindowFn

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/transforms/util.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/transforms/util.py b/sdks/python/apache_beam/transforms/util.py
index a7484ac..81b8c22 100644
--- a/sdks/python/apache_beam/transforms/util.py
+++ b/sdks/python/apache_beam/transforms/util.py
@@ -27,7 +27,6 @@ from apache_beam.transforms.core import Map
 from apache_beam.transforms.ptransform import PTransform
 from apache_beam.transforms.ptransform import ptransform_fn
 
-
 __all__ = [
     'CoGroupByKey',
     'Keys',

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/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 458fb74..a025019 100644
--- a/sdks/python/apache_beam/transforms/window.py
+++ b/sdks/python/apache_beam/transforms/window.py
@@ -60,13 +60,12 @@ from apache_beam.portability.api import standard_window_fns_pb2
 from apache_beam.transforms import timeutil
 from apache_beam.utils import proto_utils
 from apache_beam.utils import urns
-from apache_beam.utils.timestamp import Duration
 from apache_beam.utils.timestamp import MAX_TIMESTAMP
 from apache_beam.utils.timestamp import MIN_TIMESTAMP
+from apache_beam.utils.timestamp import Duration
 from apache_beam.utils.timestamp import Timestamp
 from apache_beam.utils.windowed_value import WindowedValue
 
-
 __all__ = [
     'TimestampCombiner',
     'WindowFn',

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/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 977a364..71c0622 100644
--- a/sdks/python/apache_beam/transforms/window_test.py
+++ b/sdks/python/apache_beam/transforms/window_test.py
@@ -21,14 +21,15 @@ import unittest
 
 from apache_beam.runners import pipeline_context
 from apache_beam.testing.test_pipeline import TestPipeline
-from apache_beam.testing.util import assert_that, equal_to
+from apache_beam.testing.util import assert_that
+from apache_beam.testing.util import equal_to
 from apache_beam.transforms import CombinePerKey
-from apache_beam.transforms import combiners
-from apache_beam.transforms import core
 from apache_beam.transforms import Create
 from apache_beam.transforms import GroupByKey
 from apache_beam.transforms import Map
 from apache_beam.transforms import WindowInto
+from apache_beam.transforms import combiners
+from apache_beam.transforms import core
 from apache_beam.transforms.core import Windowing
 from apache_beam.transforms.trigger import AccumulationMode
 from apache_beam.transforms.trigger import AfterCount
@@ -36,9 +37,9 @@ from apache_beam.transforms.window import FixedWindows
 from apache_beam.transforms.window import GlobalWindow
 from apache_beam.transforms.window import GlobalWindows
 from apache_beam.transforms.window import IntervalWindow
-from apache_beam.transforms.window import TimestampCombiner
 from apache_beam.transforms.window import Sessions
 from apache_beam.transforms.window import SlidingWindows
+from apache_beam.transforms.window import TimestampCombiner
 from apache_beam.transforms.window import TimestampedValue
 from apache_beam.transforms.window import WindowedValue
 from apache_beam.transforms.window import WindowFn

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/transforms/write_ptransform_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/transforms/write_ptransform_test.py b/sdks/python/apache_beam/transforms/write_ptransform_test.py
index 50f0deb..c2a2005 100644
--- a/sdks/python/apache_beam/transforms/write_ptransform_test.py
+++ b/sdks/python/apache_beam/transforms/write_ptransform_test.py
@@ -20,10 +20,10 @@ import logging
 import unittest
 
 import apache_beam as beam
-
 from apache_beam.io import iobase
 from apache_beam.testing.test_pipeline import TestPipeline
-from apache_beam.testing.util import assert_that, is_empty
+from apache_beam.testing.util import assert_that
+from apache_beam.testing.util import is_empty
 from apache_beam.transforms.ptransform import PTransform
 
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/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 3f5b4c9..694433a 100644
--- a/sdks/python/apache_beam/typehints/decorators.py
+++ b/sdks/python/apache_beam/typehints/decorators.py
@@ -88,12 +88,11 @@ import types
 
 from apache_beam.typehints import native_type_compatibility
 from apache_beam.typehints import typehints
-from apache_beam.typehints.typehints import check_constraint
 from apache_beam.typehints.typehints import CompositeTypeHintError
 from apache_beam.typehints.typehints import SimpleTypeHintError
+from apache_beam.typehints.typehints import check_constraint
 from apache_beam.typehints.typehints import validate_composite_type_param
 
-
 __all__ = [
     'with_input_types',
     'with_output_types',

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/typehints/native_type_compatibility.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/typehints/native_type_compatibility.py b/sdks/python/apache_beam/typehints/native_type_compatibility.py
index 26c584e..8a8e07e 100644
--- a/sdks/python/apache_beam/typehints/native_type_compatibility.py
+++ b/sdks/python/apache_beam/typehints/native_type_compatibility.py
@@ -19,6 +19,7 @@
 
 import collections
 import typing
+
 from apache_beam.typehints import typehints
 
 # Describes an entry in the type map in convert_to_beam_type.

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/typehints/native_type_compatibility_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/typehints/native_type_compatibility_test.py b/sdks/python/apache_beam/typehints/native_type_compatibility_test.py
index 0ff2b3b..4171507 100644
--- a/sdks/python/apache_beam/typehints/native_type_compatibility_test.py
+++ b/sdks/python/apache_beam/typehints/native_type_compatibility_test.py
@@ -17,12 +17,11 @@
 
 """Test for Beam type compatibility library."""
 
-import unittest
-
 import typing
+import unittest
 
-from apache_beam.typehints import typehints
 from apache_beam.typehints import native_type_compatibility
+from apache_beam.typehints import typehints
 
 _TestNamedTuple = typing.NamedTuple('_TestNamedTuple',
                                     [('age', int), ('name', bytes)])

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/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 83f444c..923b848 100644
--- a/sdks/python/apache_beam/typehints/opcodes.py
+++ b/sdks/python/apache_beam/typehints/opcodes.py
@@ -28,9 +28,17 @@ For internal use only; no backwards-compatibility guarantees.
 """
 import types
 
-from trivial_inference import union, element_type, Const, BoundMethod
 import typehints
-from typehints import Any, Dict, Iterable, List, Tuple, Union
+from trivial_inference import BoundMethod
+from trivial_inference import Const
+from trivial_inference import element_type
+from trivial_inference import union
+from typehints import Any
+from typehints import Dict
+from typehints import Iterable
+from typehints import List
+from typehints import Tuple
+from typehints import Union
 
 
 def pop_one(state, unused_arg):

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/typehints/trivial_inference_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/typehints/trivial_inference_test.py b/sdks/python/apache_beam/typehints/trivial_inference_test.py
index e7f451d..38259c8 100644
--- a/sdks/python/apache_beam/typehints/trivial_inference_test.py
+++ b/sdks/python/apache_beam/typehints/trivial_inference_test.py
@@ -18,7 +18,6 @@
 """Tests for apache_beam.typehints.trivial_inference."""
 import unittest
 
-
 from apache_beam.typehints import trivial_inference
 from apache_beam.typehints import typehints
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/typehints/typecheck.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/typehints/typecheck.py b/sdks/python/apache_beam/typehints/typecheck.py
index 89a5f5c..c47e9ba 100644
--- a/sdks/python/apache_beam/typehints/typecheck.py
+++ b/sdks/python/apache_beam/typehints/typecheck.py
@@ -28,13 +28,13 @@ import types
 from apache_beam.pvalue import TaggedOutput
 from apache_beam.transforms.core import DoFn
 from apache_beam.transforms.window import WindowedValue
-from apache_beam.typehints.decorators import _check_instance_type
-from apache_beam.typehints.decorators import getcallargs_forhints
 from apache_beam.typehints.decorators import GeneratorWrapper
 from apache_beam.typehints.decorators import TypeCheckError
-from apache_beam.typehints.typehints import check_constraint
+from apache_beam.typehints.decorators import _check_instance_type
+from apache_beam.typehints.decorators import getcallargs_forhints
 from apache_beam.typehints.typehints import CompositeTypeHintError
 from apache_beam.typehints.typehints import SimpleTypeHintError
+from apache_beam.typehints.typehints import check_constraint
 
 
 class AbstractDoFnWrapper(DoFn):

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/typehints/typed_pipeline_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/typehints/typed_pipeline_test.py b/sdks/python/apache_beam/typehints/typed_pipeline_test.py
index 59d1e1c..1df1104 100644
--- a/sdks/python/apache_beam/typehints/typed_pipeline_test.py
+++ b/sdks/python/apache_beam/typehints/typed_pipeline_test.py
@@ -17,16 +17,16 @@
 
 """Unit tests for the type-hint objects and decorators."""
 import inspect
-import unittest
-
 import typing
+import unittest
 
 import apache_beam as beam
 from apache_beam import pvalue
 from apache_beam import typehints
 from apache_beam.options.pipeline_options import OptionsContext
 from apache_beam.testing.test_pipeline import TestPipeline
-from apache_beam.testing.util import assert_that, equal_to
+from apache_beam.testing.util import assert_that
+from apache_beam.testing.util import equal_to
 from apache_beam.typehints import WithTypeHints
 
 # These test often construct a pipeline as value | PTransform to test side

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/typehints/typehints.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/typehints/typehints.py b/sdks/python/apache_beam/typehints/typehints.py
index 98d399b..c19916f 100644
--- a/sdks/python/apache_beam/typehints/typehints.py
+++ b/sdks/python/apache_beam/typehints/typehints.py
@@ -67,7 +67,6 @@ import collections
 import copy
 import types
 
-
 __all__ = [
     'Any',
     'Union',

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/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 f1b92e0..af575f4 100644
--- a/sdks/python/apache_beam/typehints/typehints_test.py
+++ b/sdks/python/apache_beam/typehints/typehints_test.py
@@ -20,7 +20,6 @@ import functools
 import inspect
 import unittest
 
-
 import apache_beam.typehints.typehints as typehints
 from apache_beam.typehints import Any
 from apache_beam.typehints import Tuple
@@ -28,12 +27,12 @@ from apache_beam.typehints import TypeCheckError
 from apache_beam.typehints import Union
 from apache_beam.typehints import with_input_types
 from apache_beam.typehints import with_output_types
+from apache_beam.typehints.decorators import GeneratorWrapper
 from apache_beam.typehints.decorators import _check_instance_type
 from apache_beam.typehints.decorators import _interleave_type_check
 from apache_beam.typehints.decorators import _positional_arg_hints
 from apache_beam.typehints.decorators import get_type_hints
 from apache_beam.typehints.decorators import getcallargs_forhints
-from apache_beam.typehints.decorators import GeneratorWrapper
 from apache_beam.typehints.typehints import is_consistent_with
 
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/utils/annotations_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/utils/annotations_test.py b/sdks/python/apache_beam/utils/annotations_test.py
index 32af8a9..ddd1b9f 100644
--- a/sdks/python/apache_beam/utils/annotations_test.py
+++ b/sdks/python/apache_beam/utils/annotations_test.py
@@ -17,6 +17,7 @@
 
 import unittest
 import warnings
+
 from apache_beam.utils.annotations import deprecated
 from apache_beam.utils.annotations import experimental
 

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/utils/counters.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/utils/counters.py b/sdks/python/apache_beam/utils/counters.py
index 08685aa..ae97434 100644
--- a/sdks/python/apache_beam/utils/counters.py
+++ b/sdks/python/apache_beam/utils/counters.py
@@ -23,12 +23,11 @@
 For internal use only; no backwards-compatibility guarantees.
 """
 
-from collections import namedtuple
 import threading
+from collections import namedtuple
 
 from apache_beam.transforms import cy_combiners
 
-
 # Information identifying the IO being measured by a counter.
 IOTargetName = namedtuple('IOTargetName', ['side_input_step_name',
                                            'side_input_index',

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/utils/processes_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/utils/processes_test.py b/sdks/python/apache_beam/utils/processes_test.py
index 920b621..2dd45f4 100644
--- a/sdks/python/apache_beam/utils/processes_test.py
+++ b/sdks/python/apache_beam/utils/processes_test.py
@@ -18,7 +18,6 @@
 
 import unittest
 
-
 import mock
 
 from apache_beam.utils import processes

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/utils/retry_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/utils/retry_test.py b/sdks/python/apache_beam/utils/retry_test.py
index 1b03c83..3b372cd 100644
--- a/sdks/python/apache_beam/utils/retry_test.py
+++ b/sdks/python/apache_beam/utils/retry_test.py
@@ -19,6 +19,8 @@
 
 import unittest
 
+from apache_beam.utils import retry
+
 # Protect against environments where apitools library is not available.
 # pylint: disable=wrong-import-order, wrong-import-position
 # TODO(sourabhbajaj): Remove the GCP specific error code to a submodule
@@ -29,7 +31,6 @@ except ImportError:
 # pylint: enable=wrong-import-order, wrong-import-position
 
 
-from apache_beam.utils import retry
 
 
 class FakeClock(object):

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/apache_beam/utils/urns.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/utils/urns.py b/sdks/python/apache_beam/utils/urns.py
index 18959be..7675d05 100644
--- a/sdks/python/apache_beam/utils/urns.py
+++ b/sdks/python/apache_beam/utils/urns.py
@@ -25,7 +25,6 @@ from google.protobuf import wrappers_pb2
 from apache_beam.internal import pickler
 from apache_beam.utils import proto_utils
 
-
 PICKLED_WINDOW_FN = "beam:windowfn:pickled_python:v0.1"
 GLOBAL_WINDOWS_FN = "beam:windowfn:global_windows:v0.1"
 FIXED_WINDOWS_FN = "beam:windowfn:fixed_windows:v0.1"

http://git-wip-us.apache.org/repos/asf/beam/blob/3151f26c/sdks/python/run_pylint.sh
----------------------------------------------------------------------
diff --git a/sdks/python/run_pylint.sh b/sdks/python/run_pylint.sh
index 2691be4..df71e44 100755
--- a/sdks/python/run_pylint.sh
+++ b/sdks/python/run_pylint.sh
@@ -62,3 +62,23 @@ echo "Running pylint for module $MODULE:"
 pylint $MODULE --ignore-patterns="$FILES_TO_IGNORE"
 echo "Running pycodestyle for module $MODULE:"
 pycodestyle $MODULE --exclude="$FILES_TO_IGNORE"
+echo "Running isort for module $MODULE:"
+# Skip files where isort is behaving weirdly
+ISORT_EXCLUDED=(
+  "apiclient.py"
+  "avroio_test.py"
+  "datastore_wordcount.py"
+  "iobase_test.py"
+  "fast_coders_test.py"
+  "slow_coders_test.py"
+)
+SKIP_PARAM=""
+for file in "${ISORT_EXCLUDED[@]}"; do
+  SKIP_PARAM="$SKIP_PARAM --skip $file"
+done
+for file in "${EXCLUDED_GENERATED_FILES[@]}"; do
+  SKIP_PARAM="$SKIP_PARAM --skip $(basename $file)"
+done
+pushd $MODULE
+isort -p apache_beam -w 120 -y -c -ot -cs -sl ${SKIP_PARAM}
+popd


Mime
View raw message