Reinstate ordering of arguments in bin/storm.py - #8971
Conversation
bin/storm.py
|
Hi @sercuzz8, Thanks for tackling this, the diagnosis is right, and reconstructing the order from
if len(merged) != len(known_args) + len(unknown_args):
raise ValueError("could not reconstruct argument order from sys.argv")or fall back to the old concatenation, if you'd rather not add a new failure path to a released CLI.
from collections import Counter
remaining = Counter(known_args) + Counter(unknown_args)
merged = []
for token in sys_args:
if remaining[token]:
remaining[token] -= 1
merged.append(token)Nits: the |
ecd2389 to
aa3fc73
Compare
|
Hello @GGraziadei,
Also, I have renamed the method as I have seen that all the other ones in the file use only present simple and not present continuous |
GGraziadei
left a comment
There was a problem hiding this comment.
Hi @sercuzz8, thanks for addressing these points. Good first-time contribution!
LGTM
Summary
argparse's
parse_known_args()splitsmain_args(nargs='*') from unrecognized flags(
unknown_args), losing their relative order when they are interleaved on the command line.This breaks down the flow of
mvn clean install, thus the order must be reinstated.Following this discussion