File: //proc/self/root/usr/lib/python3.6/site-packages/ipalib/__pycache__/output.cpython-36.pyc
3
�d[e? � @ s� d Z ddlZddlmZmZ ddlmZ ddlmZ ddl m
Z
ejrJeZ
G dd� de�ZG d d
� d
e�ZdZG dd
� d
e�ZG dd� de�ZG dd� 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@ e Zd ZdZdZdZdZg Zddg fdd�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,
... )
Nc C sD || _ |d k r$t|t�s|f}|| _|d k r2|| _|| _t| � d S )N)�name�
isinstance�tuple�type�doc�flagsr )�selfr r r r
� r �/usr/lib/python3.6/output.py�__init__N s
zOutput.__init__c C s d| j jdj| j� �f S )Nz%s(%s)z, )� __class__�__name__�join�_Output__repr_iter)r r r r �__repr__Y s zOutput.__repr__c c s^ t | j�V xLdD ]D}| jj|�}|s(qt|t�r@tt|��}nt |�}d||f V qW d S )Nr r r
z%s=%s)r r r
)�reprr �__dict__�getr r
r �list)r �key�valuer r r Z__repr_iter_ s
zOutput.__repr_iter)r �
__module__�__qualname__�__doc__r �validater r
r r r r r r r r ! s &r c @ s e Zd ZeZed�ZdS )�Entryz'A dictionary representing an LDAP entryN)r r r �dictr r r r r r r r! l s r! zP%s.validate_output() => %s.validate():
output[%r][%d]: need a %r; got a %r: %rc @ s$ e Zd ZeefZed�Zdd� ZdS )�
ListOfEntrieszA list of LDAP entriesc
C sZ t || j�st�xDt|�D ]8\}}t |t�stt|j| jj | j|tt|�|f ��qW d S )N)
r r �AssertionError� enumerater"