HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //usr/lib/python3.6/site-packages/ipapython/install/__pycache__/core.cpython-36.pyc
3

�d[e�F�@s�dZddlZddlZddlZddlZddlZddlZddlmZddlm	Z	dddd	d
ddd
gZ
ed�ZeZ
dZdZdZdZdZdZdZe�Zej�Zejdd��ZGdd�de�ZGdd�de�ZGdd�dejej e��Z!efdd�Z"Gdd�de!�Z#eeeeeeeeeeefdd�Z$efd d	�Z%eeefd!d"�Z&Gd#d
�d
ejej'e��Z(d$d�Z)Gd%d&�d&ej ej'�Z*Gd'd(�d(eje*e(��Z+d)d�Z,Gd*d
�d
e(�Z-dS)+z
The framework core.
�N�)�util)�from_�InvalidStateError�KnobValueError�Property�knob�Configurable�group�	Component�	CompositeZVALIDATE_PENDINGZVALIDATE_RUNNINGZEXECUTE_PENDINGZEXECUTE_RUNNINGZSTOPPEDZFAILEDZCLOSEDcCs0||krdSt||�rdSt||�r(dSdSdS)Nrr���)�
issubclass)�a�b�r�/usr/lib/python3.6/core.py�
_class_key's

rc@seZdZdS)rN)�__name__�
__module__�__qualname__rrrrr3scseZdZ�fdd�Z�ZS)rcstt|�j|�||_dS)N)�superr�__init__�name)�selfr�message)�	__class__rrr8szKnobValueError.__init__)rrrr�
__classcell__rr)rrr7sc@sDeZdZdZdZdZedd��Zdd�Zdd�Z	dd	�Z
d
d�ZdS)�PropertyBaseNcCstd��dS)N�default)�AttributeError)rrrrrDszPropertyBase.defaultcCsdS)Nr)r�outerrrrrHszPropertyBase.__init__cCsbx6|dk	r6y|j|jStk
r*YnX|j�}qWy|jStk
r\t|j��YnXdS)N)�__dict__�__outer_name__�KeyError�
_get_fallbackrr )r�obj�obj_typerrr�__get__Ks
zPropertyBase.__get__cCs4y||j|j<Wntk
r.t|j��YnXdS)N)r"r#r$r )rr&�valuerrr�__set__XszPropertyBase.__set__cCs2y|j|j=Wntk
r,t|j��YnXdS)N)r"r#r$r )rr&rrr�
__delete__^szPropertyBase.__delete__)rrr�__outer_class__r#�_order�propertyrrr(r*r+rrrrr=s
rcCs$i}|tk	r||d<tjdtf|�S)Nrr)�_missingr�InnerClassMetar)r�
class_dictrrrrescspeZdZdZdZdZdZdZfZdZ	dd�Z
dd�Zedd��Z
ed	d
��Zedd��Ze�fd
d��Z�ZS)�KnobBaseNFcCs
||_dS)N)r!)rr!rrrrvszKnobBase.__init__cCsdS)Nr)rr)rrr�validateyszKnobBase.validatecCs
|jj�S)N)r,r
)�clsrrrr
|szKnobBase.groupcCstdd�|jD��S)Ncss"|]}|dk	o|jd�VqdS)N�-)�
startswith)�.0�nrrr�	<genexpr>�sz-KnobBase.is_cli_positional.<locals>.<genexpr>)�all�	cli_names)r4rrr�is_cli_positional�szKnobBase.is_cli_positionalcst�fdd��}||_|S)Ncs
�|j�S)N)r!)r)�funcrrr�sz(KnobBase.default_getter.<locals>.default)r.r)r4r=rr)r=r�default_getter�szKnobBase.default_gettercs���fdd�}|�_�S)Ncs �|j|�t�|�j|�dS)N)r!rr3)rr))rr4r=rrr3�sz$KnobBase.validator.<locals>.validate)r3)r4r=r3)r)r4r=r�	validator�szKnobBase.validator)N)rrr�type�	sensitive�
deprecated�descriptionr;�cli_deprecated_names�cli_metavarrr3�classmethodr
r<r>r?rrr)rrr2ms	r2cCs.|dkrt}|tkrtf}nt|t�r,|f}|dks>t|t�rF|f}n|tk	rVt|�}t|	t�rh|	f}	n|	tk	rxt|	�}	i}|tk	r�||d<|tk	r�||d<|tk	r�||d<|tk	r�||d<|tk	r�||d<|tk	r�||d<|tk	r�||d<|tk	r�||d<|	tk	�r|	|d	<|
tk	�r |
|d
<tjd||�S)Nr@rr-rArBrCr
r;rDrEZKnob)	�NoneTyper/r2�
isinstance�builtin_type�str�tuplerr0)r@r�basesr-rArBrCr
r;rDrEr1rrr�_knob�sH



