HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/__pycache__/lazy.cpython-310.pyc
o

�N�gT��@srddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlmZddlmZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Zddl!Zddl"Zddl#Zddl$Zddl%m&Z&zddl'Z(Wn
e)y�ddl(Z(Ynwe�*e+�Z,dZ-dZ.dZ/dZ0gZ1ej2j3D]
Z4e1�5e4d	e/f�q�ej2j6D]
Z4e1�5e4d	e-f�q�ej2j7D]
Z4e1�5e4d	e.f�q�e-ej2j8e.ej2j9e/ej2j:iZ;e�<ej=j>��?�Z@d
ZAe	�BdjCe
jDdd���ZEdaFdd
�ZGdd�ZHGdd�de�ZIGdd�d�ZJGdd�d�ZKGdd�dejLjMjN�ZOdd�ZPdS)�N)�MutableMapping)�zipimporter)�Depends�����rbzsalt.loadedz\.cpython-{}{}(\.opt-[1-9])?cCsJ|tjvrdSd�|�d�d�}t�t|��}t||j�|tj|<dS)Nz"'''Salt loaded {} parent module'''�.���)	�sys�modules�format�split�types�
ModuleType�str�exec�__dict__)�name�code�module�r�D/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py�_generate_moduleKs
rcCs|�tt��r	dSdS)N�int�ext)�
startswithr�SALT_BASE_PATH)Zmodule_pathrrr�	_mod_typeVsrc@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�FilterDictWrapperzx
    Create a dict which wraps another dict with a specific key suffix on get

    This is to replace "filter_load"
    cCs||_||_dS�N��_dict�suffix)�self�dr$rrr�__init__cs
zFilterDictWrapper.__init__cCs||j|<dSr!�r#)r%�key�valrrr�__setitem__gszFilterDictWrapper.__setitem__cCs|j|=dSr!r(�r%r)rrr�__delitem__j�zFilterDictWrapper.__delitem__cCs|j||jSr!r"r,rrr�__getitem__mszFilterDictWrapper.__getitem__cCs
t|j�Sr!)�lenr#�r%rrr�__len__ps
zFilterDictWrapper.__len__ccs.�|jD]}|�|j�r|�|jd�VqdS)N�)r#�endswithr$�replacer,rrr�__iter__ss�
��zFilterDictWrapper.__iter__N)
�__name__�
__module__�__qualname__�__doc__r'r+r-r/r2r6rrrrr \sr c@s<eZdZdZdd�Zedd��Zdd�Zdd	�Zd
d�Z	dS)
�
LoadedFunca�
    The functions loaded by LazyLoader instances using subscript notation
    'a[k]' will be wrapped with LoadedFunc.

      - Makes sure functions are called with the correct loader's context.
      - Provides access to a wrapped func's __global__ attribute

    :param func str: The function name to wrap
    :param LazyLoader loader: The loader instance to use in the context when the wrapped callable is called.
    cCs||_||_t�||j�dSr!)r�loader�	functools�update_wrapper�func)r%rr<rrrr'�szLoadedFunc.__init__cCs|jj|jSr!)r<r#rr1rrrr?�szLoadedFunc.funccCst|j|�Sr!)�getattrr?�r%rrrr�__getattr__�r.zLoadedFunc.__getattr__cOs�|j}tj|j}d}t|d�r*t|jtjj	j
�s*d|jjvr*|jjd|jd<d}|jjr6t
|jj�|�}|jj|g|�Ri|��}|rN|jd|jjd<|S)NF�__opts__�testT)r?rr
r8�hasattr�
isinstancerC�saltr<�context�NamedLoaderContext�opts�inject_globals�global_injector_decorator�run)r%�args�kwargsZrun_func�modZset_test�retrrr�__call__�s
zLoadedFunc.__call__cCsd|jj�d|j�d�S)N�<z name=�>)�	__class__r7rr1rrr�__repr__�szLoadedFunc.__repr__N)
r7r8r9r:r'�propertyr?rBrRrVrrrrr;ys
r;c@s,eZdZdZdZdd�Zdd�Zdd�Zd	S)
�	LoadedModz:
    This class is used as a proxy to a loaded module
    �rPr<cCs||_||_dS)zd
        Return the wrapped func's globals via this object's __globals__
        attribute.
        NrY)r%rPr<rrrr'�s
