Skip to content

Commit

Permalink
Merge pull request apache#2 from chamikaramj/labels
Browse files Browse the repository at this point in the history
Fixes examples
  • Loading branch information
robertwb authored Jul 22, 2016
2 parents df3511d + 43aafcb commit cc5feaa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions sdks/python/apache_beam/examples/complete/autocomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,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):
Expand Down
3 changes: 0 additions & 3 deletions sdks/python/apache_beam/examples/complete/estimate_pi.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ def encode(self, x):
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
Expand Down
8 changes: 4 additions & 4 deletions sdks/python/apache_beam/examples/snippets/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
)

Expand Down Expand Up @@ -531,7 +531,7 @@ def process(self, context):
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()

Expand Down Expand Up @@ -702,8 +702,8 @@ class _CountingSource(CountingSource):
# [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):
Expand Down

0 comments on commit cc5feaa

Please sign in to comment.