Did I find the right examples for you? yes no

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)
Overlay `o1` over `o2`

        def update(o1, o2):
  """Overlay `o1` over `o2`"""

  def update_dict(o1, o2):
    if not isinstance(o2, dict):
      o2 = {}
    for k, v in o1.items():
      o2[k] = update(o1[k], o2.get(k, {}))
    return o2

  def update_list(o1, o2):
    if not isinstance(o2, list):
      try:
        o2 = list(o2)
      except ValueError:
        o2 = []
    if len(o1) > len(o2):
      o2 = o2 + [Missing] * (len(o1) - len(o2))
    if len(o2) > len(o1):
      o1 = o1 + [Missing] * (len(o2) - len(o1))
    for i in range(len(o1)):
      o2[i] = update(o1[i], o2[i])
    return o2

  def update_tuple(o1, o2):
    return tuple(update_list(o1, list(o2)))


  if isinstance(o1, dict):
    return update_dict(o1, o2)
  elif isinstance(o1, list):
    return update_list(o1, o2)
  elif isinstance(o1, tuple):
    return update_tuple(o1, o2)
  else:
    if isinstance(o1, Missing_):
      return o2
    else:
      return o1
        


src/c/o/configurati-0.2.3/configurati/configure.py   configurati(Download)
from .commands import load_config, load_spec
from .globals import CONFIG
from .utils import update
from .validation import validate
 
    config = args['config']
  if config is not None:
    result = update(args, load_config(config))
  else:
    result = args