3
‡ŒðiÞ  ã            
   @   sr  d dl mZ d dlZd dlZd dlZd dlZd dlmZmZm	Z	 erRd dl
mZ nd dlmZ eräd dlZd dlmZ dd„ Zd dlmZ dd	„ Zd
d„ Zd dlmZ dd„ ZeZejdkrÊd dlmZ nd dlmZ eZeZeZnVd dl Z d dl
mZ e jZe jZe jZe j!Z!e jZe jZe jZe jZe jZe jZe jZe�rJddd„Z!e�rjdd	ddddddddg
Z"ng Z"dS )é    )Úunicode_literalsN)ÚPY2ÚPY3Úexec_)ÚMappingc             O   s
   | ||ŽS )N© )ÚfÚargsÚkwr   r   ú4/tmp/pip-build-6m2fasei/future/past/builtins/misc.pyÚapply   s    r   )Ústrc             C   s   t t| fƒƒS )zU
        Return a byte-string of one character with ordinal i; 0 <= i <= 256
        )ÚoldstrÚbytes)Úir   r   r   Úchr   s    r   c                sl  t ˆ tƒrt ˆtƒrtdƒ‚y t ˆ tjƒrftjˆ ƒrft ˆtjƒsTtdjtˆƒd�ƒ‚t ˆt	ƒrbdS dS t ˆtjƒr®tjˆƒr®t ˆ tjƒsœtdjtˆ ƒd�ƒ‚t ˆ t	ƒrªdS dS ˆ ˆkˆ ˆk  S  tk
�rf   ˆ ˆkrÚdS tdƒtjt
ttttfg}d }}x6t|ƒD ]*\}}t ˆ |ƒ�r|}t ˆ|ƒ�r|}�qW t||ƒdk�r\t ˆ tƒ�rlt ˆtƒ�rltˆ jd	ƒˆƒS t ˆtƒ�r”t ˆ tƒ�r”tˆ ˆjd	ƒƒS t ˆ tƒ�rÖx0tˆ ˆƒD ]"\}}t||ƒ}	|	dk�r¬|	S �q¬W dS t ˆ t
ƒ�r\tˆ ƒtˆƒk�rttˆ ƒtˆƒƒS t‡ ‡fd
d„ˆ D ƒƒ}
t‡ ‡fdd„ˆD ƒƒ}|
|k�rJt|
|ƒS tˆ |
 ˆ| ƒS t||ƒS X dS )zí
        cmp(x, y) -> integer

        Return negative if x<y, zero if x==y, positive if x>y.
        Python2 had looser comparison allowing cmp None and non Numerical types and collections.
        Try to match the old behavior
        zcannot compare sets using cmp()z.cannot compare float("nan"), {type_y} with cmp)Ztype_yé   z.cannot compare {type_x}, float("nan") with cmp)Ztype_xr   NÚasciic             3   s*   | ]"}|ˆksˆ | ˆ| kr|V  qd S )Nr   )Ú.0Úa)ÚxÚyr   r   ú	<genexpr>Z   s    zcmp.<locals>.<genexpr>c             3   s*   | ]"}|ˆ ksˆ | ˆ| kr|V  qd S )Nr   )r   Úb)r   r   r   r   r   [   s    éÿÿÿÿr   )Ú
isinstanceÚsetÚ	TypeErrorÚnumbersÚNumberÚmathÚisnanÚformatÚtypeÚintÚdictÚlistr   r   Ú	enumerateÚcmpÚdecodeÚzipÚlenÚmin)r   r   Z
type_orderZx_type_indexZy_type_indexr   Z
type_matchZx_elemZy_elemZelem_cmp_valZx_keyZy_keyr   )r   r   r   r(      sd    








r(   )Úinternc             C   s   dt j| ƒdd…  S )zUoct(number) -> string

        Return the octal representation of an integer
        Ú0é   N)ÚbuiltinsÚoct)Únumberr   r   r   r1   d   s    r1   é   é   )Úreloadc             C   s”   |dkr*t jƒ d }|d j}|d j}n|dkr6|}t|tƒsHtdƒ‚t|tƒsZtdƒ‚t| dƒ�}|jƒ }W dQ R X t	|| dƒ}t
|||ƒ dS )zï
        Read and execute a Python script from a file in the given namespaces.
        The globals and locals are dictionaries, defaulting to the current
        globals and locals. If only globals is given, locals defaults to it.
        Nr   r   zglobals must be a mappingzlocals must be a mappingÚrbÚexec)ÚinspectÚstackÚ	f_globalsÚf_localsr   r   r   ÚopenÚreadÚcompiler   )ÚfilenameZ	myglobalsZmylocalsZcaller_frameZfinÚsourceÚcoder   r   r   Úexecfile†   s    


rB   r-   Ú	raw_inputr5   ÚunichrÚunicodeÚxrange)r3   r4   )NN)#Ú
__future__r   r8   Úsysr    r   Zfuture.utilsr   r   r   Úcollectionsr   Úcollections.abcr0   r   Zpast.builtinsr   r   r   r(   r-   r1   ÚinputrC   Úversion_infoÚ	importlibr5   ÚimprE   rD   ÚrangerF   Ú__builtin__rB   Ú__all__r   r   r   r   Ú<module>   sV   C

