404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@18.225.92.25: ~ $
3

�ga�E�@sddlZddlZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZddlm
Z
mZmZmZmZddlmZmZmZmZmZmZmZmZmZmZmZmZmZm Z dd	l!m"Z"dd
l#m$Z$ddl%m&Z&dd
l'm(Z(ddl)m*Z*m+Z+Gdd�de�Z,Gdd�dej-�Z.dS)�N)�RawDescriptionHelpFormatter)�dedent)�urlsplit)�get_netrc_auth�)�AuthCredentials�KeyValueArgType�PARSED_DEFAULT_FORMAT_OPTIONS�
parse_auth�parse_format_options)�HTTP_GET�	HTTP_POST�OUTPUT_OPTIONS�OUTPUT_OPTIONS_DEFAULT�OUTPUT_OPTIONS_DEFAULT_OFFLINE�(OUTPUT_OPTIONS_DEFAULT_STDOUT_REDIRECTED�
OUT_RESP_BODY�
PRETTY_MAP�PRETTY_STDOUT_TTY_ONLY�RequestType�SEPARATOR_CREDENTIALS�SEPARATOR_GROUP_ALL_ITEMS�SEPARATOR_GROUP_DATA_ITEMS�
URL_SCHEME_RE)�
ParseError)�RequestItems�)�Environment)�plugin_manager)�ExplicitNullAuth�get_content_typecs*eZdZdZd�fdd�	Zdd�Z�ZS)�HTTPieHelpFormatterz�A nicer help formatter.

    Help for arguments can be indented and contain new lines.
    It will be de-dented and arguments in the help
    will be separated by a blank line for better readability.


    �cs||d<t�j||�dS)N�max_help_position)�super�__init__)�selfr#�args�kwargs)�	__class__��/usr/lib/python3.6/argparser.pyr%)szHTTPieHelpFormatter.__init__cCst|�j�d}|j�S)Nz

)r�strip�
splitlines)r&�text�widthr*r*r+�_split_lines.sz HTTPieHelpFormatter._split_lines)r")�__name__�
__module__�__qualname__�__doc__r%r0�
__classcell__r*r*)r)r+r!sr!cs�eZdZdZed��fdd�
Zd'eejd��fdd�
Z	d	d
�Z
dd�Zd(�fd
d�	Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Z�ZS))�HTTPieArgumentParserz�Adds additional logic to `argparse.ArgumentParser`.

    Handles all input (CLI args, file args, stdin), applies defaults,
    and performs extra validation.

    )�formatter_classcs:d|d<t�j|d|i|��d|_d|_d|_d|_dS)NFZadd_helpr7)r$r%�envr'�has_stdin_data�has_input_data)r&r7r'r()r)r*r+r%=szHTTPieArgumentParser.__init__N)r8�returncs||_t�j||�\|_}|jjr*d|j_|jjoD|jjoD|jj|_	|j	pX|jj
dk	|_|j|�|j
�|j�|j�|j�|j�|j�|j�|j�|j�|j�|jj
dk	r�|j|jj
�n|j	r�|j|jj�|jj�r|jj�r|jd�|jj�r|jd�|jS)NTz'cannot combine --compress and --chunkedz)cannot combine --compress and --multipart)r8r$Zparse_known_argsr'�debug�	traceback�stdin�ignore_stdinZstdin_isattyr9�rawr:�_apply_no_options�_process_request_type�_process_download_options�_setup_standard_streams�_process_output_options�_process_pretty_options�_process_format_options�
_guess_method�_parse_items�_process_url�
_process_auth�_body_from_input�_body_from_file�compressZchunked�error�	multipart)r&r8r'�	namespace�
no_options)r)r*r+�
parse_argsFs:






zHTTPieArgumentParser.parse_argscCs<|jj}|tjk|j_|tjk|j_|tjtjhk|j_dS)N)	r'�request_typerZJSONZjsonZ	MULTIPARTrPZFORM�form)r&rTr*r*r+rBqsz*HTTPieArgumentParser._process_request_typecCs�tj|jj�s�tjj|jj�dkr(d}n|jj	d}t
jd|jj�}|r�|jd�}|jd�}|d|j_|r�|jjd|7_|jj|7_n||jj|j_dS)	NZhttpszhttps://z://z^:(?!:)(\d*)(/?.*)$rrZ	localhost�:)r�matchr'�url�os�path�basenamer8Zprogram_nameZdefault_scheme�re�group)r&�schemeZ	shorthandZport�restr*r*r+rJzs

