[BEAM-7372] cleanup py2 codepath from apache_beam/ml, options and portability (#14753)

[BEAM-7372] cleanup py2 codepath from apache_beam/ml, options and portability
diff --git a/sdks/python/apache_beam/ml/gcp/cloud_dlp.py b/sdks/python/apache_beam/ml/gcp/cloud_dlp.py
index 3c4406c..93510c8 100644
--- a/sdks/python/apache_beam/ml/gcp/cloud_dlp.py
+++ b/sdks/python/apache_beam/ml/gcp/cloud_dlp.py
@@ -19,8 +19,6 @@
 functionality.
 """
 
-from __future__ import absolute_import
-
 import logging
 
 from google.cloud import dlp_v2
diff --git a/sdks/python/apache_beam/ml/gcp/cloud_dlp_it_test.py b/sdks/python/apache_beam/ml/gcp/cloud_dlp_it_test.py
index fbba610..4ada679 100644
--- a/sdks/python/apache_beam/ml/gcp/cloud_dlp_it_test.py
+++ b/sdks/python/apache_beam/ml/gcp/cloud_dlp_it_test.py
@@ -17,8 +17,6 @@
 
 """Integration tests for Google Cloud Video Intelligence API transforms."""
 
-from __future__ import absolute_import
-
 import logging
 import unittest
 
diff --git a/sdks/python/apache_beam/ml/gcp/cloud_dlp_test.py b/sdks/python/apache_beam/ml/gcp/cloud_dlp_test.py
index ef25555..111e5be 100644
--- a/sdks/python/apache_beam/ml/gcp/cloud_dlp_test.py
+++ b/sdks/python/apache_beam/ml/gcp/cloud_dlp_test.py
@@ -17,8 +17,6 @@
 
 """Unit tests for Google Cloud Video Intelligence API transforms."""
 
-from __future__ import absolute_import
-
 import logging
 import unittest
 
diff --git a/sdks/python/apache_beam/ml/gcp/naturallanguageml.py b/sdks/python/apache_beam/ml/gcp/naturallanguageml.py
index 5263a60..7817eb9 100644
--- a/sdks/python/apache_beam/ml/gcp/naturallanguageml.py
+++ b/sdks/python/apache_beam/ml/gcp/naturallanguageml.py
@@ -15,8 +15,6 @@
 # limitations under the License.
 #
 
-from __future__ import absolute_import
-
 from typing import Mapping
 from typing import Optional
 from typing import Sequence
diff --git a/sdks/python/apache_beam/ml/gcp/naturallanguageml_test.py b/sdks/python/apache_beam/ml/gcp/naturallanguageml_test.py
index ef72359..e639517 100644
--- a/sdks/python/apache_beam/ml/gcp/naturallanguageml_test.py
+++ b/sdks/python/apache_beam/ml/gcp/naturallanguageml_test.py
@@ -18,8 +18,6 @@
 
 """Unit tests for Google Cloud Natural Language API transform."""
 
-from __future__ import absolute_import
-
 import unittest
 
 import mock
diff --git a/sdks/python/apache_beam/ml/gcp/naturallanguageml_test_it.py b/sdks/python/apache_beam/ml/gcp/naturallanguageml_test_it.py
index 4cf58e4..932bc685 100644
--- a/sdks/python/apache_beam/ml/gcp/naturallanguageml_test_it.py
+++ b/sdks/python/apache_beam/ml/gcp/naturallanguageml_test_it.py
@@ -16,8 +16,6 @@
 #
 # pytype: skip-file
 
-from __future__ import absolute_import
-
 import unittest
 
 from nose.plugins.attrib import attr
diff --git a/sdks/python/apache_beam/ml/gcp/videointelligenceml.py b/sdks/python/apache_beam/ml/gcp/videointelligenceml.py
index 67ff496..bc0aa08 100644
--- a/sdks/python/apache_beam/ml/gcp/videointelligenceml.py
+++ b/sdks/python/apache_beam/ml/gcp/videointelligenceml.py
@@ -17,15 +17,10 @@
 
 """A connector for sending API requests to the GCP Video Intelligence API."""
 
-from __future__ import absolute_import
-
 from typing import Optional
 from typing import Tuple
 from typing import Union
 
-from future.utils import binary_type
-from future.utils import text_type
-
 from apache_beam import typehints
 from apache_beam.metrics import Metrics
 from apache_beam.transforms import DoFn
@@ -55,8 +50,8 @@
   ref: https://cloud.google.com/video-intelligence/docs
 
   Sends each element to the GCP Video Intelligence API. Element is a
-  Union[text_type, binary_type] of either an URI (e.g. a GCS URI) or
-  binary_type base64-encoded video data.
+  Union[str, bytes] of either an URI (e.g. a GCS URI) or
+  bytes base64-encoded video data.
   Accepts an `AsDict` side input that maps each video to a video context.
   """
   def __init__(
@@ -118,8 +113,7 @@
 
 
 @typehints.with_input_types(
-    Union[text_type, binary_type],
-    Optional[videointelligence.types.VideoContext])
+    Union[str, bytes], Optional[videointelligence.types.VideoContext])
 class _VideoAnnotateFn(DoFn):
   """A DoFn that sends each input element to the GCP Video Intelligence API
   service and outputs an element with the return result of the API
@@ -138,7 +132,7 @@
     self._client = get_videointelligence_client()
 
   def _annotate_video(self, element, video_context):
-    if isinstance(element, text_type):  # Is element an URI to a GCS bucket
+    if isinstance(element, str):  # Is element an URI to a GCS bucket
       response = self._client.annotate_video(
           input_uri=element,
           features=self.features,
@@ -171,11 +165,11 @@
   Sends each element to the GCP Video Intelligence API.
   Element is a tuple of
 
-    (Union[text_type, binary_type],
+    (Union[str, bytes],
     Optional[videointelligence.types.VideoContext])
 
   where the former is either an URI (e.g. a GCS URI) or
-  binary_type base64-encoded video data
+  bytes base64-encoded video data
   """
   def __init__(self, features, location_id=None, metadata=None, timeout=120):
     """
@@ -208,8 +202,7 @@
 
 
 @typehints.with_input_types(
-    Tuple[Union[text_type, binary_type],
-          Optional[videointelligence.types.VideoContext]])
+    Tuple[Union[str, bytes], Optional[videointelligence.types.VideoContext]])
 class _VideoAnnotateFnWithContext(_VideoAnnotateFn):
   """A DoFn that unpacks each input tuple to element, video_context variables
   and sends these to the GCP Video Intelligence API service and outputs
diff --git a/sdks/python/apache_beam/ml/gcp/videointelligenceml_test.py b/sdks/python/apache_beam/ml/gcp/videointelligenceml_test.py
index b0bb441..3215ceb 100644
--- a/sdks/python/apache_beam/ml/gcp/videointelligenceml_test.py
+++ b/sdks/python/apache_beam/ml/gcp/videointelligenceml_test.py
@@ -19,9 +19,6 @@
 
 # pytype: skip-file
 
-from __future__ import absolute_import
-from __future__ import unicode_literals
-
 import logging
 import unittest
 
diff --git a/sdks/python/apache_beam/ml/gcp/videointelligenceml_test_it.py b/sdks/python/apache_beam/ml/gcp/videointelligenceml_test_it.py
index a2d8216..d934520 100644
--- a/sdks/python/apache_beam/ml/gcp/videointelligenceml_test_it.py
+++ b/sdks/python/apache_beam/ml/gcp/videointelligenceml_test_it.py
@@ -19,9 +19,6 @@
 """An integration test that labels entities appearing in a video and checks
 if some expected entities were properly recognized."""
 
-from __future__ import absolute_import
-from __future__ import unicode_literals
-
 import unittest
 
 import hamcrest as hc
diff --git a/sdks/python/apache_beam/ml/gcp/visionml.py b/sdks/python/apache_beam/ml/gcp/visionml.py
index 13884a7..0fb45ce 100644
--- a/sdks/python/apache_beam/ml/gcp/visionml.py
+++ b/sdks/python/apache_beam/ml/gcp/visionml.py
@@ -20,16 +20,11 @@
 A connector for sending API requests to the GCP Vision API.
 """
 
-from __future__ import absolute_import
-
 from typing import List
 from typing import Optional
 from typing import Tuple
 from typing import Union
 
-from future.utils import binary_type
-from future.utils import text_type
-
 from apache_beam import typehints
 from apache_beam.metrics import Metrics
 from apache_beam.transforms import DoFn
@@ -65,8 +60,8 @@
 
   Batches elements together using ``util.BatchElements`` PTransform and sends
   each batch of elements to the GCP Vision API.
-  Element is a Union[text_type, binary_type] of either an URI (e.g. a GCS URI)
-  or binary_type base64-encoded image data.
+  Element is a Union[str, bytes] of either an URI (e.g. a GCS URI)
+  or bytes base64-encoded image data.
   Accepts an `AsDict` side input that maps each image to an image context.
   """
 
@@ -158,7 +153,7 @@
                 metadata=self.metadata)))
 
   @typehints.with_input_types(
-      Union[text_type, binary_type], Optional[vision.types.ImageContext])
+      Union[str, bytes], Optional[vision.types.ImageContext])
   @typehints.with_output_types(List[vision.types.AnnotateImageRequest])
   def _create_image_annotation_pairs(self, element, context_side_input):
     if context_side_input:  # If we have a side input image context, use that
