Fixes examples

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

Branch: refs/heads/python-sdk
Commit: 2ff5630be06034e25d60e105bbe1a718ae06b4d6
Parents: 362f2e9
Author: Chamikara Jayalath <chamik...@google.com>
Authored: Fri Jul 22 16:04:29 2016 -0700
Committer: Robert Bradshaw <rober...@gmail.com>
Committed: Sat Jul 23 16:43:46 2016 -0700

----------------------------------------------------------------------
 sdks/python/apache_beam/examples/complete/autocomplete.py | 4 ++--
 sdks/python/apache_beam/examples/complete/estimate_pi.py  | 3 ---
 sdks/python/apache_beam/examples/snippets/snippets.py     | 8 ++++----
 3 files changed, 6 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/2ff5630b/sdks/python/apache_beam/examples/complete/autocomplete.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/complete/autocomplete.py 
b/sdks/python/apache_beam/examples/complete/autocomplete.py
index b68bc56..10d9009 100644
--- a/sdks/python/apache_beam/examples/complete/autocomplete.py
+++ b/sdks/python/apache_beam/examples/complete/autocomplete.py
@@ -56,8 +56,8 @@ def run(argv=None):
 
 class TopPerPrefix(beam.PTransform):
 
-  def __init__(self, label, count):
-    super(TopPerPrefix, self).__init__(label)
+  def __init__(self, count):
+    super(TopPerPrefix, self).__init__()
     self._count = count
 
   def apply(self, words):

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/2ff5630b/sdks/python/apache_beam/examples/complete/estimate_pi.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/complete/estimate_pi.py 
b/sdks/python/apache_beam/examples/complete/estimate_pi.py
index ef9f8cc..c33db1d 100644
--- a/sdks/python/apache_beam/examples/complete/estimate_pi.py
+++ b/sdks/python/apache_beam/examples/complete/estimate_pi.py
@@ -90,9 +90,6 @@ class JsonCoder(object):
 class EstimatePiTransform(beam.PTransform):
   """Runs 10M trials, and combine the results to estimate pi."""
 
-  def __init__(self, label):
-    super(EstimatePiTransform, self).__init__(label)
-
   def apply(self, pcoll):
     # A hundred work items of a hundred thousand tries each.
     return (pcoll

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/2ff5630b/sdks/python/apache_beam/examples/snippets/snippets.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/snippets/snippets.py 
b/sdks/python/apache_beam/examples/snippets/snippets.py
index c605db8..9d1df82 100644
--- a/sdks/python/apache_beam/examples/snippets/snippets.py
+++ b/sdks/python/apache_beam/examples/snippets/snippets.py
@@ -466,7 +466,7 @@ def examples_wordcount_minimal(renames):
       # [END examples_wordcount_minimal_map]
 
       # [START examples_wordcount_minimal_write]
-      | 'gs://my-bucket/counts.txt' >> beam.io.Write(beam.io.TextFileSink())
+      | beam.io.Write(beam.io.TextFileSink('gs://my-bucket/counts.txt'))
       # [END examples_wordcount_minimal_write]
   )
 
@@ -531,7 +531,7 @@ def examples_wordcount_wordcount(renames):
   formatted = counts | beam.ParDo(FormatAsTextFn())
   # [END examples_wordcount_wordcount_dofn]
 
-  formatted | 'gs://my-bucket/counts.txt' >> 
beam.io.Write(beam.io.TextFileSink())
+  formatted |  beam.io.Write(beam.io.TextFileSink('gs://my-bucket/counts.txt'))
   p.visit(SnippetUtils.RenameFiles(renames))
   p.run()
 
@@ -702,8 +702,8 @@ def model_custom_source(count):
   # [START model_custom_source_new_ptransform]
   class ReadFromCountingSource(PTransform):
 
-    def __init__(self, label, count, **kwargs):
-      super(ReadFromCountingSource, self).__init__(label, **kwargs)
+    def __init__(self, count, **kwargs):
+      super(ReadFromCountingSource, self).__init__(**kwargs)
       self._count = count
 
     def apply(self, pcoll):

Reply via email to