관리-도구
편집 파일: __init__.cpython-311.pyc
� �܋fI � � � d Z ddlZddlZej d dk Zej d dk Z eed� � Zd� Zd� Z d� Z g d �ZdS ) aj Various non-built-in utility functions and definitions for Py2 compatibility in Py3. For example: >>> # The old_div() function behaves like Python 2's / operator >>> # without "from __future__ import division" >>> from past.utils import old_div >>> old_div(3, 2) # like 3/2 in Py2 0 >>> old_div(3, 2.0) # like 3/2.0 in Py2 1.5 � N� � �pypy_translation_infoc �B � �� G �� fd�d� � � } |ddi � � S )a� Function from jinja2/_compat.py. License: BSD. Use it like this:: class BaseForm(object): pass class FormType(type): pass class Form(with_metaclass(FormType, BaseForm)): pass This requires a bit of explanation: the basic idea is to make a dummy metaclass for one level of class instantiation that replaces itself with the actual metaclass. Because of internal type checks we also need to make sure that we downgrade the custom metaclass for one level to something closer to type (that's why __call__ and __init__ comes back from type etc.). This has the advantage over six.with_metaclass of not introducing dummy classes into the final MRO. c �8 �� e Zd Zej Zej Z� �fd�ZdS )�!with_metaclass.<locals>.metaclassc �\ �� |�t � | |d|� � S �|�|� � S )N� )�type�__new__)�cls�name� this_bases�d�bases�metas ���J/opt/cloudlinux/venv/lib64/python3.11/site-packages/past/utils/__init__.pyr z)with_metaclass.<locals>.metaclass.__new__4 s5 �� ��!��|�|�C��r�1�5�5�5��4��e�Q�'�'�'� N)�__name__� __module__�__qualname__r �__call__�__init__r )r r s ��r � metaclassr 1 sA �� � � � � ��=���=�� (� (� (� (� (� (� (� (r r �temporary_classNr )r r r s `` r �with_metaclassr sT ��� �2(� (� (� (� (� (� (� (�D� (� (� (� �9�&��b�1�1�1r c �N � t | d� � r| � � � S | S )a� On Py2, this is a no-op: native(obj) -> obj On Py3, returns the corresponding native Py3 types that are superclasses for forward-ported objects from Py2: >>> from past.builtins import str, dict >>> native(str(b'ABC')) # Output on Py3 follows. On Py2, output is 'ABC' b'ABC' >>> type(native(str(b'ABC'))) bytes Existing native types on Py3 will be returned unchanged: >>> type(native(b'ABC')) bytes � __native__)�hasattrr )�objs r �nativer! ; s+ � �&