a
    ù!f÷  ã                   @   sH   d dl Z d dlZd dlmZ dd„ Zdd„ Zdd„ Zd	d
„ Zdd„ ZdS )é    N)Úvaluesc                 C   sL   | t jkr| S t| tjƒr&t|  ¡ ƒS t| tjƒr:t| ƒS t| tƒrH| S dS )ú¡
    Return a string representation of a date that the Twilio API understands
    Format is YYYY-MM-DD. Returns None if d is not a string, datetime, or date
    N)r   ÚunsetÚ
isinstanceÚdatetimeÚstrÚdate©Úd© r   úV/var/www/html/python-backend/venv/lib/python3.9/site-packages/twilio/base/serialize.pyÚiso8601_date   s    

r   c                 C   sB   | t jkr| S t| tjƒs&t| tjƒr0|  d¡S t| tƒr>| S dS )r   z%Y-%m-%dT%H:%M:%SZN)r   r   r   r   r   Ústrftimer   r	   r   r   r   Úiso8601_datetime   s    


r   c                    sH   | t jkri S d‡ fdd„	‰ t| tƒrDˆ | ƒ}‡fdd„| ¡ D ƒS i S )zS
    Return a dict of params corresponding to those in m with the added prefix
    Nc                    s`   |d u ri }|d u rg }|   ¡ D ]:\}}t|tƒrFˆ ||||g ƒ q ||d ||g ¡< q |S )NÚ.)Úitemsr   ÚdictÚjoin)r
   ÚresultZprv_keysÚkÚv)Úflatten_dictr   r   r   *   s    
z.prefixed_collapsible_map.<locals>.flatten_dictc                    s   i | ]\}}d   ˆ |¡|“qS )z{}.{})Úformat)Ú.0r   r   )Úprefixr   r   Ú
<dictcomp>;   ó    z,prefixed_collapsible_map.<locals>.<dictcomp>)NN)r   r   r   r   r   )Úmr   Z	flattenedr   )r   r   r   Úprefixed_collapsible_map#   s    

r   c                 C   s"   t | tƒst | tƒrt | ¡S | S )zl
    Return a jsonified string represenation of obj if obj is jsonifiable else
    return obj untouched
    )r   r   ÚlistÚjsonÚdumps)Úobjr   r   r   Úobject@   s    
r#   c                    s    t | tƒs| S ‡ fdd„| D ƒS )z8
    Applies serialize_func to every element in lst
    c                    s   g | ]}ˆ |ƒ‘qS r   r   )r   Úe©Úserialize_funcr   r   Ú
<listcomp>P   r   zmap.<locals>.<listcomp>)r   r   )Úlstr&   r   r%   r   ÚmapJ   s    
r)   )	r   r    Ztwilio.baser   r   r   r   r#   r)   r   r   r   r   Ú<module>   s   
