You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by al...@apache.org on 2017/03/08 22:25:21 UTC

[6/9] beam git commit: [BEAM-1649] Fix unresolved references in Python SDK

[BEAM-1649] Fix unresolved references in Python SDK


Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/3518b12f
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/3518b12f
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/3518b12f

Branch: refs/heads/release-0.6.0
Commit: 3518b12fbfc984fcfe12e12ba06809e57744f006
Parents: 5e2afa2
Author: Tibor Kiss <ti...@gmail.com>
Authored: Wed Mar 8 12:18:39 2017 +0100
Committer: Ahmet Altay <al...@google.com>
Committed: Wed Mar 8 13:41:15 2017 -0800

----------------------------------------------------------------------
 sdks/python/apache_beam/io/range_trackers.py      | 2 +-
 sdks/python/apache_beam/transforms/trigger.py     | 2 +-
 sdks/python/apache_beam/typehints/decorators.py   | 5 ++---
 sdks/python/apache_beam/typehints/typehints.py    | 3 ++-
 sdks/python/apache_beam/utils/pipeline_options.py | 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/3518b12f/sdks/python/apache_beam/io/range_trackers.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/range_trackers.py b/sdks/python/apache_beam/io/range_trackers.py
index 059b6ca..8627f76 100644
--- a/sdks/python/apache_beam/io/range_trackers.py
+++ b/sdks/python/apache_beam/io/range_trackers.py
@@ -339,7 +339,7 @@ class OrderedPositionRangeTracker(iobase.RangeTracker):
 
   def stop_position(self):
     with self._lock:
-      return self._end_position
+      return self._stop_position
 
   def try_claim(self, position):
     with self._lock:

http://git-wip-us.apache.org/repos/asf/beam/blob/3518b12f/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 69a35ae..04198ba 100644
--- a/sdks/python/apache_beam/transforms/trigger.py
+++ b/sdks/python/apache_beam/transforms/trigger.py
@@ -63,7 +63,7 @@ class ValueStateTag(StateTag):
   """StateTag pointing to an element."""
 
   def __repr__(self):
-    return 'ValueStateTag(%s, %s)' % (self.tag, self.combine_fn)
+    return 'ValueStateTag(%s)' % (self.tag)
 
   def with_prefix(self, prefix):
     return ValueStateTag(prefix + self.tag)

http://git-wip-us.apache.org/repos/asf/beam/blob/3518b12f/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 df15f1b..9ac9168 100644
--- a/sdks/python/apache_beam/typehints/decorators.py
+++ b/sdks/python/apache_beam/typehints/decorators.py
@@ -234,9 +234,8 @@ def _unpack_positional_arg_hints(arg, hint):
   if isinstance(arg, list):
     tuple_constraint = typehints.Tuple[[typehints.Any] * len(arg)]
     if not typehints.is_consistent_with(hint, tuple_constraint):
-      raise typehints.TypeCheckError(
-          'Bad tuple arguments for %s: expected %s, got %s' % (
-              arg, tuple_constraint, hint))
+      raise TypeCheckError('Bad tuple arguments for %s: expected %s, got %s' %
+                           (arg, tuple_constraint, hint))
     if isinstance(hint, typehints.TupleConstraint):
       return tuple(_unpack_positional_arg_hints(a, t)
                    for a, t in zip(arg, hint.tuple_types))

http://git-wip-us.apache.org/repos/asf/beam/blob/3518b12f/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 d0ef60e..20f842a 100644
--- a/sdks/python/apache_beam/typehints/typehints.py
+++ b/sdks/python/apache_beam/typehints/typehints.py
@@ -994,7 +994,8 @@ class WindowedTypeConstraint(TypeConstraint):
           '%s hint type-constraint violated. The type of element in '
           'is incorrect. Expected an instance of type %s, '
           'instead received an instance of type %s.' %
-          (repr(self), _unified_repr(self.inner_type), elem.__class__.__name__))
+          (repr(self), _unified_repr(self.inner_type),
+           instance.value.__class__.__name__))
 
 
 class GeneratorHint(IteratorHint):

http://git-wip-us.apache.org/repos/asf/beam/blob/3518b12f/sdks/python/apache_beam/utils/pipeline_options.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/utils/pipeline_options.py b/sdks/python/apache_beam/utils/pipeline_options.py
index 709808f..d07c328 100644
--- a/sdks/python/apache_beam/utils/pipeline_options.py
+++ b/sdks/python/apache_beam/utils/pipeline_options.py
@@ -158,7 +158,7 @@ class PipelineOptions(HasDisplayData):
     # Special methods which may be accessed before the object is
     # fully constructed (e.g. in unpickling).
     if name[:2] == name[-2:] == '__':
-      return object.__getattr__(self, name)
+      return object.__getattribute__(self, name)
     elif name in self._visible_option_list():
       return self._all_options.get(name, getattr(self._visible_options, name))
     else: