def load_extensions():
 installed_extensions = []
 for entry_point in pkg_resources.iter_entry_points(u'mopidy.ext'):
  logger.debug(u'Loading entry point: %s', entry_point)
  try:
   extension_class = entry_point.load(require=False)
  except Exception as e:
   logger.exception((u'Failed to load extension %s: %s' % (entry_point.name, e)))
   continue
  try:
   if (not issubclass(extension_class, Extension)):
    raise TypeError
  except TypeError:
   logger.error(u'Entry point %s did not contain a valid extensionclass: %r', entry_point.name, extension_class)
   continue
  try:
   extension = extension_class()
   config_schema = extension.get_config_schema()
   default_config = extension.get_default_config()
   command = extension.get_command()
  except Exception:
   logger.exception(u'Setup of extension from entry point %s failed, ignoring extension.', entry_point.name)
   continue
  installed_extensions.append(ExtensionData(extension, entry_point, config_schema, default_config, command))
  logger.debug(u'Loaded extension: %s %s', extension.dist_name, extension.version)
 names = (ed.extension.ext_name for ed in installed_extensions)
 logger.debug(u'Discovered extensions: %s', u', '.join(names))
 return installed_extensions

def load_extensions ( ) : installed_extensions = [ ] for entry_point in pkg_resources . iter_entry_points ( u'mopidy.ext' ) : logger . debug ( u'Loading entry point: %s' , entry_point ) try : extension_class = entry_point . load ( require = False ) except Exception as e : logger . exception ( ( u'Failed to load extension %s: %s' % ( entry_point . name , e ) ) ) continue try : if ( not issubclass ( extension_class , Extension ) ) : raise TypeError except TypeError : logger . error ( u'Entry point %s did not contain a valid extensionclass: %r' , entry_point . name , extension_class ) continue try : extension = extension_class ( ) config_schema = extension . get_config_schema ( ) default_config = extension . get_default_config ( ) command = extension . get_command ( ) except Exception : logger . exception ( u'Setup of extension from entry point %s failed, ignoring extension.' , entry_point . name ) continue installed_extensions . append ( ExtensionData ( extension , entry_point , config_schema , default_config , command ) ) logger . debug ( u'Loaded extension: %s %s' , extension . dist_name , extension . version ) names = ( ed . extension . ext_name for ed in installed_extensions ) logger . debug ( u'Discovered extensions: %s' , u', ' . join ( names ) ) return installed_extensions
loads multiple extensions .