File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/__pycache__/lazy.cpython-310.pyc
o
�N�g5 � @ sF d Z ddlZddlmZ ddlZe�e�Zdd� Z G dd� de�Z
dS )zC
Lazily-evaluated data structures, primarily used by Salt's loader
� N)�MutableMappingc C s. |st j�d��|| vrt j�| �|���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 ��r c @ sx e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� Zdd
� Z dd� Z
dd� Zdd� Zdd� 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
c C s | � � d S �N)�clear��selfr r r �__init__# � zLazyDict.__init__c C s t | jp| j �S r
)�bool�_dict�loadedr r r r �__nonzero__&