rMcKst||fdtt�i|��S)z
    Define a new knob.
    r-)rM�next�_counter)r@r�kwargsrrrr�scKs:|tkr|f}|tkr t|j�}tt|f|t|d�|��S)z"
    Extend an existing knob.
    )rLr-r
)r/�staticmethodr
rM)�baserrLr
rPrrr�extend_knob�s
rScs�eZdZdZe�fdd��Zedd��Ze�fdd��Zdd	�Z�fd
d�Z	�fdd
�Z
dd�Zej
�fdd��Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Z�fd"d#�Z�fd$d%�Z�fd&d'�Zd(d)�Z�ZS)*r	zh
    Base class of all configurables.

    FIXME: details of validate/execute, properties and knobs
    c#s�ttt|�d�st�t�}x�|jD]�}g}xT|jj�D]F\}}||krJq8|j|�t	|t
�s`q8t|t�slq8|j
|j||f�q8Wt|dd�d�}x|D]\}}}||fVq�Wq$WdS)zG
        Iterate over properties defined for the configurable.
        �
propertiescSs|dS)Nrr)�rrrr�<lambda>sz)Configurable.properties.<locals>.<lambda>)�keyN)�hasattrrr	�AssertionError�set�__mro__r"�items�addrHr@rr�appendr-�sorted)r4�seen�	owner_cls�resultr�prop_clsr-)rrrrT�s 


zConfigurable.propertiesccs8x2|j�D]&\}}t||�}t|t�r
||fVq
WdS)N)rT�getattrrr2)r4rarrcrrr�knobss

zConfigurable.knobscsttt|�d�st�dS)Nr
)rXrr	rY)r4)rrrr
szConfigurable.groupc
KsX|j}xr|j�D]f\}}|jd�r$qt||�}t|t�s:qt|t�sFqy|j|�}Wnt	k
rhYqXt
|||�qWx�|j�D]�\}}|jd�r�q�t||�s�q�t||d�}|dkr�q�t||�}||�}y|j|�Wq�t
k
�r}zt|t|���WYdd}~Xq�Xq�W|�rLt|�}	tdjt|�jt|	�djdd�|	D�����|j�dS)z.
        Initialize the configurable.
        �_Nz/{0}() got {1} unexpected keyword arguments: {2}z, css|]}t|�VqdS)N)�repr)r7rrrrr9Bsz(Configurable.__init__.<locals>.<genexpr>)rrTr6rdrHr@rr�popr$�setattrrer3�
ValueErrorrrJr_�	TypeError�formatr�len�join�_reset)
rrPr4rarrcr)Zprop�eZextrarrrrsH






$zConfigurable.__init__cs0ttt|�d�st�t|_tj|j��|_	dS)Nro)
rXrr	rY�_VALIDATE_PENDING�_Configurable__staterZrun_generator_with_yield_from�
_configure�_Configurable__gen)r)rrrroFszConfigurable._resetcs(ttt|�d�st�tdj|���dS)N�_get_componentsz{0} is not composite)rXrr	rYrkrl)r)rrrruLszConfigurable._get_componentscCsdS)Nr)rrrrr%QszConfigurable._get_fallbackc#s<ttt|�d�st�|jtt�x|jtkr6dVq$WdS)zH
        Coroutine which defines the logic of the configurable.
        rsN)	rXrr	rY�_Configurable__transition�_VALIDATE_RUNNING�_EXECUTE_PENDINGrr�_EXECUTE_RUNNING)r)rrrrsTszConfigurable._configurecCs|j�|jtkr|j�SdS)z'
        Run the configurable.
        N)r3rrrx�execute)rrrr�runas
zConfigurable.runcCsx|j�D]}q
WdS)z>
        Run the validation part of the configurable.
        N)�
_validator)rZ_nothingrrrr3kszConfigurable.validatecCs|jtt|j�S)zO
        Coroutine which runs the validation part of the configurable.
        )�_Configurable__runnerrqrw�_handle_validate_exception)rrrrr|sszConfigurable._validatorcCs.d}x$|j�D]}|dk	r||kr|}qW|S)z=
        Run the execution part of the configurable.
        rN)�	_executor)rZreturn_valueZrvalrrrrz|s
zConfigurable.executecCs|jtt|j�S)zN
        Coroutine which runs the execution part of the configurable.
        )r}rxry�_handle_execute_exception)rrrrr�szConfigurable._executorcCs|jtttfkS)z?
        Return True if the configurable has finished.
        )rr�_STOPPED�_FAILED�_CLOSED)rrrr�done�szConfigurable.doneccs:x4|jtkr4yt|�VWqtk
r0PYqXqWdS)N)rrryrN�
StopIteration)r�genrrr�run_until_executing�s
z Configurable.run_until_executingc#s�j||��fdd�}x�y
|�Wn�tk
rF�j|t�PYnltk
rf�j|t�PYnLtk
r�tj��y|��Wn"tk
r��j|t��YnXYnX�j	|kr�Py
dVWn*tk
r�tj����fdd�}YqX�fdd�}qWdS)Ncs
t�j�S)N)rNrtr)rrrrV�sz'Configurable.__runner.<locals>.<lambda>cs�jj��S)N)rt�throwr)�exc_inforrrrV�scs
t�j�S)N)rNrtr)rrrrV�s)
rvr�r��
GeneratorExitr��
BaseException�sysr�r�rr)rZ
pending_stateZ
running_stateZexc_handler�stepr)r�rrZ__runner�s4


zConfigurable.__runnercs$ttt|�d�st�tj|�dS)N�_handle_exception)rXrr	rY�sixZreraise)rr�)rrrr��szConfigurable._handle_exceptioncs$ttt|�d�st�|j|�dS)Nr~)rXrr	rYr�)rr�)rrrr~�s
z'Configurable._handle_validate_exceptioncs$ttt|�d�st�|j|�dS)Nr�)rXrr	rYr�)rr�)rrrr��s
z&Configurable._handle_execute_exceptioncCs|j|krt|j��||_dS)N)rrr)rZ
from_stateZto_staterrrZ__transition�s

zConfigurable.__transition)rrr�__doc__rFrTrer
rrorur%�abc�abstractmethodrsr{r3r|rzrr�r�r}r�r~r�rvrrr)rrr	�s*0

		 cs�fdd�}t|��_�S)Ncs�S)Nrr)r4rrr
�szgroup.<locals>.group)rQr
)r4r
r)r4rr
�s
c@seZdZdS)�
ComponentMetaN)rrrrrrrr��sr�cs`eZdZdZdZdZe�fdd��Z�fdd�Ze	dd��Z
dd	�Zd
d�Z�fdd
�Z
�ZS)�
ComponentBaseNcs(tt|�j�}|dk	r|S|jj�SdS)N)rr�r
r,)r4rb)rrrr
�szComponentBase.groupcs||_tt|�jf|�dS)N)�_ComponentBase__parentrr�r)r�parentrP)rrrr�szComponentBase.__init__cCs|jS)N)r�)rrrrr��szComponentBase.parentcCs||j|j<|S)N)r"r#)rr&r'rrrr(�szComponentBase.__get__cCs|jS)N)r�)rrrrr%�szComponentBase._get_fallbackcsBytt|�j|�Wn(tk
r<tj�}|jj|�YnXdS)N)rr�r�r�r�r�r�)rr�)rrrr�s
zComponentBase._handle_exception)rrrr,r#r-rFr
rr.r�r(r%r�rrr)rrr��sr�cCs i}tt�|d<tdt|f|�S)Nr-r)rNrOr�r�)r4r1rrrr	scs\eZdZdZe�fdd��Ze�fdd��Zdd�Z�fdd	�Zd
d�Z	�fdd
�Z
�ZS)rzi
    Configurable composed of any number of components.

    Provides knobs of all child components.
    c	#s�i}tj�}x4tt|�j�D]"\}}|||<|j|g�j|�qW�x|j�D]�\}}t||�}x�|j	�D]�\}}t
