Thanatos9404 commented on code in PR #40647:
URL: https://github.com/apache/beam/pull/40647#discussion_r4527798073


##########
sdks/python/apache_beam/options/pipeline_options.py:
##########
@@ -91,6 +92,26 @@ def _f(value):
   return _f
 
 
+def _find_positions(args, flags):

Review Comment:
   Added in 5d8aaa8e58.



##########
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:
   Done in 5d8aaa8e58. The check now lives in `_has_separate_value`, with a 
docstring that explains why the value has to directly follow the flag in the 
original flags. Behavior is unchanged and the existing unknown option tests 
still pass.



-- 
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]

Reply via email to