https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/awscli/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/awscli/__pycache__/formatter.cpython-310.pyc
o

2&�a�+�@s�ddlZddlmZddlmZddlmZddlmZm	Z	m
Z
ddlmZddlm
Z
ddlmZe�e�Zd	d
�ZGdd�de�ZGd
d�de�ZGdd�de�ZGdd�de�ZGdd�de�Zdd�ZdS)�N)�json)�set_value_from_jmespath)�PageIterator)�
MultiTable�Styler�ColorizedStyler)�text)�compat)�json_encodercCs
t|t�S�N)�
isinstancer)�response�r�2/usr/lib/python3/dist-packages/awscli/formatter.py�is_response_paginated�
rc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�	FormattercCs
||_dSr)�_args)�self�argsrrr�__init__"rzFormatter.__init__cCsFd|vrd|vr!d|dvr|dd}t�d|�|d=dSdSdS)N�Errors�ResponseMetadata�	RequestIdz
RequestId: %s)�LOG�debug)r�
response_data�
request_idrrr�_remove_request_id%s
�zFormatter._remove_request_idcCst��Sr)r	�get_stdout_text_writer�rrrr�_get_default_stream1szFormatter._get_default_streamcCs$z|��WdStyYdSwr)�flush�IOError)r�streamrrr�
_flush_stream4s
�zFormatter._flush_streamN)�__name__�
__module__�__qualname__rrr!r%rrrrr!s
rc@seZdZddd�ZdS)�FullyBufferedFormatterNc
Cs�|dur|��}t|�r|��}n|}|�|�|jjdur%|jj�|�}z,z	|�|||�WntyA}zWYd}~n
d}~wwW|�	|�dSW|�	|�dS|�	|�wr)
r!r�build_full_resultrr�query�search�_format_responser#r%)r�command_namer
r$r�errr�__call__<s$

����zFullyBufferedFormatter.__call__r)r&r'r(r0rrrrr);sr)c@seZdZdd�ZdS)�
JSONFormattercCs.|ikrtj||dtdd�|�d�dSdS)N�F)�indent�default�ensure_ascii�
)r�dumpr
�write�rr.r
r$rrrr-Ys��zJSONFormatter._format_responseN)r&r'r(r-rrrrr1Wsr1cs\eZdZdZd�fdd�	Zdd�Zddd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Z�ZS)�TableFormatterz�Pretty print a table from a given response.

    The table formatter is able to take any generic response
    and generate a pretty printed table.  It does this without
    using the output definition from the model.

    Ncs�tt|��|�|jdkrtddd�|_dS|jdkr(t�}tdd|d�|_dS|jdkr:t�}tdd|d�|_dStd|j��)	N�autoF�|)�initial_section�column_separator�off)r=r>�styler�onzUnknown color option: %s)	�superr:r�colorr�tablerr�
ValueError)rrrDr@��	__class__rrrls 
�
�
�zTableFormatter.__init__cCs8|�||�rz	|j�|�WdStyYdSwdSr)�_build_tablerD�renderr#r9rrrr-|s��zTableFormatter._format_responsercs�|sdS|dur�jj||d�t|t�rOt|dt�r$��|||�n+|D](}��|�r5�j�|g�q&t�fdd�|D��rG�j�|�q&�j	d|d�q&t|t�rZ��
||�dS)NF��indent_levelrc3s�|]}��|�VqdSr)�_scalar_type)�.0�elr rr�	<genexpr>�s�z.TableFormatter._build_table.<locals>.<genexpr>)�title�currentT)rD�new_sectionr�list�dict�_build_sub_table_from_listrL�add_row�allrH�_build_sub_table_from_dict)rrPrQrK�itemrr rrH�s 


zTableFormatter._build_tablecs�|���\}}t|�dkr|j�|d�|dg�n|r1|j�|�|j��fdd�|D��|D]}|j|�||dd�q3dS)N�rcsg|]}�|�qSrr)rM�k�rQrr�
<listcomp>�sz=TableFormatter._build_sub_table_from_dict.<locals>.<listcomp>rJ)�_group_scalar_keys�lenrDrV�add_row_headerrH)rrQrK�headers�more�	remainingrr\rrX�s��z)TableFormatter._build_sub_table_from_dictcs�|�|�\}}|j�|�d}|D]8�|s%|r%|jj||d�|j�|�d}|j��fdd�|D��|D]}|�vrH|j|�||dd�q6qdS)NTrJFcsg|]}��|d��qS)�)�get)rM�header��elementrrr]�sz=TableFormatter._build_sub_table_from_list.<locals>.<listcomp>rZ)�_group_scalar_keys_from_listrDr`rRrVrH)rrQrKrPrarb�firstrcrrgrrU�s&�����z)TableFormatter._build_sub_table_from_listcCst|ttf�Sr)rrSrT)rrhrrrrL�szTableFormatter._scalar_typecCsXt�}t�}|D]}|�|�\}}|�|�|�|�qtt|��}tt|��}||fSr)�setr^�updaterS�sorted)r�
list_of_dictsrarbrY�current_headers�current_morerrrri�s
z+TableFormatter._group_scalar_keys_from_listcCsNg}g}|D]}|�||�r|�|�q|�|�q|��|��||fSr)rL�append�sort)rrQrbrarhrrrr^�sz!TableFormatter._group_scalar_keysr)r)
r&r'r(�__doc__rr-rHrXrUrLrir^�
__classcell__rrrFrr:ds

r:c@seZdZddd�Zdd�ZdS)�
TextFormatterNc
	Cs�|dur|��}z[t|�rI|j}t|�D]%\}}|dkri}n|j}|D]}|�|�}	t||j|	�q$|�||�q|j	rH|�dd|j	ii|�n|�
|�|�||�W|�|�dSW|�|�dS|�|�w)Nr�	NextToken)r!r�result_keys�	enumerate�non_aggregate_partr,r�
expressionr-�resume_tokenrr%)
rr.r
r$rw�i�pagerQ�
result_key�datarrrr0�s8
���
�zTextFormatter.__call__cCs.|jjdur|jj}|�|�}t�||�dSr)rr+r,r�format_text)rr
r$rzrrrr-s
zTextFormatter._format_responser)r&r'r(r0r-rrrrru�s
"rucCs<|dkrt|�S|dkrt|�S|dkrt|�Std|��)NrrrDzUnknown output type: %s)r1rur:rE)�format_typerrrr�
get_formatter
sr�)�logging�botocore.compatr�botocore.utilsr�botocore.paginater�awscli.tablerrr�awsclirr	�awscli.utilsr
�	getLoggerr&rr�objectrr)r1r:rur�rrrr�<module>s 

~+

https://t.me/RX1948 - 2025