robertwb commented on code in PR #28363:
URL: https://github.com/apache/beam/pull/28363#discussion_r1320349719
##########
sdks/python/apache_beam/yaml/readme_test.py:
##########
@@ -155,14 +161,27 @@ def __exit__(self, *args):
self.tempdir.cleanup()
+def replace_mapping_fields(spec, arg_name, arg_value):
+ if arg_name != 'language' and arg_name != 'fields':
+ spec['config']['fields'] = {
+ k: {arg: arg_value if arg == arg_name else v[arg]
+ for arg in v} if isinstance(v, dict) else v
+ for k,
Review Comment:
Yapf messes up on `k, v`. You can put in ()'s for better wrapping.
##########
sdks/python/apache_beam/yaml/readme_test.py:
##########
@@ -143,6 +143,12 @@ def input_file(self, name, content):
def input_csv(self):
return self.input_file('input.csv', 'col1,col2,col3\nabc,1,2.5\n')
+ def input_udf(self):
+ return self.input_file(
+ 'udf.py',
+ 'def my_mapping(row):\n return row.col2 > 0\n'
Review Comment:
Maybe use triple quotes for this content so it's easier to read.
##########
sdks/python/apache_beam/yaml/readme_test.py:
##########
@@ -233,9 +254,9 @@ def parse_test_methods(markdown_lines):
if 'providers:' in yaml_pipeline:
test_type = 'PARSE'
yield test_name, create_test_method(
- test_type,
- test_name,
- yaml_pipeline)
+ test_type,
Review Comment:
This was correct before. Check your editor settings?
##########
sdks/python/apache_beam/yaml/readme_test.py:
##########
@@ -155,14 +161,27 @@ def __exit__(self, *args):
self.tempdir.cleanup()
+def replace_mapping_fields(spec, arg_name, arg_value):
+ if arg_name != 'language' and arg_name != 'fields':
Review Comment:
Can this be phrased positively? I don't know what `arg_name` could be here.
Is `language/fields` ever actually passed?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]