HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //proc/self/root/lib64/python3.6/site-packages/ldap/__pycache__/functions.cpython-36.opt-1.pyc
3

�`aR
�
@s�dZddlmZddddddd	d
ddg
Zdd
lZdd
lZdd
lZdd
lZdd
lZddlm	Z	ddlm
Z
ddlmZm
Z
ddlmZdZdd�Zdejd
d
d
fdd�Zdd�Zdd	�Zdd
�Zdd�Zdd�Zd
S)z_
functions.py - wraps functions of module _ldap

See https://www.python-ldap.org/ for details.
�)�__version__�open�
initializeZinit�
explode_dn�explode_rdn�
get_option�
set_option�
escape_str�	strf_secs�	strp_secsN)�timegm)�	LDAPError)rr)�
LDAPObjectTcOs�|r|j�y"z|||�}Wd|r*|j�XWnFtk
rt}z*drbtjdkrbtjjdt|���WYdd}~XnXdr�tjdkr�tjjdtj	|��|S)z�
  Wrapper function which locks and logs calls to function

  lock
      Instance of threading.Lock or compatible
  func
      Function to call with arguments passed in via *args and **kwargs
  NF�z=> LDAPError: %s
z=> result:
%s
)
�acquire�releaser
�ldapZ_trace_levelZ_trace_file�write�str�pprintZpformat)�lock�func�args�kwargs�result�e�r�!/usr/lib64/python3.6/functions.py�_ldap_function_call"s		rcKst|||||fd|i|��S)a�
  Return LDAPObject instance by opening LDAP connection to
  LDAP host specified by LDAP URL

  Parameters:
  uri
        LDAP URL containing at least connection scheme and hostport,
        e.g. ldap://localhost:389
  trace_level
        If non-zero a trace output of LDAP calls is generated.
  trace_file
        File object where to write the trace output to.
        Default is to use stdout.
  bytes_mode
        Whether to enable :ref:`bytes_mode` for backwards compatibility under Py2.
  fileno
        If not None the socket file descriptor is used to connect to an
        LDAP server.

  Additional keyword arguments (such as ``bytes_strictness``) are
  passed to ``LDAPObject``.
  �fileno)r)ZuriZtrace_levelZ
trace_fileZtrace_stack_limitZ
bytes_moderrrrrrDscCstdtj|�S)zJ
  get_option(name) -> value

  Get the value of an LDAP global option.
  N)r�_ldapr)�optionrrrrdscCstdtj||�S)zH
  set_option(name, value)

  Set the value of an LDAP global option.
  N)rr r)r!Zinvaluerrrrmscs|t�fdd�|D��S)ze
  Applies escape_func() to all items of `args' and returns a string based
  on format string `s'.
  c3s|]}�|�VqdS)Nr)�.0�v)�escape_funcrr�	<genexpr>{szescape_str.<locals>.<genexpr>)�tuple)r$�srr)r$rr	vscCstjdtj|��S)zZ
    Convert seconds since epoch to a string compliant to LDAP syntax GeneralizedTime
    z
%Y%m%d%H%M%SZ)�timeZstrftimeZgmtime)Zsecsrrrr
~scCsttj|d��S)zD
    Convert LDAP syntax GeneralizedTime to seconds since epoch
    z
%Y%m%d%H%M%SZ)rr(Zstrptime)Zdt_strrrrr�s)�__doc__rr�__all__�sysrr(r Zcalendarrr
Zldap.dnrrZldap.ldapobjectrZ_LDAP_WARN_SKIP_FRAMEr�stdoutrrrr	r
rrrrr�<module>s((#