o
    !d                     @   sH   d Z ddlmZ ddlmZ dd Zdd Zdd	 Zd
d Zdd Z	dS )aA  Change the scalar response parsing behavior for the AWS CLI.

The underlying library used by botocore has some response parsing
behavior that we'd like to modify in the AWS CLI.  There are two:

    * Parsing binary content.
    * Parsing timestamps (dates)

For the first option we can't print binary content to the terminal,
so this customization leaves the binary content base64 encoded.  If the
user wants the binary content, they can then base64 decode the appropriate
fields as needed.

There's nothing currently done for timestamps, but this will change
in the future.

    )parse_timestamp)ProfileNotFoundc                 C   s   |  dt d S )Nzsession-initialized)Zregister_firstadd_scalar_parsers)Zevent_handlers r   Eusr/lib/python3.10/site-packages/awscli/customizations/scalarparse.pyregister_scalar_parser"   s   r   c                 C   s   | S Nr   )xr   r   r   identity'   s   r
   c                 C   s   t |  S r   )r   	isoformat)valuer   r   r   
iso_format+   s   r   c                 C   sn   |  d}z
|  dd}W n ty   d}Y nw |dkr"t}n|dkr)t}ntd| |j|d d S )Nresponse_parser_factoryZcli_timestamp_formatnoneZiso8601zLUnknown cli_timestamp_format value: %s, valid values are "none" or "iso8601")timestamp_parser)get_componentZget_scoped_configgetr   r
   r   
ValueErrorset_parser_defaults)sessionfactoryZtimestamp_formatr   r   r   r   add_timestamp_parser/   s"   
	r   c                 K   s"   |  d}|jtd t|  d S )Nr   )Zblob_parser)r   r   r
   r   )r   kwargsr   r   r   r   r   L   s   
r   N)
__doc__Zbotocore.utilsr   Zbotocore.exceptionsr   r   r
   r   r   r   r   r   r   r   <module>   s   