MCPcopy Create free account
hub / github.com/apache/impala / parse_variables

Function parse_variables

shell/impala_shell/impala_shell.py:2068–2082  ·  view source on GitHub ↗

Parse variable assignments passed as arguments in the command line

(keyvals)

Source from the content-addressed store, hash-verified

2066
2067
2068def parse_variables(keyvals):
2069 """Parse variable assignments passed as arguments in the command line"""
2070 kv_pattern = r'(%s)=(.*)$' % (ImpalaShell.VALID_VAR_NAME_PATTERN,)
2071 vars = {}
2072 if keyvals:
2073 for keyval in keyvals:
2074 match = re.match(kv_pattern, keyval)
2075 if not match:
2076 print('Error: Could not parse key-value "%s". ' % (keyval,)
2077 + 'It must follow the pattern "KEY=VALUE".', file=sys.stderr)
2078 parser.print_help()
2079 raise FatalShellException()
2080 else:
2081 vars[match.groups()[0].upper()] = replace_variables(vars, match.groups()[1])
2082 return vars
2083
2084
2085def replace_variables(set_variables, input_string):

Callers 1

impala_shell_mainFunction · 0.85

Calls 3

FatalShellExceptionClass · 0.85
replace_variablesFunction · 0.85
matchMethod · 0.80

Tested by

no test coverage detected