a
x_ @ s d dl mZmZmZ d dlZd dlZd dlZd dlZddlm Z ddl
mZmZ ddlm
Z
ddlm
Z
ddlmZ [[[G d d
d
eZG dd deZG d
d deZdd Zdd Zdd Zdd Zdd Zd%ddZe dd Zdd Zd&dd Zd!d" Zd#d$ ZdS )' )absolute_importprint_functionunicode_literalsN )gpgme)
errorcheck
GPGMEError) constants)errors)utilc s e Zd ZdZdd Z fddZdd Zdd Zd
d Ze dd
Z
e dd Zdd Ze
ZdddZedZdd Z fddZ ZS )GpgmeWrapperz>Base wrapper class
Not to be instantiated directly.
c C s d | _ || _d S N)_callback_excinfowrapped)selfr r ./usr/lib64/python3.9/site-packages/gpg/core.py__init__3 s zGpgmeWrapper.__init__c s d tt| | jS )Nz <{}/{!r}>)formatsuperr __repr__r r __class__r r r 7 s zGpgmeWrapper.__repr__c sP d t jjg} fdd jD }|r@|d d| d d|S )Nz{}.{}c s g | ]}t |r|qS r )getattr.0fr r r
= z(GpgmeWrapper.__str__..z({}) z<{}>)r __name__r _boolean_propertiesappendjoin)r Zaccflagsr r r __str__; s
zGpgmeWrapper.__str__c C s t t| jS r
)hashreprr r r r r __hash__C s zGpgmeWrapper.__hash__c C s$ |d u rdS t | jt |jkS 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.
NNotImplementedErrorr 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 )zMust 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 | jS r
)boolr )slf)get_funcr r getl s z1GpgmeWrapper.__wrap_boolean_property..getc s | j t| d S r
)r r3 )r4 value)set_funcr r set_o s z2GpgmeWrapper.__wrap_boolean_property..set_z{} flag)doc)r r r r/ propertysetattrr r3 )r keyZdo_setr7 r6 r9 pr )r5 r8 r Z__wrap_boolean_propertyh s z$GpgmeWrapper.__wrap_boolean_propertyz$gpgme_([^(]*)\(([^,]*), (.*\) -> .*)c s |d dksj du rdS |jv r.|S j | ttr\fdd nfdd td}|rjd|}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 argsresult)funcr1 r r _funcwrap s
z+GpgmeWrapper.__getattr__.._funcwrapc s&