Current File : //kunden/lib64/python3.9/site-packages/gpg/__pycache__/core.cpython-39.pyc |
a
�x�_�� � @ s d dl mZmZmZ d dlZd dlZd dlZd dlZddlm Z ddl
mZmZ ddlm
Z
ddlm
Z
ddlmZ [[[G d d
� d
e�ZG dd� de�ZG d
d� de�Zdd� Zdd� Zdd� Zdd� Zdd� Zd%dd�Ze� dd� Zdd� Zd&dd �Zd!d"� Zd#d$� ZdS )'� )�absolute_import�print_function�unicode_literalsN� )�gpgme)�
errorcheck�
GPGMEError)� constants)�errors)�utilc s� e Zd ZdZdd� Z� fdd�Zdd� Zdd � Zd
d� Ze dd
� �Z
e dd� �Zdd� Ze
� Zddd�Ze�d�Zdd� Z� fdd�Z� ZS )�GpgmeWrapperz>Base wrapper class
Not to be instantiated directly.
c C s d | _ || _d S �N)�_callback_excinfo�wrapped)�selfr � r �./usr/lib64/python3.9/site-packages/gpg/core.py�__init__3 s zGpgmeWrapper.__init__c s d� tt| ��� | j�S )Nz <{}/{!r}>)�format�superr �__repr__r �r �� __class__r r r 7 s �zGpgmeWrapper.__repr__c sP d� t� jj�g}� fdd�� jD �}|r@|�d� d�|��� d� d�|��S )Nz{}.{}c s g | ]}t � |�r|�qS r )�getattr��.0�fr r r �
<listcomp>= � z(GpgmeWrapper.__str__.<locals>.<listcomp>z({})� z<{}>)r �__name__r �_boolean_properties�append�join)r Zacc�flagsr r r �__str__; s
zGpgmeWrapper.__str__c C s t t| j��S r
)�hash�reprr r r r r �__hash__C s zGpgmeWrapper.__hash__c C s$ |d u rdS t | j�t |j�kS d S )NF)r( r )r �otherr r r �__eq__F s zGpgmeWrapper.__eq__c C s
t � �dS )z]The name of the c type wrapped by this class
Must be set by child classes.
N��NotImplementedErrorr r r r �_ctypeL s zGpgmeWrapper._ctypec C s
t � �dS )zgThe common prefix of c functions wrapped by this class
Must be set by child classes.
Nr, r r r r �_cprefixU s zGpgmeWrapper._cprefixc C s
t � �dS )z�Must be implemented by child classes.
This function must return a trueish value for all c functions
returning gpgme_error_t.Nr, �r �namer r r �_errorcheck^ s zGpgmeWrapper._errorcheckFNc s� t td�| j|��� t td�| j|���� fdd�}�fdd�}t||d�|�d�}t| j||� |rv|| t|�� n|| �S d S ) Nz{}get_{}z{}set_{}c s t � | j��S r
)�boolr )�slf)�get_funcr r �getl s z1GpgmeWrapper.__wrap_boolean_property.<locals>.getc s � | j t|�� d S r
)r r3 )r4 �value)�set_funcr r �set_o s z2GpgmeWrapper.__wrap_boolean_property.<locals>.set_z{} flag)�doc)r r r r/ �property�setattrr r3 )r �keyZdo_setr7 r6 r9 �pr )r5 r8 r Z__wrap_boolean_propertyh s z$GpgmeWrapper.__wrap_boolean_propertyz$gpgme_([^(]*)\(([^,]*), (.*\) -> .*)c s� |d dks�j du rdS |�jv r.��|�S �j | �tt�������r\��fdd�� n�fdd�� t�d�}|r��j�d|�}nd}|� _t �j
|� � � �fd d
�}||_|S )z7On-the-fly generation of wrapper methods and propertiesr �_Nc s, � | j g|�R � }| jr"t�| � t|��S r
)r r r �gpg_raise_callback_exceptionr �r4 �args�result)�funcr1 r r � _funcwrap� s
z+GpgmeWrapper.__getattr__.<locals>._funcwrapc s&