||�r~qjy||}Wn.tk
r�|||<|j|g�j|�YqjXt||�}t||�}t||��r|||<||j
|�|j|g�|||k�r>||j|�qjt||�sjtdj|j||j|j���qjWqNWx4t|td�D]$}x||D]}||fV�qbW�qTWdS)Nz<{0}.knobs(): conflicting definitions of '{1}' in {2} and {3})rW)�collections�OrderedDictrrrT�
setdefaultr^�
componentsrdrerXr$r�removerkrlrr_r)	r4Z	name_dictZ
owner_dictrar�comp_clsZlast_owner_clsZknob_clsZ
last_knob_cls)rrrrTs@




zComposite.propertiesc#s�ttt|�d�st�t�}x�|jD]�}g}xT|jj�D]F\}}||krJq8|j|�t	|t
�s`q8t|t�slq8|j
|j||f�q8Wt|dd�d�}x|D]\}}}||fVq�Wq$WdS)Nr�cSs|dS)Nrr)rUrrrrVVsz&Composite.components.<locals>.<lambda>)rW)rXrrrYrZr[r"r\r]rHr@rr�r^r-r_)r4r`rarbrr�r-)rrrr�As 


zComposite.componentscCsVx&|j�D]\}}||kr
Pq
Wt|��x"|jD]}t||�r0Pq0Wt|��t||�S)N)rer �_Composite__componentsrHrd)rrraZ	knob_nameZ	componentrrr�__getattr__[s
zComposite.__getattr__cs t|j��|_tt|�j�dS)N)�listrur�rrro)r)rrrrojszComposite._resetccs&x |j�D]\}}t||�Vq
WdS)N)r�rd)rZ
_owner_clsrrrrruoszComposite._get_componentsc#s�dd�|jD�}xZg}x@|D]8\}}yt|�Wntk
rDYqX|j||f�qW|s^P|}dVqW|jsvdSttt|�j��Vdd�|jD�}xZg}x@|D]8\}}yt|�Wntk
r�Yq�X|j||f�q�W|s�P|}dVq�WdS)NcSsg|]}||j�f�qSr)r|)r7�crrr�
<listcomp>tsz(Composite._configure.<locals>.<listcomp>cSs g|]}|j�s||j�f�qSr)r�r)r7r�rrrr��s)r�rNr�r^rrrrs)rr3Znew_validateZchildr?rzZnew_execute�executor)rrrrsss:
zComposite._configure)rrrr�rFrTr�r�rorursrrr)rrrs*).r�r�r��	functools�	itertoolsr�r��rr�__all__r@rGrIrqrwrxryr�r�r��objectr/�countrO�
cmp_to_keyr�	ExceptionrrjrZwith_metaclassr0rrr2rMrrS�ABCMetar	r
r�r�rrrrrr�<module>sP(+,p	'