File: //usr/local/lib/python3.9/site-packages/past/builtins/__pycache__/misc.cpython-39.pyc
a
��?h� � @ sb d dl mZ d dlZd dlZd dlZd dlZd dlmZmZm Z erRd dl
mZ nd dlmZ er�d dl
Z
d dlmZ dd� Zd dlmZ dd � Zd
d� Zd dlmZ d
d� ZeZejdkr�d dlmZ nd dlmZ eZeZeZnVd dl Z d dl
mZ e jZe jZe jZe j!Z!e jZe jZe jZe jZe jZe jZe jZe�rJddd�Z!e�rZg d�Z"ng Z"dS )� )�unicode_literalsN)�PY2�PY3�exec_)�Mappingc O s | |i |��S �N� )�f�args�kwr r �</usr/local/lib/python3.9/site-packages/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
s� t � t�rt �t�rtd��z�t � tj�rjt�� �rjt �tj�sTtdjt��d���t �t �rdW dS W dS t �tj�r�t���r�t � tj�s�tdjt� �d���t � t �r�W dS W dS � �k� �k W S t�y� � �kr�Y dS td �tjt
tttt
fg}d }}t|�D ]*\}}t � |��r&|}t �|��r|}�qt||�dk�r|t � t
��rvt �t��rvt� �d
��� Y S t �t
��r�t � t��r�t� ��d
�� Y S t � t��r�t� ��D ]*\}}t||�} | dk�r�| Y S �q�Y dS t � t
��r|t� �t��k�rtt� �t��� Y S t� �fdd�� D ��}
t� �fd
d��D ��}|
|k�rft|
|� Y S t� |
�| � Y S t||� Y S 0 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
zcannot compare sets using cmp()z.cannot compare float("nan"), {type_y} with cmp)Ztype_y� ���z.cannot compare {type_x}, float("nan") with cmp)Ztype_xr N�asciic 3 s* | ]"}|�vs� | �| kr|V qd S r r )�.0�a��x�yr r � <genexpr>Z � zcmp.<locals>.<genexpr>c 3 s* | ]"}|� vs� | �| kr|V qd S r r )r �br r r r [ r )�
isinstance�set� TypeError�numbers�Number�math�isnan�format�type�int�dict�listr r � enumerate�cmp�decode�zip�len�min)r r Z
type_orderZx_type_indexZy_type_indexr Z
type_matchZx_elemZy_elemZelem_cmp_valZx_keyZy_keyr r r r+ sf
�
r+ )�internc C s dt �| �dd� S )zUoct(number) -> string
Return the octal representation of an integer
�0� N)�builtins�oct)�numberr r r r4 d s r4 )� � )�reloadc C s� |du r*t �� d }|d j}|d j}n|du r6|}t|t�sHtd��t|t�sZtd��t| d��}|�� }W d � n1 s�0 Y t || d�}t
|||� dS )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 zglobals must be a mappingzlocals must be a mapping�rb�exec)�inspect�stack� f_globals�f_localsr r r �open�read�compiler )�filenameZ myglobalsZmylocalsZcaller_frameZfin�source�coder r r �execfile� s
&rE )
r
r r+ rE r0 � raw_inputr8 �unichr�unicode�xrange)NN)#�
__future__r r; �sysr# r! Zfuture.utilsr r r �collectionsr �collections.abcr3 r
Z
past.builtinsr r r r+ r0 r4 �inputrF �version_info� importlibr8 �imprH rG �rangerI �__builtin__rE �__all__r r r r �<module> sT C