tvalentyn commented on a change in pull request #14738:
URL: https://github.com/apache/beam/pull/14738#discussion_r637295929



##########
File path: sdks/python/apache_beam/examples/snippets/snippets.py
##########
@@ -1499,17 +1510,17 @@ def cross_join(left, rights):
       yield (left, x)
 
   # Create pipeline.
-  pipeline_options = PipelineOptions()
-  p = beam.Pipeline(options=pipeline_options)
+  beam_options = PipelineOptions()

Review comment:
       Same here

##########
File path: sdks/python/apache_beam/examples/snippets/snippets.py
##########
@@ -110,80 +115,68 @@ def filter_words(unused_x):
   import apache_beam as beam
   from apache_beam.options.pipeline_options import PipelineOptions
 
-  with beam.Pipeline(options=PipelineOptions()) as p:
+  beam_options = PipelineOptions()
+  with beam.Pipeline(options=beam_options) as pipeline:

Review comment:
       I think it's the same as:
   ```
     with beam.Pipeline() as pipeline:
   ```

##########
File path: sdks/python/apache_beam/examples/snippets/snippets.py
##########
@@ -834,17 +842,17 @@ def model_custom_source(count):
 
   # Using the source in an example pipeline.
   # [START model_custom_source_use_new_source]
-  with beam.Pipeline(options=PipelineOptions()) as p:
-    numbers = p | 'ProduceNumbers' >> beam.io.Read(CountingSource(count))
+  with beam.Pipeline(options=PipelineOptions()) as pipeline:

Review comment:
       similarly here, I think we can omit passing options.

##########
File path: sdks/python/apache_beam/examples/snippets/snippets.py
##########
@@ -97,10 +100,12 @@ def construct_pipeline(renames):
   # Unresolved reference in ReverseWords class
   import apache_beam as beam
 
-  class ReverseWords(beam.PTransform):
+  @beam.ptransform_fn
+  @beam.typehints.with_input_types(str)
+  @beam.typehints.with_output_types(str)
+  def ReverseWords(pcoll):

Review comment:
       nit: consider: `lambda word: word[::-1]` as more readable.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to