def ExtractVariableFromMatch(re_match_obj):
"""Takes a match from VARIABLE_REFERENCE_RE and extracts the variable.
This funciton is exposed to testing.
Args:
re_match_obj: a re.MatchObject
Returns:
The variable name (with qualifier attached) or None if the match wasn't
completely valid.
"""
expected_close = '}' if re_match_obj.group(1) == '{' else ')'
if re_match_obj.group(3) == expected_close:
m = VARIABLE_NAME_RE.match(re_match_obj.group(2))
if m:
return m.group(0)
return None
评论列表
文章目录