[ 
https://issues.apache.org/jira/browse/BEAM-4002?focusedWorklogId=104833&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-104833
 ]

ASF GitHub Bot logged work on BEAM-4002:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 22/May/18 22:06
            Start Date: 22/May/18 22:06
    Worklog Time Spent: 10m 
      Work Description: aaltay closed pull request #5339: [BEAM-4002] Futurize 
options subpackage
URL: https://github.com/apache/beam/pull/5339
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/sdks/python/apache_beam/options/__init__.py 
b/sdks/python/apache_beam/options/__init__.py
index cce3acad34a..f4f43cbb123 100644
--- a/sdks/python/apache_beam/options/__init__.py
+++ b/sdks/python/apache_beam/options/__init__.py
@@ -14,3 +14,4 @@
 # 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 b5f9d77617d..0c96325d70c 100644
--- a/sdks/python/apache_beam/options/pipeline_options.py
+++ b/sdks/python/apache_beam/options/pipeline_options.py
@@ -17,7 +17,10 @@
 
 """Pipeline options obtained from command line parsing."""
 
+from __future__ import absolute_import
+
 import argparse
+from builtins import object
 
 from apache_beam.options.value_provider import RuntimeValueProvider
 from apache_beam.options.value_provider import StaticValueProvider
@@ -175,7 +178,7 @@ def from_dictionary(cls, options):
       A PipelineOptions object representing the given arguments.
     """
     flags = []
-    for k, v in options.iteritems():
+    for k, v in options.items():
       if isinstance(v, bool):
         if v:
           flags.append('--%s' % k)
@@ -233,7 +236,7 @@ def _visible_option_list(self):
                   for option in dir(self._visible_options) if option[0] != '_')
 
   def __dir__(self):
-    return sorted(dir(type(self)) + self.__dict__.keys() +
+    return sorted(dir(type(self)) + list(self.__dict__.keys()) +
                   self._visible_option_list())
 
   def __getattr__(self, name):
diff --git a/sdks/python/apache_beam/options/pipeline_options_test.py 
b/sdks/python/apache_beam/options/pipeline_options_test.py
index 66c69bdfc70..289e67f15fe 100644
--- a/sdks/python/apache_beam/options/pipeline_options_test.py
+++ b/sdks/python/apache_beam/options/pipeline_options_test.py
@@ -17,6 +17,8 @@
 
 """Unit tests for the pipeline options module."""
 
+from __future__ import absolute_import
+
 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 24d2e55eadb..874e739fb61 100644
--- a/sdks/python/apache_beam/options/pipeline_options_validator.py
+++ b/sdks/python/apache_beam/options/pipeline_options_validator.py
@@ -19,7 +19,10 @@
 
 For internal use only; no backwards-compatibility guarantees.
 """
+from __future__ import absolute_import
+
 import re
+from builtins import object
 
 from apache_beam.internal import pickler
 from apache_beam.options.pipeline_options import DebugOptions
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 8ff66c78f17..c0582e2f7d1 100644
--- a/sdks/python/apache_beam/options/pipeline_options_validator_test.py
+++ b/sdks/python/apache_beam/options/pipeline_options_validator_test.py
@@ -17,8 +17,11 @@
 
 """Unit tests for the pipeline options validator module."""
 
+from __future__ import absolute_import
+
 import logging
 import unittest
+from builtins import object
 
 from hamcrest.core.base_matcher import BaseMatcher
 
diff --git a/sdks/python/apache_beam/options/value_provider.py 
b/sdks/python/apache_beam/options/value_provider.py
index 4aaa0f74474..0ef83e344c9 100644
--- a/sdks/python/apache_beam/options/value_provider.py
+++ b/sdks/python/apache_beam/options/value_provider.py
@@ -19,6 +19,9 @@
 and dynamically provided values.
 """
 
+from __future__ import absolute_import
+
+from builtins import object
 from functools import wraps
 
 from apache_beam import error
@@ -66,6 +69,9 @@ def __eq__(self, other):
         return True
     return False
 
+  def __hash__(self):
+    return hash((type(self), self.value_type, self.value))
+
 
 class RuntimeValueProvider(ValueProvider):
   runtime_options = None
diff --git a/sdks/python/apache_beam/options/value_provider_test.py 
b/sdks/python/apache_beam/options/value_provider_test.py
index 482ea47504a..bc027148234 100644
--- a/sdks/python/apache_beam/options/value_provider_test.py
+++ b/sdks/python/apache_beam/options/value_provider_test.py
@@ -16,6 +16,9 @@
 #
 
 """Unit tests for the ValueProvider class."""
+
+from __future__ import absolute_import
+
 import logging
 import unittest
 
diff --git a/sdks/python/tox.ini b/sdks/python/tox.ini
index 61dc12c3017..2f0ee9ab002 100644
--- a/sdks/python/tox.ini
+++ b/sdks/python/tox.ini
@@ -100,6 +100,7 @@ deps =
 modules =
   apache_beam/coders
   apache_beam/metrics
+  apache_beam/options
 commands =
   python --version
   pip --version


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 104833)
    Time Spent: 0.5h  (was: 20m)

> Futurize and fix python 2 compatibility for options subpackage
> --------------------------------------------------------------
>
>                 Key: BEAM-4002
>                 URL: https://issues.apache.org/jira/browse/BEAM-4002
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-py-core
>            Reporter: Robbe
>            Assignee: Matthias Feys
>            Priority: Major
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to