Current File : //usr/lib/python3/dist-packages/__pycache__/augeas.cpython-312.pyc |
�
�XT\ � � � d Z dZdZddlZddlZddlZddlmZ ddl m
Z
edk\ ZdZere
ZneZd � Zd
� Zd� Z G d� d
e� Z G d� de� Zy)a� Pure python bindings for the augeas library
Augeas is a library for programmatically editing configuration files.
Augeas parses configuration files into a tree structure, which it exposes
through its public API. Changes made through the API are written back to
the initially read files.
The transformation works very hard to preserve comments and formatting
details. It is controlled by ``lens'' definitions that describe the file
format and the transformation into a tree.
z/Nathaniel McCallum <nathaniel@natemccallum.com>z�Jeff Schroeder <jeffschroeder@computer.org>
Harald Hoyer <harald@redhat.com> - initial python bindings, packaging
Nils Philippsen <nils@redhat.com>
� N)�version_info)�reduce)� �utf8c �2 � | r| j t � S y �N)�encode�AUGENC��sts �(/usr/lib/python3/dist-packages/augeas.py�encr : � � � ��y�y�� � �
� c �2 � | r| j t � S y r )�decoder
r s r
�decr ? r r c �� � | D �cg c]! }t j j |� ��# c}D �cg c] }|s�|�� }}t d� |d� }|st d| d z � �|S c c}w c c}w )z]Search for one of the libraries given as arguments and load it.
Returns the library.
c �H � | xs t j j |� S r )�ctypes�cdll�LoadLibrary)�x�ys r
�<lambda>z_dlopen.<locals>.<lambda>I s � �q�>�F�K�K�$;�$;�A�$>� r NzUnable to import lib%s!r )r �util�find_libraryr �ImportError)�args�a�l�libs�libs r
�_dlopenr$ D si � � ?C�D�����1�1�!�4�D�J�!��A�J�D�J��>��d�K�C���3�d�1�g�=�>�>��J�� E��Js �&A!�A&�A&c � � e Zd ZdZ ed� Zej ej _ dZ
dZdZdZ
dZdZd Zd
ZdZdde
fd
�Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd#d�Zd� Z d� Z!d� Z"d� Z#d� Z$d� Z%d$d �Z&d%d!�Z'd"� Z(y)&�Augeasz$Class wrapper for the augeas library�augeasr � � � � � � �@ � Nc � � t |t � s|dk7 rt d� �t |t � s|dk7 rt d� �t |t � st d� �t j
j
t |� t |� |� | _ | j st d� �t j | j � | _ y)a� Initialize the library.
Use 'root' as the filesystem root. If 'root' is None, use the value of
the environment variable AUGEAS_ROOT. If that doesn't exist either,
use "/".
'loadpath' is a colon-spearated list of directories that modules
should be searched in. This is in addition to the standard load path
and the directories in AUGEAS_LENS_LIB.
'flags' is a bitmask made up of values from AUG_FLAGS.Nzroot MUST be a string or None!z"loadpath MUST be a string or None!zflag MUST be a flag!zUnable to create Augeas object!)�
isinstance�string_types� TypeError�intr&