class_docstr: Configuration object
  
  Provides default values configurable at different levels. The configuration object can have
  global default values, which may be overridden by user with yaml configuration files,
  environment variables or by setting directly the values in the configuration object. In order,
  direct definition overrides, environment variables, which overrides yaml configuration, which
  overrides default values in configuration object definition.
  
  Examples
  --------
  >>> config = Configuration()
  >>> config.add_option('test', str, 'hello', 'TEST_ENV')
  >>> config.test
  'hello'
  >>> config.load_yaml('some_config.yaml')
  >>> config.test
  'in yaml!'
  >>> os.environ['TEST_ENV'] = 'there!'
  >>> config.test
  'there!'
  >>> config.test = 'here'
  >>> config.test
  'here'
class_docstr_tok: ["Configuration","object","Provides","default","values","configurable","at","different","levels",".","The","configuration","object","can","have","global","default","values",",","which","may","be","overridden","by","user","with","yaml","configuration","files",",","environment","variables","or","by","setting","directly","the","values","in","the","configuration","object",".","In","order",",","direct","definition","overrides",",","environment","variables",",","which","overrides","yaml","configuration",",","which","overrides","default","values","in","configuration","object","definition",".","Examples","--","--","--","--",">",">",">","config","=","Configuration","(",")",">",">",">","config.add_option","(","'test","'",",","str",",","'hello","'",",","'TEST_ENV","'",")",">",">",">","config.test","'hello'",">",">",">","config.load_yaml","(","'some_config.yaml","'",")",">",">",">","config.test","'in","yaml","!","'",">",">",">","os.environ","[","'TEST_ENV","'","]","=","'there","!","'",">",">",">","config.test","'there","!","'",">",">",">","config.test","=","'here'",">",">",">","config.test","'here","'"]
docstr: Get the value of the option
  
  Parameters
  ----------
  key: str
      Name of the option
  
  Returns
  -------
      Value of the option.
  
  Raises
  -------
  ConfigurationError
      If the option does not exist
docstr_tok: ["Get","the","value","of","the","option","Parameters","--","--","--","--","--","key",":","str","Name","of","the","option","Returns","--","--","--","-","Value","of","the","option",".","Raises","--","--","--","-","ConfigurationError","If","the","option","does","not","exist"]
code: def __getattr__(self, key):
      """Get the value of the option
  
      Parameters
      ----------
      key: str
          Name of the option
  
      Returns
      -------
          Value of the option.
  
      Raises
      -------
      ConfigurationError
          If the option does not exist
  
      """
      if key == "config":
          raise AttributeError
  
      if key not in self._config and key not in self._subconfigs:
          raise ConfigurationError(
              f"Configuration does not have an attribute '{key}'."
          )
      if key in self._subconfigs:
          return self._subconfigs[key]
  
      config_setting = self._config[key]
      if "value" in config_setting:
          value = config_setting["value"]
      elif (
          "env_var" in config_setting
          and config_setting["env_var"] in os.environ
      ):
          value = os.environ[config_setting["env_var"]]
          if config_setting["type"] in (list, tuple):
              value = value.split(":")
      elif "yaml" in config_setting:
          value = config_setting["yaml"]
      elif "default" in config_setting:
          value = config_setting["default"]
      else:
          raise ConfigurationError(
              f"Configuration not set and no default provided: {key}."
          )
  
      if config_setting.get("deprecated"):
          self._deprecate(key)
  
      return config_setting["type"](value)
  
imports: import contextlib
  import logging
  import os
  import pprint
  import yaml
label_desc: Use image node_id 4 for calling the Configuration obj's underlying member method code with example usage: obj.__getattr__(key) and returns: config_setting, self