zLoadedMod.__init__cCs>z|j|j�d|��WStytd|�d|j����w)zC
        Run the wrapped function in the loader's context.
        r
zNo attribute by the name of z was found on )r<rP�KeyError�AttributeErrorrArrrrB�s��zLoadedMod.__getattr__cCsd�|jj|jj|j�S�Nz<{} module='{}.{}'>)rrUr7r<�loaded_base_namerPr1rrrrV�s�zLoadedMod.__repr__N)r7r8r9r:�	__slots__r'rBrVrrrrrX�srXcs�eZdZdZeZ													d4�fdd�	Zdd�Z�fd	d
�Zdd�Z	d
d�Z
dd�Zdd�Z�fdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd5d*d+�Zd,d-�Zd.d/�Zd0d1�Zed2d3��Z�ZS)6�
LazyLoadera�
    A pseduo-dictionary which has a set of keys which are the
    name of the module and function, delimited by a dot. When
    the value of the key is accessed, the function is then loaded
    from disk and into memory.

    .. note::

        Iterating over keys will cause all modules to be loaded.

    :param list module_dirs: A list of directories on disk to search for modules
    :param dict opts: The salt options dictionary.
    :param str tag: The tag for the type of module to load
    :param func mod_type_check: A function which can be used to verify files
    :param dict pack: A dictionary of function to be packed into modules as they are loaded
    :param list whitelist: A list of modules to whitelist
    :param bool virtual_enable: Whether or not to respect the __virtual__ function when loading modules.
    :param str virtual_funcs: The name of additional functions in the module to call to verify its functionality.
                                If not true, the module will not load.
    :param list extra_module_dirs: A list of directories that will be able to import from
    :param str pack_self: Pack this module into a variable by this name into modules loaded
    :returns: A LazyLoader object which functions as a dictionary. Keys are 'module.function' and values
    are function references themselves which are loaded on-demand.
    # TODO:
        - move modules_max_memory into here
        - singletons (per tag)
    NrTcs�d|_i|_|durin||_|jD]}t|j|tjjj�r)|j|��|j|<q|dur0i}t	�
|�}dD]}||vrOt||tjjj�rO||��||<q7|�d�}tjjj
|d�|_|�|�|_|
|_||_||_d|_|ptt|_|pyt|_||_d|jvr�d|jd<|j��D]\}}|dur�|j�|i�tjj�|j|�|j|<q�||_||_d|_i|_ t!�|_"t!�|_#|	r�|	ng|_$|dur�g}||_%|r�|ng|_&g|_'t!|j�d�(|j|jdd	kr�d
nd	�g��|_)i|_*d
g|_+t,D]\}}}|||f|j*|<|j+�-|�q�t.�/�|_0|j0�|�1�Wd�n	1�s$wYt2��3�t4|j�d��t4|j�d|���t4|j�d
��t4|j�d|���dS)zz
        In pack, if any of the values are None they will be replaced with an
        empty context-specific dict
        N)�pillar�grains�multiprocessing)Z
threadsafe�__context__Tzdisable_{}{}r�sr3z.intz.int.z.extz.ext.)5�
parent_loaderrK�packrFrGr<rHrI�value�copy�deepcopy�get�utilsZContextDict�context_dict�_LazyLoader__prep_mod_optsrJ�	pack_self�module_dirs�tagZ
_gc_finalizer�LOADED_BASE_NAMEr]r�mod_type_check�(_only_pack_properly_namespaced_functions�items�
setdefault�NamespacedDictWrapper�	whitelist�virtual_enable�initial_load�missing_modules�set�loaded_modules�loaded_files�static_modules�
virtual_funcs�extra_module_dirs�_clean_module_dirsr�disabled�
suffix_map�suffix_order�SUFFIXES�append�	threading�RLock�_lock�_refresh_file_mapping�superr'r)r%rorJrpr]rrrfrwrxr~�proxyrr�rnrs�iZthreadsafety�k�vr$�mode�kind�rUrrr'�s�
�

��

�


����

�
zLazyLoader.__init__cCs(ttj�D]}|�|j�rtj|=qdS)z
        Clean modules
        N)�listrr