z!HTTPieArgumentParser._process_urlcs^tj|jjtj|jjd|jjij||�}t|d�rLt|t�rL|j|jj	�}t
�j||�dS)N�buffer)�sys�stdoutr8�stderr�get�hasattr�
isinstance�str�encodeZstdout_encodingr$�_print_message)r&�message�file)r)r*r+ri�s

z#HTTPieArgumentParser._print_messagecCs�t|jj�|j_|jjrR|jjr8|jjr8|jj|j_|jj|j_|jj	|j_nn|jjr�|jjj
d�y|jjj�Wn2tk
r�}z|j
t
jkr�n�WYdd}~XnX|jj|j_d|j_|jjr�|jj|j_|jjo�|jjs�|jj|j_dS)zX
        Modify `env.stdout` and `env.stdout_isatty` based on args, if needed.

        rNF)�boolr'�output_fileZoutput_file_specified�downloadr8�
stdout_isattyrbrcZ
stderr_isatty�seek�truncate�OSError�errnoZEINVAL�quiet�devnull)r&�er*r*r+rD�s(z,HTTPieArgumentParser._setup_standard_streamsc
Cs�d|j_tj�d}|jjdk	}t|jj�}|jjdkrv|rv|jdk	rv|j}|j	pVd}t
||ttj||g�d�|j_|jjdk	s�|�r�|jjs�|j|j_tj
|jj��}|jjr�|jjdkr�|jr�t|jj�}|r�t
|d|dttj|�d�|j_|j�r|jjdk�r|jd�|jj|_||j_t|jjt
�}|jjdk�sP|j�r^|j�|j_nf|�rn|jj}	nt|jj�}	|	j��r�|j�r�|jj�r�|jd�|	j|j�|j|	j|	jd�|j_|jj�r�|jj�r�t�|j_dS)Nr�)�key�value�sepZorigrz--auth requiredz=Unable to prompt for passwords because --ignore-stdin is set.)�username�password)r'Zauth_pluginrZget_auth_pluginsZ	auth_typerrXZauthr{r|rr�joinZget_auth_pluginZignore_netrcZnetrc_parserZauth_requirerOZraw_authrfZ
auth_parseZget_authr
Zhas_passwordZprompt_passwordr?Znetlocrxryr)
r&Zdefault_auth_pluginZ
auth_type_setrXr{r|ZpluginZnetrc_credentialsZalready_parsedZcredentialsr*r*r+rK�s`







z"HTTPieArgumentParser._process_authcCs�g}xj|D]b}|jd�s$|j|�q
d|dd�}x6|jD]"}||jkr<t|j|j|j�Pq<W|j|�q
W|r�|jddj	|����dS)z�For every `--no-OPTION` in `no_options`, set `args.OPTION` to
        its default value. This allows for un-setting of options, e.g.,
        specified in config.

        z--no-z--�Nzunrecognized arguments: � )
�
startswith�appendZ_actionsZoption_strings�setattrr'�dest�defaultrOr})r&rRZinvalid�option�inverted�actionr*r*r+rAs



z&HTTPieArgumentParser._apply_no_optionscCs(|j|jj|jj�t|d|�|j_dS)zPRead the data from a file-like object.

        Bytes are always read.

        r`N)�_ensure_one_data_sourcer'�data�files�getattr)r&�fdr*r*r+rM!sz$HTTPieArgumentParser._body_from_filecCs(|j|j|jj|jj�|j�|j_dS)z%Read the data from the CLI.

        N)r�r9r'r�r�rh)r&r�r*r*r+rL*s
z%HTTPieArgumentParser._body_from_inputcGst|�r|jd�dS)z=There can only be one source of input request data.

        z�Request body (from stdin, --raw or a file) and request data (key=value) cannot be mixed. Pass --ignore-stdin to let key/value take priority. See https://httpie.io/docs#scripting for details.N)�anyrO)r&Z
other_sourcesr*r*r+r�2sz,HTTPieArgumentParser._ensure_one_data_sourcecCs�|jjdkr4|jjst�|jr*t|j_q�t|j_n�tjd|jj�s�y"|jjj	dt
t�j|jj
��Wn>tjk
r�}z |jjr��|j|jd�WYdd}~Xn:X|jj|j_
|jp�tdd�|jjD��}|r�tnt|j_dS)zxSet `args.method` if not specified to either POST or GET
        based on whether the request has data or not.

        Nz^[a-zA-Z]+$rcss|]}|jtkVqdS)N)rzr)�.0�itemr*r*r+�	<genexpr>^sz5HTTPieArgumentParser._guess_method.<locals>.<genexpr>)r'�method�
request_items�AssertionErrorr:r
rr\rW�insertrr�__call__rX�argparseZArgumentTypeErrorr=rOr�)r&rvZhas_datar*r*r+rH<s&

