jrmccluskey commented on code in PR #40647:
URL: https://github.com/apache/beam/pull/40647#discussion_r4527569366
##########
sdks/python/apache_beam/options/pipeline_options.py:
##########
@@ -91,6 +92,26 @@ def _f(value):
return _f
+def _find_positions(args, flags):
Review Comment:
Nit: add type annotations
##########
sdks/python/apache_beam/options/pipeline_options.py:
##########
@@ -545,7 +573,12 @@ def add_new_arg(arg, **kwargs):
if not unknown_args[i].startswith('-'):
i += 1
continue
- if i + 1 >= len(unknown_args) or unknown_args[i + 1].startswith('-'):
+ has_value = (
+ '=' not in unknown_args[i] and i + 1 < len(unknown_args) and
+ not unknown_args[i + 1].startswith('-') and
+ positions[i] is not None and positions[i] + 1 < len(all_flags) and
+ not all_flags[positions[i] + 1].startswith('-'))
Review Comment:
This boolean evaluation block is somewhat unwieldy to follow, I would
suggest splitting it out into a helper + adding a docstring just for
readability purposes.
--
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]