rr]rArrr�
clean_modulesPs
��zLazyLoader.clean_modulescst��|�t||�S)z�
        Override the __getitem__ in order to decorate the returned function if we need
        to last-minute inject globals
        )r�r/r;)r%�itemr�rrr/Xs
zLazyLoader.__getitem__cCs�|dvr
t�||�Szt�||�WStyYnw||jvr=|js=|�|�D]}||jvr0q(|�|�r<||jvr<nq(||jvrGt	||�St|��)z�
        Allow for "direct" attribute access-- this allows jinja templates to
        access things like `salt.test.ping()`
        )�__getstate__�__setstate__)
�object�__getattribute__rBr[r|�loaded�_iter_filesr}�_load_modulerX)r%�mod_namerrrrrB`s"�
�

zLazyLoader.__getattr__cCsd�|jj|j|j�Sr\)rrUr7r]rpr1rrrrV{s�zLazyLoader.__repr__cCsr|�d�d}||jvrd|�d�Sz|j|}Wnty(d|�d�YSw|dur3d�||�Sd|�d�S)z�
        Return the error string for a missing function.

        This can range from "not available' to "__virtual__" returned False
        r
r�'z' is not available.Nz#'{}' __virtual__ returned False: {}z' __virtual__ returned False)rr|rzrZr)r%Z
function_namer��reasonrrr�missing_fun_string�s
��zLazyLoader.missing_fun_stringcs�|j�dd�dur8d|jvr8ztd�at��t�|jd<d|jvr(|j�d�Wnt	y7t
�d�Ynw|j�dd�durWd|jvrWt�|jd<d|jvrW|j�d�ddtf|jd<t
jj��|_g��fd	d
�}|jD�]V}ztdd�t�|�D��}Wn	ty�Yqqwzd
d�tt�tj�|d���D�}Wn	ty�Ynw|�|�|D�]}�z	tj�|�\}}|�d�r�Wq�tj�|�\}}	t�||�}zt�� ��!d��"dd�d�}
Wnt#t$t%fy�d}
Ynwz
|jd�&|
�}Wnt'�yt
�(d|
||
�YWq�w|	|jv�rWq�||j)v�r&t
�(d|�Wq�tj�||�}|	dk�rSt�|�}
|jD]}d|k�rC�q:d|��}||
v�rOn�q:Wq�z|j|d}|j|d}Wn
t'�ymYn=wd||	fv�r�||	k�r�t
�*d||j|d�|	dk�r�|dk�r�||k�r�Wq�n|�r�|j�&|	�|j�&|�k�r�Wq�|�s�|	dk�r�Wq�||	|f|j|<Wq�t�y�Yq�wqq|j+D]}|�d�d}|ddf|j|<�q�dS)z7
        refresh the mapping of the FS on disk
        Z
cython_enableT�.pyx�	pyximportz]Cython is enabled in the options but not present in the system path. Skipping Cython modules.Zenable_zip_modules�.zipr3cs��|�dS)a
            Hack so we can get the optimization level that we replaced (if
            any) out of the re.sub call below. We use a list here because
            it is a persistent data structure that we will be able to
            access after re.sub is called.
            r3)r�)�obj�Z	opt_matchrr�_replace_pre_ext�s
z:LazyLoader._refresh_file_mapping.<locals>._replace_pre_extcss�|]	}|dkr|VqdS)�__pycache__Nr��.0�xrrr�	<genexpr>�s�z3LazyLoader._refresh_file_mapping.<locals>.<genexpr>cSsg|]	}tj�d|��qS)r�)�os�path�joinr�rrr�
<listcomp>�s��z4LazyLoader._refresh_file_mapping.<locals>.<listcomp>r��_r�-rrZoptimization_orderz�Disallowed optimization level %d for module name '%s', skipping. Add %d to the 'optimization_order' config option if you do not want to ignore this optimization level.z,Skipping %s, it is disabled by configurationr'rz'Module/package collision: '%s' and '%s'z.pycr
�.oN),rJrjr��
__import__r��install�tupler�r��ImportError�log�info�MODULE_KIND_PKG_DIRECTORYrGrkZodict�OrderedDict�file_mappingro�sortedr��listdir�OSErrorr�r��extendrr�splitext�PY3_PRE_EXT�subr�pop�group�rsplitr[�
IndexError�
ValueError�indexrZ�tracer��errorr~)r%r�Zmod_dir�filesZ
pycache_files�filename�dirname�basenameZf_noextr�	opt_levelZ	opt_index�fpathZsubfilesr$Z	init_fileZcurr_extZcurr_opt_index�smodrr�rr��s�

���


�
��


"��
��





���
��
���
X�z LazyLoader._refresh_file_mappingcsd|j�%t���t�|_i|_t�|_t|d�r|��d|_	Wd�dS1s+wYdS)z 
        Clear the dict
        rJFN)
r�r��clearr{r}rzr|rEr�ryr1r�rrr�4s

"�zLazyLoader.clearcCs�d|jvr(|�di�}t|tjjj�r|��}||jd<tj	j�
|jd�|jd<d|jvrP|�di�}t|tjjj�r?|��}||jd<tj	j�
|jd�|jd<i}t|���D]
\}}|dkraqX|||<qXd|jvrp||jd<|S)z;
        Strip out of the opts any logger instance
        Z
__grains__raZ
__pillar__r`�loggerrC)
rfrjrFrGr<rHrIrgrlrkrvr�rt)r%rJrar`Zmod_optsr)r*rrrZ__prep_mod_optsCs0


�


�


zLazyLoader.__prep_mod_optsccsJ�||jvr	|V|jD]	}||vr|Vq|jD]	}||vr"|VqdS)zW
        Iterate over all file_mapping files in order of closeness to mod_name
        N)r�)r%r�r�rrrr�ds�

�
��zLazyLoader._iter_filescsJ�fdd�t��D�}|D]}|j��jd�r"t�|�|�|�q
dS)Nc3s,�|]}tt�|��j�rt�|�VqdSr!)rFr@rU)r�Zsname�rPrrr�ws��
�z0LazyLoader._reload_submodules.<locals>.<genexpr>r
)�dirr7r�	importlib�reload�_reload_submodules)r%rPZ
submodulesZ	submodulerr�rr�vs
�

��zLazyLoader._reload_submodulescCs2|jD]}|tjvrtj�|�|j�|�qdSr!)r�rr�r�r�)r%�	directoryrrrZ__populate_sys_path�s

��zLazyLoader.__populate_sys_pathcCspd}|jD]}|tjvrtj�|�d}qg|_t��|r4|jD]}|tjvr3tj|dur3tj|=q!dSdS)NFT)r�rr��remover��invalidate_cachesr��path_importer_cache)r%Zinvalidate_path_importer_cacher�rrrZ__clean_sys_path�s 

�

��zLazyLoader.__clean_sys_pathc/Cs�	d}|j|dd�\}}ztjj�d�\}}||vr+||vr+t�d|tjj�WdSWn	ty5Ynw|j�	|�t
j�|�}�z�z�|�
�tj�|�|dkr]t�||t���}n�|dkr�t|t�t�g�}|�d�}	t|	�dkrx|}n�|}|	dd�D]}
t||
�}q�n�|d	kr�t|��|�}n�|j|}zd�|j|�|�|j|f�}Wnty�d
�|j|�|�|j|�}Ynw|dk�rt j!j"t j!j#ft j!j$t j!j%ft j!j&t j!j'fg}
t j!j(|g|
�R�}|�)|�}|dur�t*��|j+��}|tj,|<|j-�s|�.|�n&t/|d||�}t j0j1|||d�}|du�r!t*��|�2|j+j�}|tj,|<Wn�t3�y7�t*�y|}z9d
t4|�v�rWd�|j|�}t�5|�||j6|<tj7d|j|dd�||j6|<WYd}~Wtj�8|�|�9�dSd}~wt:�y�}z!tj;d|j|dd�||j6|<WYd}~Wtj�8|�|�9�dSd}~wt<�y"}zmzt=�>t�?�d�d\}}}}Wn
t@�y�Yn1wt
j�ddd�t
j�ddd�t
j�ddd�g}|D]}|�A|��r�d|v�r�t�BtCjDjEjF��q�tj;d|j|dd�||j6|<WYd}~Wtj�8|�|�9�dSd}~wwWtj�8|�|�9�ntj�8|�|�9�wtCj+jG�H�}tI|d��rZtJ|jKtCj+jGjH��sYt�5d|�||_Kn||_KtI|d��r�tJ|jLtCj+jGjM��s�tI|d��sztN�O|jL�|_PtN�O|jP�|_L|jL�Q|jR�ntI|d��s�i|_PtN�O|jP�|_L|jL�Q|jR�|jS�T�D]N\}}|dk�r��q�t||d�}tI|d ��r�tN�O|jU�}nd}|�V||�}|du�r�tW|||��q�||k�r�t�7d!||�tW|||��q�tW|||��q�|jXdu�r@t||jXd�}tI|d ��rtN�O|jU�}nd}|�V|jX|�}|du�r$tW||jX|�n||k�r9t�7d!|jX|�tW||jX|�ntW||jX|�|jY�Zdd�d}t|d"d�} t[�\| ��r�z	|�2| |jR�Wn9t�yv}!zt�;|!�WYd}!~!n&d}!~!wt:�y�d#}"tj7d$|j||"dd�|"|j6|<|"|j6|<YdSw|j]�r�d%g|j^}#|#D]4}$|�_|||$�\}%}}&}'|&du�r�t�d$|j||&�|%du�r�||j6v�r�|&|j6|<|&|j6|<dS�q�nd&}'d'|jRv�r
|jd(v�r
tI|d)��r�|jRd'd*|j`v�r
d+|j`v�r
d,}"|"|j6|<|"|j6|<dSz|ja}(t�7d-|�Wn*t�yBz|jb}(t�7d.|�Wnt�y?tc|�}(t�7d/|�YnwYnw|gtd|'�})|(D]o}*|*�ed0��rV�qLt||*�}+t[�\|+��sjtJ|+tfjg��sj�qL|jh�rx|+ji�e|j��sx�qLt|d1i��j|*|*�},|)D]5}-z	d�|-|,f�}.Wnt�y�|-�d|,��}.Ynw|.|jkv�r�|+|jk|.<|�l|+|�|jm�	|-��q��qLztn�o|jk|j|�WdStp�y�}z
t�qd2|�WYd}~dSd}~ww)3Nrr�z)Trying to load %s on %s, returning False.Fr�r�r
rr�z{}.{}.{}.{}r3)r<zmagic numberztFailed to import {} {}. Bad magic number. If migrating from Python2 to Python3, remove all .pyc files and try again.zFailed to import %s %s:
T��exc_infozCFailed to import %s %s, this is due most likely to a syntax error:
rrGrkz
process.pyZcliz
daemons.pyzapi.pyZ_handle_signalsz3Failed to import %s %s as the module called exit()
�__salt_loader__zOverride  __salt_loader__: %srC�
__orig_opts__�defaultzOverride  %s: %sr'z__init__ failedzError loading %s.%s: %s�__virtual__rr�)rar��__proxyenabled__Z	proxytype�*z!not a proxy_minion enabled modulezTThe functions from module '%s' are being loaded from the provided __load__ attributezSThe functions from module '%s' are being loaded from the provided __all__ attributezMThe functions from module '%s' are being loaded by dir() on the loaded moduler�Z__func_alias__zBDepends.enforce_dependencies() failed for the following reason: %s)rr�r�implementation�	cache_tagrr�r�r[r}�addr�r�r��_LazyLoader__populate_sys_pathr�r��load_module�tempfileZ
gettempdirr��globals�localsr0r@rr�r�r]rrrp�	TypeErrorrr��	machinery�SourceFileLoader�SOURCE_SUFFIXES�SourcelessFileLoader�BYTECODE_SUFFIXES�ExtensionFileLoader�EXTENSION_SUFFIXES�
FileFinder�	find_specr�r<r
ryr��MODULE_KIND_MAP�util�spec_from_file_locationrMr�r�warningrz�debugr��_LazyLoader__clean_sys_path�	Exceptionr��
SystemExit�	traceback�
extract_tbr�r�r4�exitrG�defaultsZ	exitcodes�EX_OKrHZ
LoaderContextrErFr�rCrIrhrir��updaterJrfrtr��
named_context�setattrrnr7r��inspect�
isfunctionrxr�_process_virtualr�Z__load__�__all__r�r�rr=�partialrsr8rjr#�_apply_outputterr|rZenforce_dependencies�RuntimeErrorr�)/r%rrPr�r$Zimplementation_tagZ
cache_tag_verZ
fpath_dirnameZtop_mod�compsZsubname�descZ
mod_namespace�loader_detailsZfile_finder�specr<�excZ	error_msgr�Zfn_r�ZcallerZtgt_fnsZtgt_fnZloader_contextZp_nameZp_valueZmod_named_contextr�r�module_nameZmodule_init�eZ
err_stringZvirtual_funcs_to_process�virtual_funcZvirtual_retZvirtual_err�virtual_aliasesZ
funcs_to_loadZ	mod_names�attrr?�funcnameZtgt_modZ
full_funcnamerrrr��sP����
�
����
������



��

���


$���
��"����
���
�
��




��

��

�

��

������
��	�
�
����zLazyLoader._load_modulec	st�t�s	td��d�vrtd��d�����dd�\}}�j�c|�jvs+��jvr4	Wd�dS�jrI|�jvrIt�	d�|�j�t�����fd	d
�}d}d}	z||�}|sh|durh��
�d}WqTWntyz|sx��
�d}YqTwWd�|S1s�wY|S)z3
        Load a single item if you have it
        zThe key must be a string.r
z	The key 'z' should contain a '.'rNTzNFailed to load function %s because its module (%s) is not in the whitelist: %scs:��|�D]}|�jvr
q��|�r��jvrdSqdS)NTF)r�r}r�r#)r�r�r)r%rr�_inner_load%s
�z%LazyLoader._load.<locals>._inner_loadF)rFrrZrr�rzr#rwr�r�r�r�)r%r)r�r�rrQZreloadedrrr�_loadsN
��
��
�,�,zLazyLoader._loadcCs^|j�"|jD]}||jvs||jvrq|�|�qd|_Wd�dS1s(wYdS)z"
        Load all of them
        TN)r�r�r}rzr�r�rArrr�	_load_allCs
"�zLazyLoader._load_allcCs<|j�t�|_|��Wd�dS1swYdSr!)r�r{r}rr1rrr�reload_modulesOs
"�zLazyLoader.reload_modulescCs2t|d�r|j}|j|vr||j|_dSdSdS)zC
        Apply the __outputter__ variable to the functions
        �
__outputter__N)rErr7)r%r?rPZoutprrrrTs

�zLazyLoader._apply_outputterr�c

Cs�t|dt��}z�d}t|d�r�t�|j�r�z5t��}t||�}|�|�}t|t�r1|d}|d}|j	�
dd�rIt��|}	d�|	|�}
t�
|
�Wn#tym}zd	�|j|�}tj|tjd
�d}WYd}~nd}~wwt|d|�}|s�|dur�t�
d|j|�d|||fWS|d
ur�||kr�t�d||�||kr�t�d|j||�|}n|d
ur�||kr�|d
ur�|}Wn)ty�tjd|d
d�Ynty�tjd|j|d
d�d|||fYSwd
|d|fS)a"
        Given a loaded module and its default name determine its virtual name

        This function returns a tuple. The first value will be either True or
        False and will indicate if the module should be loaded or not (i.e. if
        it threw and exception while processing its __virtual__ function). The
        second value is the determined virtual name, which may be the same as
        the value provided.

        The default name can be calculated as follows::

            module_name = mod.__name__.rsplit('.', 1)[-1]
        Z__virtual_aliases__Nr�rrZ
virtual_timerFz'Virtual function took {} seconds for {}z[Exception raised when processing __virtual__ function for {}. Module will not be loaded: {})Zexc_info_on_loglevelZ__virtualname__z�%s.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module '%s', please fix this.TzLoaded %s as virtual %sz�The module '%s' is showing some bad usage. Its __virtualname__ attribute is set to '%s' yet the __virtual__() function is returning '%s'. These values should match!zKeyError when loading %sr�z.Failed to read the virtual function for %s: %s)r@r�rErrr��timerMrFrJrjrr�r�r�r7r��logging�DEBUGr�rZr�rp)
r%rPrrrZerror_reason�startZvirtual_attrZvirtual�end�msgrZvirtualnamerrrr	]s~


�
�����
�	�
���zLazyLoader._process_virtualcOs(t��|_|jj|j|g|�Ri|��S)zD
        Run the `_func_or_method` in this loader's context
        )�contextvarsZcopy_contextZ
_last_contextrM�_run_as)r%�_func_or_methodrNrOrrrrM�s
zLazyLoader.runc	Os�d|_z	tjjj��}Wntyd}Ynw||ur||_tjjj�|�}z!||i|��}t|tjjj	�r;|�
�}|Wd|_tjjj�|�Sd|_tjjj�|�w)zL
        Handle setting up the context properly and call the method
        N)rerGr<rHZ
loader_ctxvarrj�LookupErrorr{rFrIrg�reset)r%r'rNrOZcurrent_loader�tokenrQrrrr&�s$��zLazyLoader._run_ascOs0||g}|�|�tj|j||d�}|��|S)zR
        Run the function in a new thread with the context of this loader
        )�targetrNrO)r�r��Threadr+r")r%r'rNrOZargslist�threadrrr�
run_in_thread�s

zLazyLoader.run_in_threadcOs|j|g|�Ri|��dSr!)rM)r<r'rNrOrrrr+�szLazyLoader.target)
NrNNNNTNNNNNT)r�)r7r8r9r:�dictZmod_dict_classr'r�r/rBrVr�r�r�rmr�r�r�r�r�rrrrr	rMr&r.�staticmethodr+�
__classcell__rrr�rr_�sV�i!k8
	{
r_cs�fdd�}|S)z�
    Decorator used by the LazyLoader to inject globals into a function at
    execute time.

    globals
        Dictionary with global variables to inject
    cst�����fdd��}|S)NcsHtjjj�fi�����|i|��Wd�S1swYdSr!)rGrkrHZfunc_globals_inject)rNrO)�frKrr�wrapper
s$�zCglobal_injector_decorator.<locals>.inner_decorator.<locals>.wrapper)r=�wraps)r2r3�rK)r2r�inner_decoratorsz2global_injector_decorator.<locals>.inner_decoratorr)rKr6rr5rrLs	rL)Qrhr=r�Zimportlib.machinery�importlib.utilrr r��pathlib�rerr�r�rr�r�collections.abcrZ	zipimportrZsalt.configrGZsalt.defaults.eventsZsalt.defaults.exitcodesZsalt.loader.contextZ
salt.syspathsZsalt.utils.argsZsalt.utils.contextZsalt.utils.dataZsalt.utils.dictupdateZsalt.utils.eventZsalt.utils.filesZsalt.utils.lazyZsalt.utils.odictZsalt.utils.platformZsalt.utils.stringutilsZsalt.utils.versionsZsalt.utils.decoratorsrZ_contextvarsr%r��	getLoggerr7r�ZMODULE_KIND_SOURCEZMODULE_KIND_COMPILEDZMODULE_KIND_EXTENSIONr�r�r�r�r$r�r�r�r�r�r�r��PathZsyspathsZINSTALL_DIR�resolverrq�compiler�version_infor�r�rrr r;rXrkZlazyZLazyDictr_rLrrrr�<module>s��
�/ C