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/utils/__pycache__/lazy.cpython-310.pyc
o

�N�g5�@sFdZddlZddlmZddlZe�e�Zdd�Z	Gdd�de�Z
dS)zC
Lazily-evaluated data structures, primarily used by Salt's loader
�N)�MutableMappingcCs.|stj�d��||vrtj�|�|���dS)z6
    Check that the function passed really exists
    z-Must specify a function to run!
ex: manage.upN)�salt�
exceptionsZSaltInvocationErrorZCommandExecutionError�missing_fun_string)Zlazy_objZfun�r�C/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/lazy.py�
verify_fun
s��rc@sxeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�LazyDicta
    A base class of dict which will lazily load keys once they are needed

    TODO: negative caching? If you ask for 'foo' and it doesn't exist it will
    look EVERY time unless someone calls load_all()
    As of now this is left to the class which inherits from this base
    cCs|��dS�N)�clear��selfrrr�__init__#�zLazyDict.__init__cCst|jp|j�Sr
)�bool�_dict�loadedrrrr�__nonzero__&szLazyDict.__nonzero__cCs|��Sr
)rrrrr�__bool__*szLazyDict.__bool__cCst|dt��|_d|_dS)z 
        Clear the dict
        Zmod_dict_classFN)�getattr�dictrrrrrrr.s
zLazyDict.clearcC�t��)z3
        Load a single item if you have it
        ��NotImplementedError�r
�keyrrr�_load8�zLazyDict._loadcCr)z"
        Load all of them
        rrrrr�	_load_all>rzLazyDict._load_allcCsdS)zT
        Whether or not the key is missing (meaning we know it's not there)
        Frrrrr�_missingDszLazyDict._missingcCsd|�d�S)z�
        Return the error string for a missing function.

        Override this to return a more meaningfull error message if possible
        �'z' is not available.r)r
Z
function_namerrrrJszLazyDict.missing_fun_stringcCs||j|<dSr
�r)r
r�valrrr�__setitem__RszLazyDict.__setitem__cCs|j|=dSr
r!rrrr�__delitem__UrzLazyDict.__delitem__cCsh|�|�r	t|��||jvr/|js/|�|�r!t�d|�|j|St�d||�|��t|��|j|S)z?
        Check if the key is ttld out, then do the get
        z
LazyLoaded %szCould not LazyLoad %s: %s)r�KeyErrorrrr�log�debugrrrrr�__getitem__Xs


�
zLazyDict.__getitem__cC�|js|��t|j�Sr
)rr�lenrrrrr�__len__ls
zLazyDict.__len__cCr)r
)rr�iterrrrrr�__iter__rs
zLazyDict.__iter__N)�__name__�
__module__�__qualname__�__doc__rrrrrrrrr#r$r(r+r-rrrrr	s
r	)r1�logging�collections.abcrZsalt.exceptionsr�	getLoggerr.r&rr	rrrr�<module>s