
    =OOfw                     b    d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	m
Z
mZmZmZ  G d de      Zy	)

    )linesep   )SEQUENCE_TYPES)LDAPKeyError)loglog_enabledERRORBASICPROTOCOLEXTENDEDc            
       P    e Zd ZdZddddedddddf
dZd Zd Zd Zd Z	d	 Z
d
 Zy)AttrDefaq  Hold the definition of an attribute

    :param name: the real attribute name
    :type name: string
    :param key: the friendly name to use in queries and when accessing the attribute, default to the real attribute name
    :type key: string
    :param validate: called to check if the value in the query is valid, the callable is called with the value parameter
    :type validate: callable
    :param pre_query: called to transform values returned by search
    :type pre_query: callable
    :param post_query: called to transform values returned by search
    :type post_query: callable
    :param default: value returned when the attribute is absent (defaults to NotImplemented to allow use of None as default)
    :type default: string, integer
    :param dereference_dn: reference to an ObjectDef instance. When the attribute value contains a dn it will be searched and substituted in the entry
    :type dereference_dn: ObjectDef
    :param description: custom attribute description
    :type description: string
    :param mandatory: specify if attribute is defined as mandatory in LDAP schema
    :type mandatory: boolean
    NFc                    || _         |rdj                  |j                               n|| _        || _        || _        || _        || _        || _        || _	        |	| _
        |
| _        d | _        |sd | _        n2t        |t              rt!        |      | _        nt!        |g      | _        t#        t$              rt'        t$        d|        y y )N zinstantiated AttrDef: <%r>)namejoinsplitkeyvalidate	pre_query
post_querydefaultdereference_dndescription	mandatorysingle_valueoid_infoother_names
isinstancer   setr	   r   r   )selfr   r   r   r   r   r   r   r   r   r   aliass               W/var/www/premiumrankchecker/venv/lib/python3.12/site-packages/ldap3/abstract/attrDef.py__init__zAttrDef.__init__9   s    	+.277399;'D "$,&"(#D~.!%j "E7|Du3T:     c                 6   | j                   r5ddj                  | j                  gt        | j                         z         z   n| j                  }|| j                  | j                  k(  rdnd| j                  z   dz   z  }|| j
                  t        u rdndt        | j
                        z   z  }|| j                  dndt        | j                        z   z  }|| j                  dndt        | j                        z   z  }|| j                  sdnd	t        | j                        z   z  }|| j                  sdnd
t        | j                        z   z  }| j                  r<t        | j                        j                  t              D ]  }|t        dz   |z   z  } |S )NzATTR: z, r   z []z - default: z - mandatory: z - single_value: z - dereference_dn: z - description: z  )r   r   r   listr   r   NotImplementedstrr   r   r   r   r   r   r   )r"   rlines      r$   __repr__zAttrDef.__repr__P   sb   IMIYIYHtyy$((d43C3C.D!DEE_c_g_g	499(RdTYY.>.DD	4<<>1R~DLLHY7YY	4>>)R/?#dnnBU/UU	4$$,R2EDL]L]H^2^^	t**R0EDL_L_H`0``	t''R-?#dFVFVBW-WW==DMM*009 +Wt^d**+r&   c                 "    | j                         S N)r.   r"   s    r$   __str__zAttrDef.__str__]   s    }}r&   c                 V    t        |t              r| j                  |j                  k(  S yNFr    r   r   r"   others     r$   __eq__zAttrDef.__eq__`   s"    eW%88uyy((r&   c                 V    t        |t              r| j                  |j                  k  S yr4   r5   r6   s     r$   __lt__zAttrDef.__lt__f   s"    eW%88eii''r&   c                 Z    | j                   rt        | j                         S t        |       S r0   )r   hashidr1   s    r$   __hash__zAttrDef.__hash__l   s     88>!d8Or&   c                     t        | d      r6|dk(  r1d|z  }t        t              rt        t        d||        t	        |      t
        j                  | ||       y )Nr   zkey '%s' already setz%s for <%s>)hasattrr	   r
   r   r   object__setattr__)r"   r   valueerror_messages       r$   rB   zAttrDef.__setattr__r   sO    4C5L4s:M5!E=->}--tS%0r&   )__name__
__module____qualname____doc__r*   r%   r.   r2   r8   r:   r>   rB    r&   r$   r   r   "   s\    , "&QU_m  C  QU  af  uy  AE ;.1r&   r   N)rH   osr   r   r   core.exceptionsr   	utils.logr   r	   r
   r   r   r   rA   r   rI   r&   r$   <module>rM      s)   4   * J JW1f W1r&   