(config_str)
return ans
Parses config string.

  For example: config_str = "a=1 b='hello'", the function returns
  {'a': 1, 'b': 'hello'}.

  Args:
    config_str: A config string.
  Returns:
    A dictionary.
Parses config string.
Parses config string .
def parse_config_str(config_str):
  """Parses config string.

  For example: config_str = "a=1 b='hello'", the function returns
  {'a': 1, 'b': 'hello'}.

  Args:
    config_str: A config string.
  Returns:
    A dictionary.
  """
  ans = {}
  for line in config_str.split('\n'):
    k, v = line.partition('=')[::2]
    k = k.strip()
    v = v.strip()
    if k and not k.startswith('//'):
      try:
        v = int(v)
      except ValueError:
        try:
          v = float(v)
        except ValueError:
          v = v[1:-1]  # remove quotes for string argument.
      ans[k] = v
  return ans
def parse_config_str ( config_str ) : ans = { } for line in config_str . split ( '\n' ) : k , v = line . partition ( '=' ) [ : : 2 ] k = k . strip ( ) v = v . strip ( ) if k and not k . startswith ( '//' ) : try : v = int ( v ) except ValueError : try : v = float ( v ) except ValueError : v = v [ 1 : - 1 ] # remove quotes for string argument. ans [ k ] = v return ans