Function get_config

Synopsis

def get_config()

Description

Returns the config object that is registered with anyfig

Mentioned in

Source

Lines 55-71 in anyfig/figutils.py.

def get_config():
  ''' Returns the config object that is registered with anyfig '''

  # Normal case
  if len(global_configs) == 1:
    return next(iter(global_configs.values()))

  # init_config function adds one so this should never happen
  elif len(global_configs) == 0:
    raise RuntimeError("No config object has been registered")

  # If multiple config objects has been marked as global
  raise RuntimeError(
    "Multiple config objects aren't supported. Create an issue if this is something you want to see"
  )







Add Discussion as Guest

Log in