docstr: load traits from a Config object
docstr_tok: ["load","traits","from","a","Config","object"]
code: def _load_config(self, cfg, section_names=None, traits=None):
      """load traits from a Config object"""
  
      if traits is None:
          traits = self.traits(config=True)
      if section_names is None:
          section_names = self.section_names()
  
      my_config = self._find_my_config(cfg)
  
      # hold trait notifications until after all config has been loaded
      with self.hold_trait_notifications():
          for name, config_value in my_config.items():
              if name in traits:
                  if isinstance(config_value, LazyConfigValue):
                      # ConfigValue is a wrapper for using append / update on containers
                      # without having to copy the initial value
                      initial = getattr(self, name)
                      config_value = config_value.get_value(initial)
                  # We have to do a deepcopy here if we don't deepcopy the entire
                  # config object. If we don't, a mutable config_value will be
                  # shared by all instances, effectively making it a class attribute.
                  setattr(self, name, deepcopy(config_value))
              elif not _is_section_key(name) and not isinstance(
                  config_value, Config
              ):
                  from difflib import get_close_matches
  
                  if isinstance(self, LoggingConfigurable):
                      warn = self.log.warning
                  else:
                      warn = lambda msg: warnings.warn(
                          msg, stacklevel=9
                      )
                  matches = get_close_matches(name, traits)
                  msg = "Config option `{option}` not recognized by `{klass}`.".format(
                      option=name, klass=self.__class__.__name__
                  )
  
                  if len(matches) == 1:
                      msg += "  Did you mean `{matches}`?".format(
                          matches=matches[0]
                      )
                  elif len(matches) >= 1:
                      msg += (
                          "  Did you mean one of: `{matches}`?".format(
                              matches=", ".join(sorted(matches))
                          )
                      )
                  warn(msg)
  
imports: from __future__ import print_function, absolute_import
  from copy import deepcopy
  import warnings
  from .loader import Config, LazyConfigValue, _is_section_key
  from traitlets.traitlets import HasTraits, Instance, observe, observe_compat, default
  from ipython_genutils.text import indent, dedent, wrap_paragraphs
label_desc: Use image node_id 4 for calling the Configurable obj's underlying member method code with example usage: obj._load_config(cfg, section_names, traits) without return types