@@ -166,10 +161,10 @@
     else:
       image_context = None
 
-    if isinstance(element, text_type):
+    if isinstance(element, str):
       image = vision.types.Image(
           source=vision.types.ImageSource(image_uri=element))
-    else:  # Typehint checks only allows text_type or binary_type
+    else:  # Typehint checks only allows str or bytes
       image = vision.types.Image(content=element)
 
     request = vision.types.AnnotateImageRequest(
@@ -185,10 +180,10 @@
 
   Element is a tuple of::
 
-    (Union[text_type, binary_type],
+    (Union[str, bytes],
     Optional[``vision.types.ImageContext``])
 
-  where the former is either an URI (e.g. a GCS URI) or binary_type
+  where the former is either an URI (e.g. a GCS URI) or bytes
   base64-encoded image data.
   """
   def __init__(
@@ -249,14 +244,14 @@
                 metadata=self.metadata)))
 
   @typehints.with_input_types(
-      Tuple[Union[text_type, binary_type], Optional[vision.types.ImageContext]])
+      Tuple[Union[str, bytes], Optional[vision.types.ImageContext]])
   @typehints.with_output_types(List[vision.types.AnnotateImageRequest])
   def _create_image_annotation_pairs(self, element, **kwargs):
     element, image_context = element  # Unpack (image, image_context) tuple
-    if isinstance(element, text_type):
+    if isinstance(element, str):
       image = vision.types.Image(
           source=vision.types.ImageSource(image_uri=element))
-    else:  # Typehint checks only allows text_type or binary_type
+    else:  # Typehint checks only allows str or bytes
       image = vision.types.Image(content=element)
 
     request = vision.types.AnnotateImageRequest(
diff --git a/sdks/python/apache_beam/ml/gcp/visionml_test.py b/sdks/python/apache_beam/ml/gcp/visionml_test.py
index d4c6c20..f038442 100644
--- a/sdks/python/apache_beam/ml/gcp/visionml_test.py
+++ b/sdks/python/apache_beam/ml/gcp/visionml_test.py
@@ -20,9 +20,6 @@
 
 # pytype: skip-file
 
-from __future__ import absolute_import
-from __future__ import unicode_literals
-
 import logging
 import unittest
 
diff --git a/sdks/python/apache_beam/ml/gcp/visionml_test_it.py b/sdks/python/apache_beam/ml/gcp/visionml_test_it.py
index a81acd0..14af3cb8 100644
--- a/sdks/python/apache_beam/ml/gcp/visionml_test_it.py
+++ b/sdks/python/apache_beam/ml/gcp/visionml_test_it.py
@@ -16,8 +16,6 @@
 #
 # pytype: skip-file
 
-from __future__ import absolute_import
-
 import unittest
 
 from nose.plugins.attrib import attr
diff --git a/sdks/python/apache_beam/options/__init__.py b/sdks/python/apache_beam/options/__init__.py
index f4f43cb..cce3aca 100644
--- a/sdks/python/apache_beam/options/__init__.py
+++ b/sdks/python/apache_beam/options/__init__.py
@@ -14,4 +14,3 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-from __future__ import absolute_import
diff --git a/sdks/python/apache_beam/options/pipeline_options.py b/sdks/python/apache_beam/options/pipeline_options.py
index 449c7d3..073014c 100644
--- a/sdks/python/apache_beam/options/pipeline_options.py
+++ b/sdks/python/apache_beam/options/pipeline_options.py
@@ -19,13 +19,9 @@
 
 # pytype: skip-file
 
-from __future__ import absolute_import
-
 import argparse
 import json
 import logging
-from builtins import list
-from builtins import object
 from typing import Any
 from typing import Callable
 from typing import Dict
diff --git a/sdks/python/apache_beam/options/pipeline_options_test.py b/sdks/python/apache_beam/options/pipeline_options_test.py
index 08c4145..8299a54 100644
--- a/sdks/python/apache_beam/options/pipeline_options_test.py
+++ b/sdks/python/apache_beam/options/pipeline_options_test.py
@@ -19,8 +19,6 @@
 
 # pytype: skip-file
 
-from __future__ import absolute_import
-
 import json
 import logging
 import unittest
diff --git a/sdks/python/apache_beam/options/pipeline_options_validator.py b/sdks/python/apache_beam/options/pipeline_options_validator.py
index 97df45f..2196ca6 100644
--- a/sdks/python/apache_beam/options/pipeline_options_validator.py
+++ b/sdks/python/apache_beam/options/pipeline_options_validator.py
@@ -21,13 +21,8 @@
 """
 # pytype: skip-file
 
-from __future__ import absolute_import
-
 import logging
 import re
-from builtins import object
-
-from past.builtins import unicode
 
 from apache_beam.internal import pickler
 from apache_beam.options.pipeline_options import DebugOptions
@@ -220,8 +215,7 @@
             'Transform name mapping option is only useful when '
             '--update and --streaming is specified')
       for _, (key, value) in enumerate(view.transform_name_mapping.items()):
-        if not isinstance(key, (str, unicode)) \
-            or not isinstance(value, (str, unicode)):
+        if not isinstance(key, str) or not isinstance(value, str):
           errors.extend(
               self._validate_error(
                   self.ERR_INVALID_TRANSFORM_NAME_MAPPING, key, value))
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 0eea8d7..54b3a69 100644
--- a/sdks/python/apache_beam/options/pipeline_options_validator_test.py
+++ b/sdks/python/apache_beam/options/pipeline_options_validator_test.py
@@ -19,11 +19,8 @@
 
 # pytype: skip-file
 
-from __future__ import absolute_import
-
 import logging
 import unittest
-from builtins import object
 
 from hamcrest import assert_that
 from hamcrest import contains_string
diff --git a/sdks/python/apache_beam/options/value_provider.py b/sdks/python/apache_beam/options/value_provider.py
index a300df4..5a5d363 100644
--- a/sdks/python/apache_beam/options/value_provider.py
+++ b/sdks/python/apache_beam/options/value_provider.py
@@ -24,9 +24,6 @@
 
 # pytype: skip-file
 
-from __future__ import absolute_import
-
-from builtins import object
 from functools import wraps
 from typing import Set
 
diff --git a/sdks/python/apache_beam/options/value_provider_test.py b/sdks/python/apache_beam/options/value_provider_test.py
index 189501b..21e05b3 100644
--- a/sdks/python/apache_beam/options/value_provider_test.py
+++ b/sdks/python/apache_beam/options/value_provider_test.py
@@ -19,8 +19,6 @@
 
 # pytype: skip-file
 
-from __future__ import absolute_import
-
 import logging
 import unittest
 
diff --git a/sdks/python/apache_beam/portability/__init__.py b/sdks/python/apache_beam/portability/__init__.py
index 9fbf215..0bce5d6 100644
--- a/sdks/python/apache_beam/portability/__init__.py
+++ b/sdks/python/apache_beam/portability/__init__.py
@@ -16,4 +16,3 @@
 #
 
 """For internal use only; no backwards-compatibility guarantees."""
-from __future__ import absolute_import
diff --git a/sdks/python/apache_beam/portability/common_urns.py b/sdks/python/apache_beam/portability/common_urns.py
index 18cc249..4b8838f 100644
--- a/sdks/python/apache_beam/portability/common_urns.py
+++ b/sdks/python/apache_beam/portability/common_urns.py
@@ -19,8 +19,6 @@
 
 # pytype: skip-file
 
-from __future__ import absolute_import
-
 from apache_beam.portability.api.beam_runner_api_pb2_urns import BeamConstants
 from apache_beam.portability.api.beam_runner_api_pb2_urns import StandardArtifacts
 from apache_beam.portability.api.beam_runner_api_pb2_urns import StandardCoders
diff --git a/sdks/python/apache_beam/portability/utils.py b/sdks/python/apache_beam/portability/utils.py
index 176c6db..4d23ff1 100644
--- a/sdks/python/apache_beam/portability/utils.py
+++ b/sdks/python/apache_beam/portability/utils.py
@@ -16,8 +16,6 @@
 #
 
 """For internal use only; no backwards-compatibility guarantees."""
-from __future__ import absolute_import
-
 from typing import TYPE_CHECKING
 from typing import NamedTuple