Mini Shell

Direktori : /lib64/python3.6/site-packages/pyanaconda/__pycache__/
Upload File :
Current File : //lib64/python3.6/site-packages/pyanaconda/__pycache__/lifecycle.cpython-36.opt-1.pyc

3

v�e��@slddlmZddlmZddlmZddlmZee�Z	iZ
iZdd�Zdd�Z
d	d
�ZGdd�de�Zd
S)�)�RLock)�Signal)�synchronized)�get_module_loggercCs*x$tj�D]\}}||kr
t|Sq
WdS)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
cCs
tj|�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	rrr�get_controller_by_name8s
rcCs:|dkrtjd�ntjd|�t�}|t|<|t|<|S)NzController name is None.zAdding controller: %s)�log�warning�info�
Controllerrr)r	r
Z
controllerrrr�add_controllerEsrc@s<eZdZdZdd�Zedd��Zdd�Zdd	�Zd
d�Z	dS)
rz:A singleton that track initialization of Anaconda modules.cCs.t�|_t�|_d|_t�|_d|_d|_dS)NFr)	r�_lock�set�_modules�_all_modules_addedr�	init_done�_init_done_triggered�_added_module_count)�selfrrr�__init__UszController.__init__cCsJ|jrtjd|�n2||jkr,tjd|�n|jd7_|jj|�dS)z�Tell the controller that a module has started initialization.

        :param module: a module which has started initialization
        z!Late module_init_start() from: %sz)Module already marked as initializing: %s�N)rrrrr�add)r�modulerrr�module_init_start]s
zController.module_init_startc
CsTd}|j�4tjd|j�d|_|jr:|jr:d|_d}WdQRX|rP|j�dS)a�Tell the controller that all expected modules have started initialization.

        Tell the controller that all expected modules have been registered
        for initialization tracking (or have already been initialized)
        and no more are expected to be added.

        This is needed so that we don't prematurely trigger the init_done signal
        when all known modules finish initialization while other modules have not
        yet been added.
        Fz4Initialization of all modules (%d) has been started.TN)rrrrrrr�_trigger_init_done)rrrrr�all_modules_addedkszController.all_modules_addedc
Cs�d}|j�b|jr tjd|�nH||jkrDtjd|�|jj|�ntjd|�|jrh|jrhd}d|_WdQRX|r~|j�dS)z�Tell the controller that a module has finished initialization.

        And if no more modules are being initialized trigger the init_done signal.

        :param module: a module that has finished initialization
        Fz%Late module_init_done from module %s.zModule initialized: %sz*Unknown module reported as initialized: %sTN)	rrrrrr�discardrr")rr rrrr�module_init_done�s
zController.module_init_donecCstjd�|jj�dS)Nz"All modules have been initialized.)rrr�emit)rrrrr"�s
zController._trigger_init_doneN)
�__name__�
__module__�__qualname__�__doc__rrr!r#r%r"rrrrrSsrN)Z	threadingrZpyanaconda.core.signalrZpyanaconda.core.utilrZpyanaconda.anaconda_loggersrr'rrrr
rr�objectrrrrr�<module>s