Function get_global_cfg

Synopsis

def get_global_cfg(func)

Description

Decorator for GlobalConfig methods. Saves the config if it's not already saved

Source

Lines 18-29 in anyfig/__init__.py.

def get_global_cfg(func):
  ''' Decorator for GlobalConfig methods. Saves the config if it's not already saved '''
  @wraps(func)
  def wrapper(*args, **kwargs):
    self = args[0]
    if self.global_cfg is None:
      self.global_cfg = get_config()
    return func(*args, **kwargs)

  return wrapper







Add Discussion as Guest

Log in