"z"HTTPieArgumentParser._guess_methodc
Cs@ytj|jj|jjd�}Wn<tk
rV}z |jjr6�|j|jd�WYdd}~Xn4X|j|j_|j	|j_	|j
|j_
|j|j_|j|j_|jj
o�|jj�r<d}xT|jj
j
�D]D\}}|dkr�|jddj|jj
j�����|dk	r�|jd�|}q�W|\}}}i|j_
|j|�d|jjk�r<t|�}	|	�r<|	|jjd<dS)	zx
        Parse `args.request_items` into `args.headers`, `args.data`,
        `args.params`, and `args.files`.

        )Zrequest_item_argsZas_formrNrwz1Invalid file fields (perhaps you meant --form?): �,z&Can't read request from multiple fileszContent-Type)rZ	from_argsr'r�rUrr=rOZheadersr�r�ZparamsZmultipart_data�itemsr}�keysrMr )
r&r�rvZrequest_filerxrk�fnr�ZctZcontent_typer*r*r+rIcs:"







z!HTTPieArgumentParser._parse_itemscs��fdd�}�jjrd�j_�jjdkrl�jjr@djt��j_n,�jjrRt�j_n�jj	sdt
�j_nt�j_�jjdkr��jj�j_|�jjd�|�jjd��jj
r�t�jjkr�tt�jj�tt���j_dS)z�Apply defaults to output options, or validate the provided ones.

        The default output options are stdout-type-sensitive.

        cs0t|�t}|r,�jd|�ddj|����dS)NzUnknown output options: �=r�)�setrrOr})ryr��unknown)r&r*r+�
check_options�szCHTTPieArgumentParser._process_output_options.<locals>.check_optionsTNrwz--printz--history-print)r'�verbose�allZoutput_optionsr}r�offlinerr8rorrZoutput_options_historyrnrrgr�)r&r�r*)r&r+rE�s$

z,HTTPieArgumentParser._process_output_optionscCs^|jjtkr&t|jjrdnd|j_n4|jjrJ|jjrJ|jjrJ|jd�nt|jj|j_dS)Nr�Znonez1Only terminal output can be colorized on Windows.)	r'Zprettifyrrr8roZ
is_windowsrmrO)r&r*r*r+rF�sz,HTTPieArgumentParser._process_pretty_optionscCs^|jjrd|j_d|j_dS|jjs6|jjr6|jd�|jjrZ|jjoL|jjrZ|jd�dS)NFz%--continue only works with --downloadz,--continue requires --output to be specified)r'r�rnZdownload_resumerOrm)r&r*r*r+rC�s
z.HTTPieArgumentParser._process_download_optionscCs6|jjp
g}t}x|D]}t||d�}qW||j_dS)N)Zdefaults)r'�format_optionsr	r)r&r�Zparsed_optionsZ
options_groupr*r*r+rG�s

z,HTTPieArgumentParser._process_format_options)NN)N)r1r2r3r4r!r%rr�Z	NamespacerSrBrJrirDrKrArMrLr�rHrIrErFrCrGr5r*r*)r)r+r65s(&	(G	
',%r6)/r�rsrYr\rar�textwraprZurllib.parserZrequests.utilsrZargtypesrrr	r
rZ	constantsrr
rrrrrrrrrrrr�
exceptionsrZrequestitemsr�contextrZplugins.registryrZutilsrr r!�ArgumentParserr6r*r*r*r+�<module>s"@

Filemanager

Name Type Size Permission Actions
__init__.cpython-36.opt-1.pyc File 113 B 0644
__init__.cpython-36.pyc File 113 B 0644
argparser.cpython-36.opt-1.pyc File 11.82 KB 0644
argparser.cpython-36.pyc File 11.86 KB 0644
argtypes.cpython-36.opt-1.pyc File 7.43 KB 0644
argtypes.cpython-36.pyc File 7.43 KB 0644
constants.cpython-36.opt-1.pyc File 2.02 KB 0644
constants.cpython-36.pyc File 2.02 KB 0644
definition.cpython-36.opt-1.pyc File 17.74 KB 0644
definition.cpython-36.pyc File 17.74 KB 0644
dicts.cpython-36.opt-1.pyc File 2.1 KB 0644
dicts.cpython-36.pyc File 2.13 KB 0644
exceptions.cpython-36.opt-1.pyc File 276 B 0644
exceptions.cpython-36.pyc File 276 B 0644
requestitems.cpython-36.opt-1.pyc File 4.26 KB 0644
requestitems.cpython-36.pyc File 4.26 KB 0644