<s> from pkg_resources import iter_entry_points <EOL> ENTRY_POINT_NAMES = [ <EOL> '<STR_LIT>' <EOL> ] <EOL> class PluginManager ( object ) : <EOL> def __init__ ( self ) : <EOL> self . _plugins = [ ] <EOL> def __iter__ ( self ) : <EOL> return iter ( self . _plugins ) <EOL> def register ( self , plugin ) : <EOL> self . _plugins . append ( plugin ) <EOL> def get_auth_plugins ( self ) : <EOL> return list ( self . _plugins ) <EOL> def get_auth_plugin_mapping ( self ) : <EOL> return dict ( ( plugin . auth_type , plugin ) for plugin in self ) <EOL> def get_auth_plugin ( self , auth_type ) : <EOL> return self . get_auth_plugin_mapping ( ) [ auth_type ] <EOL> def load_installed_plugins ( self ) : <EOL> for entry_point_name in ENTRY_POINT_NAMES : <EOL> for entry_point in iter_entry_points ( entry_point_name ) : <EOL> plugin = entry_point . load ( ) <EOL> plugin . package_name = entry_point . dist . key <EOL> self . register ( entry_point . load ( ) ) </s>
