You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ro...@apache.org on 2016/07/20 20:06:50 UTC

[4/5] incubator-beam git commit: Clarifying comments.

Clarifying comments.


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

Branch: refs/heads/python-sdk
Commit: 9d1fc85d5352f16ce8f0f092865decc6b296dbb8
Parents: 2768981
Author: Robert Bradshaw <ro...@google.com>
Authored: Wed Jul 20 12:24:18 2016 -0700
Committer: Robert Bradshaw <ro...@google.com>
Committed: Wed Jul 20 13:06:21 2016 -0700

----------------------------------------------------------------------
 sdks/python/apache_beam/runners/common.py       |  1 +
 sdks/python/apache_beam/utils/windowed_value.py | 12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/9d1fc85d/sdks/python/apache_beam/runners/common.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/common.py b/sdks/python/apache_beam/runners/common.py
index 059359c..ef28c63 100644
--- a/sdks/python/apache_beam/runners/common.py
+++ b/sdks/python/apache_beam/runners/common.py
@@ -190,6 +190,7 @@ class DoFnState(object):
         self.step_name, aggregator)
 
 
+# TODO(robertwb): Replace core.DoFnContext with this.
 class DoFnContext(object):
 
   def __init__(self, label, element=None, state=None):

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/9d1fc85d/sdks/python/apache_beam/utils/windowed_value.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/utils/windowed_value.py b/sdks/python/apache_beam/utils/windowed_value.py
index 5172b36..4c50e72 100644
--- a/sdks/python/apache_beam/utils/windowed_value.py
+++ b/sdks/python/apache_beam/utils/windowed_value.py
@@ -72,11 +72,16 @@ class WindowedValue(object):
   # We'd rather implement __eq__, but Cython supports that via __richcmp__
   # instead.  Fortunately __cmp__ is understood by both (but not by Python 3).
   def __cmp__(left, right):  # pylint: disable=no-self-argument
+    """Compares left and right for equality.
+
+    For performance reasons, doesn't actually impose an ordering
+    on unequal values (always returning 1).
+    """
     if type(left) is not type(right):
       return cmp(type(left), type(right))
     else:
-      # Don't bother paying the cost of a total ordering.
       # TODO(robertwb): Avoid the type checks?
+      # Returns False (0) if equal, and True (1) if not.
       return not WindowedValue._typed_eq(left, right)
 
   @staticmethod
@@ -111,4 +116,7 @@ def create(value, timestamp_micros, windows):
 try:
   WindowedValue.timestamp_object = None
 except TypeError:
-  pass  # Cythonized class already has this default value.
+  # When we're compiled, we can't dynamically add attributes to
+  # the cdef class, but in this case it's OK as it's already present
+  # on each instance.
+  pass