Mini Shell
3
v�e� � @ sl d dl mZ d dlmZ d dlmZ d dlmZ ee�Z i Z
i Zdd� Zdd� Z
d d
� ZG dd� de�Zd
S )� )�RLock)�Signal)�synchronized)�get_module_loggerc C s* x$t j� D ]\}}| |kr
t| S q
W dS )a� Return the controller instance that "owns" the corresponding category.
This is more or less a workaround to the fact that spokes
need to know what's their controller, but the controllers
are indexed by hub name and spokes don't have a direct reference
to the hub they are displayed on.
Spokes know their category and hubs know what categories the and
categories should not be on two hubs. So we match the spoke category
to get the controller corresponding to the spoke.
:param str category_name: a spoke category name
:returns: a Controller instance "owning" the category or None if no matching instance is found
:rtype: str or None
N)�_controller_categories_map�items�_controllers)Z
category_name�controller_name�controller_categories� r �!/usr/lib64/python3.6/lifecycle.py�get_controller_by_category s r
c C s
t j| �S )a/ Return controller instance by name.
This function wraps the internal controller dictionary, so that it is not directly exposed.
The controller names currently correspond to hub class name, eq.:
SummaryHub, ProgressHub, etc.
:param str controller_name: a name of a controller name
)r �get)r r r r �get_controller_by_name8 s
r c C s: | d krt jd� nt jd| � t� }|t| <