U
K��^j � @ s G d d� d�Z dS )c @ sB e Zd Zddd�Zdd� Zdd� Zdd � Zed
d� �Zdd
� Z dS )�
ControllerSet� c C s* || _ |d d � | _|| _d| _g | _d S )N���)�controllers_mod�controller_names� init_args�index� instances)�selfr �namesr r r �3/usr/share/subiquity/subiquitycore/controllerset.py�__init__ s
zControllerSet.__init__c C s |d }t | j|�S )NZ
Controller)�getattrr )r �nameZcls_namer r r �_get_controller_class s z#ControllerSet._get_controller_classc C s� | j �|� | �|�}t| |�rdd}| jD ]}t||�r*|d7 }q*| �d�}|t| |�|�}|j}n
|| j� }t | ||� | j�
|� d S )N� ZRepeated)r �remover �hasattrr �
isinstancer
r r �setattr�append)r r �klass�c�instanceZrep_cls�instr r r �load s
zControllerSet.loadc C s | j r| �| j d � q d S �N� )r r �r r r r �load_all- s zControllerSet.load_allc C s | � � rd S | j| j S )N)�
out_of_boundsr r r r r r �cur1 s zControllerSet.curc C s | j dk p| j t| j�kS r )r �lenr r r r r r 7 s zControllerSet.out_of_boundsN)r )
�__name__�
__module__�__qualname__r r r r �propertyr r r r r r r s
r N)r r r r r �<module> � |