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: //lib/python3.6/site-packages/ipalib/__pycache__/output.cpython-36.opt-1.pyc
3

�d[e?�@s�dZddlZddlmZmZddlmZddlmZddl	m
Z
ejrJeZ
Gdd�de�ZGd	d
�d
e�ZdZGdd
�d
e�ZGdd�de�ZGdd�de�Zeded�d�Zede
ed�fed��Zedded�dgd�ZeefZeed�efZeed�edeed��edeed��fZeedeed��efZeedeed��eddgd�fZeedeed ��efZ e Z!eedeed ��ede
dgd�fZ"eed�ede
dgd�fZ#dS)!z&
Simple description of return values.
�N)�ReadOnly�lock)�client_has_capability)�_)�apireprc@s@eZdZdZdZdZdZgZddgfdd�Zdd�Z	dd�Z
dS)	�Outputa
    Simple description of a member in the return value ``dict``.

    This class controls both the type of object being returned by
    a command as well as how the output will be displayed.

    For example, this class defines two return results: an entry
    and a value.

    >>> from ipalib import crud, output
    >>> class user(crud.Update):
    ...
    ...     has_output = (
    ...         output.Entry('result'),
    ...         output.value,
    ...     )

    The order of the values in has_output controls the order of output.
    If you have values that you don't want to be printed then add
    ``'no_display'`` to flags.

    The difference between ``'no_display'`` and ``'no_output'`` is
    that ``'no_output'`` will prevent a Param value from being returned
    at all. ``'no_display'`` will cause the API to return a value, it
    simply won't be displayed to the user. This is so some things may
    be returned that while not interesting to us, but may be to others.

    >>> from ipalib import crud, output
    >>> myvalue = output.Output('myvalue', unicode,
    ...     'Do not print this value', flags=['no_display'],
    ... )
    >>> class user(crud.Update):
    ...
    ...     has_output = (
    ...         output.Entry('result'),
    ...         myvalue,
    ...     )
    NcCsD||_|dk	r$t|t�s|f}||_|dk	r2||_||_t|�dS)N)�name�
isinstance�tuple�type�doc�flagsr)�selfrrrr
�r�/usr/lib/python3.6/output.py�__init__Ns
zOutput.__init__cCsd|jjdj|j��fS)Nz%s(%s)z, )�	__class__�__name__�join�_Output__repr_iter)rrrr�__repr__YszOutput.__repr__ccs^t|j�VxLdD]D}|jj|�}|s(qt|t�r@tt|��}nt|�}d||fVqWdS)Nrrr
z%s=%s)rrr
)�reprr�__dict__�getr	r
r�list)r�key�valuerrrZ__repr_iter_s

zOutput.__repr_iter)r�
__module__�__qualname__�__doc__r�validaterr
rrrrrrrr!s&rc@seZdZeZed�ZdS)�Entryz'A dictionary representing an LDAP entryN)rrr�dictrrrrrrrr!lsr!zP%s.validate_output() => %s.validate():
  output[%r][%d]: need a %r; got a %r: %rc@s$eZdZeefZed�Zdd�ZdS)�
ListOfEntrieszA list of LDAP entriesc
CsJxDt|�D]8\}}t|t�s
tt|j|jj|j|tt|�|f��q
WdS)N)	�	enumerater	r"�	TypeError�emsgrrrr)r�cmdZentries�version�i�entryrrrr xs
zListOfEntries.validateN)	rrrrr
rrrr rrrrr#tsr#c@seZdZdd�ZdS)�
PrimaryKeycCs�t|d�rDt|d�r.|jr.|jjr.|jjj}ntf}|td�f}ntf}t||�s|td|j	|j
j|j	|dt|�|f��dS)N�primary_key_types�objzH%s.validate_output() => %s.validate():
  output[%r]: need %r; got %r: %rr)r�hasattrr-�primary_key�
allowed_types�unicoderr	r%rrr)rr'rr(�typesrrrr �s

zPrimaryKey.validateN)rrrr rrrrr+�sr+c@seZdZdd�ZdS)�ListOfPrimaryKeysc
Cs�t|d�rttf}ntf}t||�sLtd|j|jj|j|dt	|�|f��t|d�r�t
|d�rz|jrz|jjrz|jjj
}ntf}xHt|�D]<\}}t||�s�tt|j|jj||j|dt	|�|f��q�WdS)Nr,zH%s.validate_output() => %s.validate():
  output[%r]: need %r; got %r: %rrr-)rr
rr1r	r%rrrrr.r-r/r0r$r&)rr'�valuesr(r2r)rrrrr �s"




zListOfPrimaryKeys.validateN)rrrr rrrrr3�sr3�resultz*All commands should at least have a result)r�summaryz-User-friendly description of action performedrz:The primary_key value of the entry, e.g. 'jdoe' for a userZ
no_display)r
�countzNumber of entries returnedZ	truncatedz%True if not all results were returnedzList of deletions that failedz'True means the operation was successful)$rZsixZipalib.plugablerrZipalib.capabilitiesrZipalib.textrZipalib.utilrZPY3�strr1rr!r&r#r+r3r5rr6rZstandardZstandard_entry�int�boolZstandard_list_of_entriesr"Zstandard_deleteZstandard_multi_deleteZstandard_booleanZstandard_valueZsimple_valueZsimple_entryrrrr�<module>sVK