3 �ga� � @ s� d dl mZ d dlmZ d dlmZmZmZ d dlm Z ddl mZ ddlm Z mZmZ dd lmZmZ d ddd gZG dd� de�ZdS )� )�groupby)� attrgetter)�Dict�List�Type)�iter_entry_points� )� repr_dict� )� AuthPlugin�ConverterPlugin�FormatterPlugin)� BasePlugin�TransportPluginzhttpie.plugins.auth.v1zhttpie.plugins.formatter.v1zhttpie.plugins.converter.v1zhttpie.plugins.transport.v1c @ s� e Zd Zee d�dd�Zee d�dd�Zee fdd�Zd d � Ze ee d�dd �Zee ee f d�dd�Ze ee d�dd�Ze ee d�dd�Zee e ee f d�dd�Ze ee d�dd�Ze ee d�dd�Zdd� Zdd� ZdS ) � PluginManager)�pluginsc G s x|D ]}| j |� qW d S )N)�append)�selfr �plugin� r �/usr/lib/python3.6/manager.py�register s zPluginManager.register)r c C s | j |� d S )N)�remove)r r r r r � unregister s zPluginManager.unregisterc s � fdd�| D �S )Nc s g | ]}t |� �r|�qS r )� issubclass)�.0r )�by_typer r � <listcomp> s z(PluginManager.filter.<locals>.<listcomp>r )r r r )r r �filter s zPluginManager.filterc C sD x>t D ]6}x0t|�D ]$}|j� }|jj|_| j|j� � qW qW d S )N)�ENTRY_POINT_NAMESr �loadZdist�keyZpackage_namer )r Zentry_point_nameZentry_pointr r r r �load_installed_plugins s z$PluginManager.load_installed_plugins)�returnc C s | j t�S )N)r r )r r r r �get_auth_plugins( s zPluginManager.get_auth_pluginsc C s dd� | j � D �S )Nc S s i | ]}||j �qS r )� auth_type)r r r r r � <dictcomp>, s z9PluginManager.get_auth_plugin_mapping.<locals>.<dictcomp>)r$ )r r r r �get_auth_plugin_mapping+ s z%PluginManager.get_auth_plugin_mapping)r% r# c C s | j � | S )N)r'