ok

Mini Shell

Direktori : /opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/
Upload File :
Current File : //opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyo

�
Bu�_c@sddlZddlZddlZddlmZddlmZejdkr\eZ	ndd�Zdd�Zd�Z
d�Zd	�Zd
efd��YZdefd
��YZdefd��YZdefd��YZdefd��YZdefd��YZdS(i����N(tDecimal(tInlineTableDicticCs;|jstd��nt|d|�}|j|�|S(sWrites out dict as toml to a file

    Args:
        o: Object to dump into toml
        f: File descriptor where the toml should be stored
        encoder: The ``TomlEncoder`` to use for constructing the output string

    Returns:
        String containing the toml corresponding to dictionary

    Raises:
        TypeError: When anything other than file descriptor is passed
    s0You can only dump an object to a file descriptortencoder(twritet	TypeErrortdumps(totfRtd((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pytdumps
	
c	Cs�d}|d	kr$t|j�}n|j|d�\}}||7}t|�g}x$|r{g|D]}t|�^qe}x)|D]!}||kr�td��q�q�W||7}|j�}	x�|D]�}|j|||�\}}
|s�|rG|
rG|r|ddkr|d7}n|d|d7}|rG||7}qGnx$|
D]}|
||	|d|<qNWq�W|	}qXW|S(
sStringifies input dict as toml

    Args:
        o: Object to dump into toml
        encoder: The ``TomlEncoder`` to use for constructing the output string

    Returns:
        String containing the toml corresponding to dict

    Examples:
        ```python
        >>> import toml
        >>> output = {
        ... 'a': "I'm a string",
        ... 'b': ["I'm", "a", "list"],
        ... 'c': 2400
        ... }
        >>> toml.dumps(output)
        'a = "I'm a string"
b = [ "I'm", "a", "list",]
c = 2400
'
        ```
    tsCircular reference detectedi����s

s
t[s]
t.N(tNonetTomlEncodert	__class__t
dump_sectionstidt
ValueErrortget_empty_table(RRtretvaltaddtoretvaltsectionst
outer_objstsectiontsection_idst	outer_objtnewsectionst
addtosectionsts((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyR"s4
	





cCs�tjdkr?t|d�r?t|t�r?|jd�}nd|}|ddkrf|d}n|jd�}|s�|jd	�r�|dd
!}n|r�|jdd�}|jd	d�}n|jd
�}x�t	|�dkr�d
}|ds|d}n|djdd�|d<|d|dk}x7|d| ro|d|dkro|}|d8}q9W|rd}nd}|d||dg|d}q�Wt
d	|dd	�S(Nitdecodesutf-8s%rituit't"i����s\'s\"s\xs\\s\txtu00i(i(tsystversion_infothasattrt
isinstancetstrRt
startswithtreplacetsplittlentunicode(tvtsinglequotetitjoinxtjoiner((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyt	_dump_strVs4-



%	%cCs%dj|�jdd�jdd�S(Ns{}se+0se+se-0se-(tformatR*(R.((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyt_dump_floatuscCs0|j�}|dkr"|j�S|j�d S(Ni����(t	utcoffsetR
t	isoformat(R.R6((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyt
_dump_timeys
RcBsDeZeed�Zd�Zd�Zd�Zd�Zd�Z	RS(cCs}||_||_i
tt6tt6|jt6d�t6d�t6t	t
6t	t6d�tj6t
tj6d�tj6|_dS(NcSst|�j�S(N(R-tlower(R.((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyt<lambda>�scSs|S(N((R.((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyR:�scSs|j�jdd�S(Ns+00:00tZ(R7R*(R.((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyR:�scSs
|j�S(N(R7(R.((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyR:�s(t_dicttpreserveR3R(R-t	dump_listtlisttbooltintR5tfloatRtdatetimeR8ttimetdatet
dump_funcs(tselfR<R=((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyt__init__�s		




cCs
|j�S(N(R<(RG((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyR�scCsFd}x/|D]'}|dt|j|��d7}q
W|d7}|S(NRt t,t](R-t
dump_value(RGR.RR((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyR>�s

%
cCs�d}t|t�r{g}x>|j�D]0\}}|j|�}|j|d|�q(W|ddj|�d7}|St|j|��SdS(s�Preserve inline table in its compact syntax instead of expanding
        into subsection.

        https://github.com/toml-lang/toml#user-content-inline-table
        R
s = s{ s, s }
N(R'tdicttitemstdump_inline_tabletappendtjoinR-RL(RGRRtval_listtkR.tval((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyRO�scCsj|jjt|��}|dkrCt|d�rC|jt}n|dk	rY||�S|jt|�S(Nt__iter__(RFtgetttypeR
R&R?R((RGR.tdump_fn((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyRL�sc	Cs�d}|dkr/|ddkr/|d7}n|j�}d}xh|D]`}t|�}|}tjd|�s�t|�}nt||t�s\t}t||t�r�x-||D]}	t|	t�r�t	}q�q�Wn|rxs||D](}	d}
|d||d7}|j
|	||�\}}|r\|dd	krO|
|7}
q\||7}nx�|r|j�}
x�|D]�}|j
||||d|�\}}|r�|
d	||d|d
7}
|
|7}
nx$|D]}|||
|d|<q�WqxW|
}q_W||
7}q�Wq�||dk	r�||dt|j||��d7}q�qH|j
r�t||t�r�||d|j||�7}qH||||<qHW||7}||fS(NR
i����Rs^[A-Za-z0-9_-]+$s
s[[s]]
iRs]
s = (R<R-tretmatchR3R'RMtFalseR?tTrueRR
RLR=RRO(RGRtsuptretstrtretdicttarraystrRtqsectiont
arrayoftablestatarraytabstrRRtnewdtdsects1td1((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyR�s`



	




,

(
t__name__t
__module__RMR[RHRR>RORLR(((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyR�s				tTomlPreserveInlineDictEncodercBseZed�ZRS(cCstt|�j|t�dS(N(tsuperRkRHR\(RGR<((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyRH�s(RiRjRMRH(((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyRk�stTomlArraySeparatorEncodercBs#eZeedd�Zd�ZRS(RJcCsctt|�j||�|j�dkr8d|}n|jd�rVtd��n||_dS(NR
RJs 	

,sInvalid separator for arrays(RlRmRHtstripRt	separator(RGR<R=Ro((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyRH�s
cCs�g}d}x$|D]}|j|j|��qWxx|gkr�g}xY|D]Q}t|t�r�x9|D]}|j|�qkWqO|dt|�|j7}qOW|}q6W|d7}|S(NRRIRK(RPRLR'R?R-Ro(RGR.ttRRRtr((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyR>�s




(RiRjRMR[RHR>(((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyRm�stTomlNumpyEncodercBs eZeed�Zd�ZRS(cCs�ddl}tt|�j||�t|j|j<t|j|j<t|j|j<|j	|j|j
<|j	|j|j<|j	|j|j<dS(Ni����(
tnumpyRlRrRHR5RFtfloat16tfloat32tfloat64t	_dump_inttint16tint32tint64(RGR<R=tnp((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyRHscCsdjt|��S(Ns{}(R4RA(RGR.((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyRws(RiRjRMR[RHRw(((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyRrs
tTomlPreserveCommentEncodercBseZeed�ZRS(csCddlm}tt��j||��fd��j|<dS(Ni����(tCommentValuecs|j�j�S(N(R	RL(R.(RG(sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyR:#s(tpip._vendor.toml.decoderR}RlR|RHRF(RGR<R=R}((RGsI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyRH s(RiRjRMR[RH(((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyR|stTomlPathlibEncodercBseZd�Zd�ZRS(cCstt|��S(N(R3R((RGR.((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyt_dump_pathlib_path(scCsUdtjkr?ddl}t||j�r?t|�}q?ntt|�j|�S(Niii����(ii(	R$R%tpathlibR'tPurePathR(RlRRL(RGR.R�((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyRL+s
(RiRjR�RL(((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyR&s	(i(RCRYR$tdecimalRR~RR%R(R-R
R	RR3R5R8tobjectRRkRmRrR|R(((sI/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/toml/encoder.pyt<module>s"	4			k

Zerion Mini Shell 1.0