parameters: (cp, formatters)
return_statement: return handlers
docstring: Install and return handlers
docstring_summary: Install and return handlers
docstring_tokens: Install and return handlers
function: def _install_handlers(cp, formatters):
      """Install and return handlers"""
      hlist = cp.get("handlers", "keys")
      if not len(hlist):
          return {}
      hlist = hlist.split(",")
      hlist = _strip_spaces(hlist)
      handlers = {}
      fixups = [] #for inter-handler references
      for hand in hlist:
          sectname = "handler_%s" % hand
          klass = cp.get(sectname, "class")
          opts = cp.options(sectname)
          if "formatter" in opts:
              fmt = cp.get(sectname, "formatter")
          else:
              fmt = ""
          try:
              klass = eval(klass, vars(logging))
          except (AttributeError, NameError):
              klass = _resolve(klass)
          args = cp.get(sectname, "args")
          args = eval(args, vars(logging))
          h = klass(*args)
          if "level" in opts:
              level = cp.get(sectname, "level")
              h.setLevel(logging._levelNames[level])
          if len(fmt):
              h.setFormatter(formatters[fmt])
          if issubclass(klass, logging.handlers.MemoryHandler):
              if "target" in opts:
                  target = cp.get(sectname,"target")
              else:
                  target = ""
              if len(target): #the target handler may not be loaded yet, so keep for later...
                  fixups.append((h, target))
          handlers[hand] = h
      #now all handlers are loaded, fixup inter-handler references...
      for h, t in fixups:
          h.setTarget(handlers[t])
      return handlers
function_tokens: def _install_handlers ( cp , formatters ) : hlist = cp . get ( "handlers" , "keys" ) if not len ( hlist ) : return { } hlist = hlist . split ( "," ) hlist = _strip_spaces ( hlist ) handlers = { } fixups = [ ] #for inter-handler references for hand in hlist : sectname = "handler_%s" % hand klass = cp . get ( sectname , "class" ) opts = cp . options ( sectname ) if "formatter" in opts : fmt = cp . get ( sectname , "formatter" ) else : fmt = "" try : klass = eval ( klass , vars ( logging ) ) except ( AttributeError , NameError ) : klass = _resolve ( klass ) args = cp . get ( sectname , "args" ) args = eval ( args , vars ( logging ) ) h = klass ( * args ) if "level" in opts : level = cp . get ( sectname , "level" ) h . setLevel ( logging . _levelNames [ level ] ) if len ( fmt ) : h . setFormatter ( formatters [ fmt ] ) if issubclass ( klass , logging . handlers . MemoryHandler ) : if "target" in opts : target = cp . get ( sectname , "target" ) else : target = "" if len ( target ) : #the target handler may not be loaded yet, so keep for later... fixups . append ( ( h , target ) ) handlers [ hand ] = h #now all handlers are loaded, fixup inter-handler references... for h , t in fixups : h . setTarget ( handlers [ t ] ) return handlers