File: //usr/lib/python3/dist-packages/landscape/lib/__pycache__/persist.cpython-310.pyc
o
y)�]R � @ s� d dl Z d dlZd dlZd dlZd dlmZ g d�Ze� ZG dd� de �Z
G dd� de
�ZG dd � d e�ZG d
d� de�Z
e�d�jZd
d� Zdd� ZG dd� de�ZG dd� de�ZG dd� de�ZdS )� N)�
StringType)�Persist�
PickleBackend�BPickleBackend�path_string_to_tuple�path_tuple_to_string�
RootedPersist�PersistError�PersistReadOnlyErrorc @ � e Zd ZdS )r N��__name__�
__module__�__qualname__� r r �7/usr/lib/python3/dist-packages/landscape/lib/persist.pyr % � r c @ r )r
Nr r r r r r
) r r
c @ s� e Zd ZdZd(dd�Zdd� Zdd� Zd d
� Zeee�Z ee�Z
dd� Zd
d� Zdd� Z
d)dd�Zeefdd�Zd*dd�Zedddfdd�Zd*dd�Zd+dd�Zd,dd�Zd*d d!�Zeddfd"d#�Zd,d$d%�Zd&d'� ZdS )-r a Persist a hierarchical database of key=>value pairs.
There are three different kinds of option maps, regarding the
persistence and priority that maps are queried.
- hard - Options are persistent.
- soft - Options are not persistent, and have a higher priority
than persistent options.
- weak - Options are not persistent, and have a lower priority
than persistent options.
@ivar filename: The name of the file where persist data is saved
or None if no filename is available.
Nc C sl |du rt � }|| _|�� | _i | _i | _d| _d| _| | _|| _ |dur2t
j�|�r4| �
|� dS dS dS )a�
@param backend: The backend to use. If none is specified,
L{BPickleBackend} will be used.
@param filename: The default filename to save to and load from. If
specified, and the file exists, it will be immediately
loaded. Specifying this will also allow L{save} to be called
without any arguments to save the persist.
NF)r �_backend�new�_hardmap�_softmap�_weakmap� _readonly� _modified�_config�filename�os�path�exists�load)�self�backendr r r r �__init__? s
�zPersist.__init__c C � | j S �N)r �r r r r �
_get_readonlyU � zPersist._get_readonlyc C s t |�| _d S r$ )�boolr )r �flagr r r �
_set_readonlyX � zPersist._set_readonlyc C r# r$ �r r% r r r �
_get_modified[ r'