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: Set option value or subconfiguration
  
  Parameters
  ----------
  key: str
      The key or namespace to set the value of the configuration.
      If the configuration has subconfiguration, the key may be
      hierarchical with each level separated by dots.
      Ex: 'first.second.third'
  value: object or Configuration
      A general object to set an option or a configuration object to set
      a sub configuration.
  
  Raises
  ------
  TypeError
      - If value is a configuration and an option is already defined for
      given key, or
      - If the value has an invalid type for the given option, or
      - If no option exists for the given key and the value is not a
      configuration object.
docstr_tok: ["Set","option","value","or","subconfiguration","Parameters","--","--","--","--","--","key",":","str","The","key","or","namespace","to","set","the","value","of","the","configuration",".","If","the","configuration","has","subconfiguration",",","the","key","may","be","hierarchical","with","each","level","separated","by","dots",".","Ex",":","'first.second.third'","value",":","object","or","Configuration","A","general","object","to","set","an","option","or","a","configuration","object","to","set","a","sub","configuration",".","Raises","--","--","--","TypeError","-","If","value","is","a","configuration","and","an","option","is","already","defined","for","given","key",",","or","-","If","the","value","has","an","invalid","type","for","the","given","option",",","or","-","If","no","option","exists","for","the","given","key","and","the","value","is","not","a","configuration","object","."]
code: def __setattr__(self, key, value):
      """Set option value or subconfiguration
  
      Parameters
      ----------
      key: str
          The key or namespace to set the value of the configuration.
          If the configuration has subconfiguration, the key may be
          hierarchical with each level separated by dots.
          Ex: 'first.second.third'
      value: object or Configuration
          A general object to set an option or a configuration object to set
          a sub configuration.
  
      Raises
      ------
      TypeError
          - If value is a configuration and an option is already defined for
          given key, or
          - If the value has an invalid type for the given option, or
          - If no option exists for the given key and the value is not a
          configuration object.
  
      """
      key = _curate(key)
      if key not in self.SPECIAL_KEYS and key in self._config:
          self._validate(key, value)
          self._config[key]["value"] = value
          if self._config[key].get("deprecated"):
              self._deprecate(key, value)
  
      elif key in ["_config", "_subconfigs"]:
          super().__setattr__(key, value)
  
      elif key in self._subconfigs:
          raise ValueError(
              f"Configuration already contains subconfiguration {key}"
          )
  
      elif isinstance(value, Configuration):
          self._subconfigs[key] = value
  
      else:
          raise TypeError(
              f"Can only set {key} as a Configuration, not {type(value)}. "
              "Use add_option to set a new option."
          )
  
imports: import contextlib
  import logging
  import os
  import pprint
  import yaml
label_desc: Use image node_id 5 for calling the Configuration obj's underlying member method code with example usage: obj.__setattr__(key, value) without return types