File: //proc/self/root/lib64/python3.9/site-packages/ldap/__pycache__/asyncsearch.cpython-39.pyc
a
�.d� � @ s� d Z ddlZddlmZ ddlZejejejhZejejhZG dd� de �Z
G dd� d�ZG dd � d e�ZG d
d� de�Z
G dd
� d
e
�ZG dd� de�ZG dd� de�ZdS )zg
ldap.asyncsearch - handle async LDAP search operations
See https://www.python-ldap.org/ for details.
� N)�__version__c @ s e Zd Zdd� Zdd� ZdS )�WrongResultTypec C s || _ || _t�| � d S �N)�receivedResultType�expectedResultTypes� Exception�__init__)�selfr r � r
�6/usr/lib64/python3.9/site-packages/ldap/asyncsearch.pyr s zWrongResultType.__init__c C s d� | jd�| j��S )Nz3Received wrong result type {} (expected one of {}).z, )�formatr �joinr �r r
r
r �__str__ s
�zWrongResultType.__str__N)�__name__�
__module__�__qualname__r r r
r
r
r r s r c @ sL e Zd ZdZdd� Zddd�Zd d
� Zdd� Zd
d� Zddd�Z dd� Z
dS )�AsyncSearchHandlerz`
Class for stream-processing LDAP search results
Arguments:
l
LDAPObject instance
c C s || _ d | _d| _d S )N� )�_l�_msgId�_afterFirstResult�r �lr
r
r r 1 s zAsyncSearchHandler.__init__Nr ���c
C s( | j �||||||| ||� | _d| _dS )a�
searchRoot
See parameter base of method LDAPObject.search()
searchScope
See parameter scope of method LDAPObject.search()
filterStr
See parameter filter of method LDAPObject.search()
attrList=None
See parameter attrlist of method LDAPObject.search()
attrsOnly
See parameter attrsonly of method LDAPObject.search()
timeout
Maximum time the server shall use for search operation
sizelimit
Maximum number of entries a server should return
(request client-side limit)
serverctrls
list of server-side LDAP controls
clientctrls
list of client-side LDAP controls
r N)r Z
search_extr r )
r Z
searchRootZsearchScopeZ filterStrZattrListZ attrsOnly�timeoutZ sizelimitZserverctrlsZclientctrlsr
r
r �startSearch6 s !�zAsyncSearchHandler.startSearchc C s dS )zd
Do anything you want after starting search but
before receiving and processing results
Nr
r r
r
r �
preProcessing^ s z AsyncSearchHandler.preProcessingc C s dS )zh
Do anything you want right after successfully receiving but before
processing first result
Nr
r r
r
r �afterFirstResultd s z#AsyncSearchHandler.afterFirstResultc C s dS )zI
Do anything you want after receiving and processing all results
Nr
r r
r
r �postProcessingj s z!AsyncSearchHandler.postProcessingc
C s> | � � d}|| }d}d}d| _|| _z�d\}} |r�|du rr| sr| j�| jd|�\}} }
}| jr6| �� d| _q6| sxq�|tvr�t |t��| D ]L}||k r�| jd | _n*|dks�||k r�| �
||� nd}d} q�|d }q�d\}} || _q2W |�r2| jdk�r2| j�| j� n"|�r0| jdk�r0| j�| j� 0 | �� |S )a1
ignoreResultsNumber
Don't process the first ignoreResultsNumber results.
processResultsCount
If non-zero this parameters indicates the number of results
processed is limited to processResultsCount.
timeout
See parameter timeout of ldap.LDAPObject.result()
r r )NNN)
r ZbeginResultsDroppedZendResultBreakr Zresult3r r r �SEARCH_RESULT_TYPESr �_processSingleResultZabandonr )
r ZignoreResultsNumberZprocessResultsCountr Zresult_counterZend_result_counterZgo_ahead�partialZresult_typeZresult_listZresult_msgidZresult_serverctrlsZresult_itemr
r
r �processResultso sH
�z!AsyncSearchHandler.processResultsc C s dS )zv
Process single entry
resultType
result type
resultItem
Single item of a result list
Nr
�r �
resultType�
resultItemr
r
r r! � s z'AsyncSearchHandler._processSingleResult)Nr r r NN)r r r )r r r �__doc__r r r r r r# r! r
r
r
r r '