a
    xd
                     @   sT   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
 dd ZG dd deZdS )	    )unicode_literals)	BaseCodec)DocumentLinkArrayObjectErrorFieldc                 C   s  t | tr<ddd |  D }dt| jt| j|f S t | trpddd |  D }dt| j|f S t | trdddd |  D  S t | t	rd	dd
d | D  S t | t
rjdt| j }| jr|dt| j 7 }| jr|dt| j 7 }| jr|dt| j 7 }| jr8|dt| j 7 }| jrbddd | jD }|d| 7 }d| S t | trt| j}| js| js|S | jr|d7 }| jr|dt| j 7 }| jr|dt| j 7 }d| S t| S )Nz, c                 S   s$   g | ]\}}d t |t|f qS z%s: %srepr_to_repr.0keyvalue r   M/var/www/html/Ranjet/env/lib/python3.9/site-packages/coreapi/codecs/python.py
<listcomp>   s   z_to_repr.<locals>.<listcomp>z(Document(url=%s, title=%s, content={%s})c                 S   s$   g | ]\}}d t |t|f qS r
   r   r   r   r   r   r      s   zError(title=%s, content={%s})z{%s}c                 S   s$   g | ]\}}d t |t|f qS r
   r   r   r   r   r   r      s   z[%s]c                 S   s   g | ]}t |qS r   r   )r   r   r   r   r   r   #   s   zurl=%sz, action=%sz, encoding=%sz, transform=%sz, description=%sc                 s   s   | ]}t |V  qd S )Nr   )r   itemr   r   r   	<genexpr>2       z_to_repr.<locals>.<genexpr>z, fields=[%s]zLink(%s)z, required=Truez, location=%sz, schema=%sz	Field(%s))
isinstancer   joinitemsr   urltitler   r   r   r   actionencodingZ	transformdescriptionfieldsr	   namerequiredlocationZschema)nodecontentargsZfields_reprr   r   r   r   	   s`    









r   c                   @   s   e Zd ZdZdZdd ZdS )PythonCodeczI
    A Python representation of a Document, for use with '__repr__'.
    ztext/pythonc                 K   s4   t |trdt| S t |tr,dt| S t|S )Nz
Object(%s)z	Array(%s))r   r   r   r   )selfdocumentoptionsr   r   r   encodeK   s
    

zPythonCodec.encodeN)__name__
__module____qualname____doc__
media_typer,   r   r   r   r   r(   E   s   r(   N)
__future__r   Zcoreapi.codecs.baser   Zcoreapi.documentr   r   r   r   r   r	   r   r(   r   r   r   r   <module>   s    <