class_docstr: A config utility class.
class_docstr_tok: ["A","config","utility","class","."]
docstr: Parse a string like 'x.y=1,x.z=2' to nested dict {x: {y: 1, z: 2}}.
docstr_tok: ["Parse","a","string","like","'","x.y=1",",","x.z=2","'","to","nested","dict","{","x",":","{","y",":","1",",","z",":","2","}","}","."]
code: def parse_from_str(self, config_str: Text) -> Dict[Any, Any]:
      """Parse a string like 'x.y=1,x.z=2' to nested dict {x: {y: 1, z: 2}}."""
      if not config_str:
          return {}
      config_dict = {}
      try:
          for kv_pair in config_str.split(","):
              if not kv_pair:  # skip empty string
                  continue
              key_str, value_str = kv_pair.split("=")
              key_str = key_str.strip()
  
              def add_kv_recursive(k, v):
                  """Recursively parse x.y.z=tt to {x: {y: {z: tt}}}."""
                  if "." not in k:
                      if "*" in v:
                          # we reserve * to split arrays.
                          return {
                              k: [
                                  eval_str_fn(vv) for vv in v.split("*")
                              ]
                          }
                      return {k: eval_str_fn(v)}
                  pos = k.index(".")
                  return {k[:pos]: add_kv_recursive(k[pos + 1 :], v)}
  
              def merge_dict_recursive(target, src):
                  """Recursively merge two nested dictionary."""
                  for k in src.keys():
                      if (
                          k in target
                          and isinstance(target[k], dict)
                          and isinstance(
                              src[k], collections.abc.Mapping
                          )
                      ):
                          merge_dict_recursive(target[k], src[k])
                      else:
                          target[k] = src[k]
  
              merge_dict_recursive(
                  config_dict, add_kv_recursive(key_str, value_str)
              )
          return config_dict
      except ValueError:
          raise ValueError("Invalid config_str: {}".format(config_str))
  
imports: import ast
  import collections
  import copy
  from typing import Any, Dict, Text
  import six
  import tensorflow
  import yaml
label_desc: Use image node_id 15 for calling the Config obj's underlying member method code with example usage: obj.parse_from_str(config_str) and returns: dict, config_dict, dict, dict, dict