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: //lib64/python3.6/site-packages/gssapi/__pycache__/_utils.cpython-36.pyc
3

�O[C�@s�ddlZddlZddlZddlZddlmZdd�Zdd�Zddd�Z	d	a
d
d�Zdd
�Zdd�Z
ejdd��Zejdd��ZGdd�de�ZdS)�N)�GSSErrorcCs6ydj|�}t|�tj|Stk
r0dSXdS)aaImport a GSSAPI extension module

    This method imports a GSSAPI extension module based
    on the name of the extension (not including the
    'ext_' prefix).  If the extension is not available,
    the method retuns None.

    Args:
        name (str): the name of the extension

    Returns:
        module: Either the extension module or None
    zgssapi.raw.ext_{0}N)�format�
__import__�sys�modules�ImportError)�name�path�r
�/usr/lib64/python3.6/_utils.py�import_gssapi_extension
s

rcs"�fdd�}�fdd�}t||�S)Ncs"|r|jj��n|jj��dS)N)�flags�add�discard)�self�val)�flagr
r�setter"szflag_property.<locals>.settercs
�|jkS)N)r
)r)rr
r�getter(szflag_property.<locals>.getter)�property)rrrr
)rr�
flag_property!srcs�fdd�}t||d�S)a<Creates a property based on an inquire result

    This method creates a property that calls the
    :python:`_inquire` method, and return the value of the
    requested information.

    Args:
        name (str): the name of the 'inquire' result information

    Returns:
        property: the created property
    cs(|jsd}t|��t|jf�di���S)NzUCannot read {0} from a security context whose establishment has not yet been started.T)Z_started�AttributeError�getattrZ_inquire)r�msg)rr
r�inquire_property<sz*inquire_property.<locals>.inquire_property)�doc)r)rrrr
)rrr.srzUTF-8cCstS)z�Gets the current encoding used for strings.

    This value is used to encode and decode string
    values like names.

    Returns:
        str: the current encoding
    )�	_ENCODINGr
r
r
r�
_get_encodingKs	rcCs|adS)z�Sets the current encoding used for strings

    This value is used to encode and decode string
    values like names.

    Args:
        enc: the encoding to use
    N)r)�encr
r
r�set_encodingWsrcs$dd��t�fdd�tj|�D��S)z&Encodes any relevant strings in a dictcSst|tj�r|jt�S|SdS)N)�
isinstance�sixZ	text_type�encoder)�xr
r
rrgs
z_encode_dict.<locals>.encc3s"|]\}}�|��|�fVqdS)Nr
)�.0�k�v)rr
r�	<genexpr>msz_encode_dict.<locals>.<genexpr>)�dictr!Z	iteritems)�dr
)rr�_encode_dictesr*cOs|y||f|�|�Stk
rv}zJ|jdk	rd|jrd||_tjrRtj�djj|_	n|j
j|j_
|jS�WYdd}~XnXdS)a�Optionally defer exceptions and return a token instead

    When `__DEFER_STEP_ERRORS__` is set on the implementing class
    or instance, methods wrapped with this wrapper will
    catch and save their :python:`GSSError` exceptions and
    instead return the result token attached to the exception.

    The exception can be later retrived through :python:`_last_err`
    (and :python:`_last_tb` when Python 2 is in use).
    N�)r�token�__DEFER_STEP_ERRORS__�	_last_errr!�PY2r�exc_info�tb_next�_last_tb�
__traceback__)�funcr�args�kwargs�er
r
r�catch_and_return_tokenqs
r8cOsl|jdk	rJz*tjr,tjt|j�|j|j�n|j�Wdtjr@|`d|_Xn||f|�|�Stjdd��}dS)z�Check and raise deferred errors before running the function

    This method checks :python:`_last_err` before running the wrapped
    function.  If present and not None, the exception will be raised
    with its original traceback.
    Nc_s4|jdk	r z
|j�Wdd|_Xn||f|�|�SdS)N)r.)r4rr5r6r
r
r�check_last_err�s



z&check_last_err.<locals>.check_last_err)r.r!r/Zreraise�typer2�deco�	decorator)r4rr5r6r9r
r
rr9�s	



r9cs eZdZdZ�fdd�Z�ZS)�CheckLastErrorz�Check for a deferred error on all methods

    This metaclass applies the :python:`check_last_err` decorator
    to all methods not prefixed by '_'.

    Additionally, it enabled `__DEFER_STEP_ERRORS__` by default.
    csZd|d<x:|D]2}||}t|tj�s(q|ddkrt|�||<qWtt|�j||||�S)NTr-r�_)r �types�FunctionTyper9�superr=�__new__)�clsr�parentsZattrsZ	attr_name�attr)�	__class__r
rrB�s
zCheckLastError.__new__)�__name__�
__module__�__qualname__�__doc__rB�
__classcell__r
r
)rFrr=�sr=)N)rr?r!r<r;Zgssapi.raw.miscrrrrrrrr*r8r9r:r=r
r
r
r�<module>s
&