Closed island255 closed 4 years ago
The assertion is correct. It checks for different regular expressions, and if there is no match continues to the next one. If the last check fails, then check
is None and the assertion should fail. In any other case, the check is successful and execution should continue.
Why do you think it should be the opposite?
I think that if it goes to the branch if arg_list_ is None:
, that check must be None (as it found no "( )"). And assert will meet False and assertion will fail.
But in this case, assertion in this brach will always fail. Does it mean that this brach should just not be executed?
Or it is the debug code left after testing the function _find_outer_most_lastparenthesis. If it is that case, I understand it and the comments there. When I first see it, I just got confused and didn't realize the meaning of this code.
Yes, the assertion and regexp in the branch is a sanity check meant to make sure that find_outer_most_last_parenthesis
didn't miss an empty argument list somewhere.
Thanks for your reply! Thanks for your outstanding work! I really learn a lot from it.
Happy to help :)
When I reading code in inst2vec_preprocess.py, I find in line 865 that _assert check is not None, "Could not match argument list in:\n" + line + "\nFunction:\n" + funcname may have to change to assert check is None. But I'm confused and don't know whether I should change it.