%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/zope/interface/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/zope/interface/__pycache__/_compat.cpython-312.pyc

�

��e��P�dZddlZddlZd�Zeed�Zd�Zd�Zd�Zd�Z	d
d	�Z
y)z�
Support functions for dealing with differences in platforms, including Python
versions and implementations.

This file should have no imports from the rest of zope.interface because it is
used during early bootstrapping.
�Nc�t�t|t�rt|d�}t|t�r|Std��)N�asciiz)name must be a string or ASCII-only bytes)�
isinstance�bytes�str�	TypeError)�names �8/usr/lib/python3/dist-packages/zope/interface/_compat.py�_normalize_namers3���$����4��!���$�����
�?�
@�@��pypy_version_infoc�N�tjjd�}|dk(}|S)z�
    Return a true value if the C optimizations are required.

    This uses the ``PURE_PYTHON`` variable as documented in `_use_c_impl`.
    �PURE_PYTHON�0��os�environ�get)�pure_env�	require_cs  r
�_c_optimizations_requiredr#s%���z�z�~�~�m�,�H��C��I��rc�P�t�rdntf}	ddlm}|S#|$rYywxYw)z�
    Return the C optimization module, if available, otherwise
    a false value.

    If the optimizations are required but not available, this
    raises the ImportError.

    This does not say whether they should be used or not.
    �r)�_zope_interface_coptimizationsF)r�ImportError�zope.interfacer)�catch�c_opts  r
�_c_optimizations_availabler.s1��,�-�B�K�>�E��J��������s��%�%c�V�tjjd�}|duxr|dk7S)z6
    The opposite of `_c_optimizations_required`.
    rNrr)rs r
�_c_optimizations_ignoredr!@s*���z�z�~�~�m�,�H��4��3�H��O�3rc�T�ttd�}t�ry|ryt�S)z�
    Return a true value if we should attempt to use the C optimizations.

    This takes into account whether we're on PyPy and the value of the
    ``PURE_PYTHON`` environment variable, as defined in `_use_c_impl`.
    r
TF)�hasattr�sysrr!)�is_pypys r
�_should_attempt_c_optimizationsr&Hs,���c�.�/�G� �"����'�)�)�)rc�����xs�j�|xstjd�j}��fd�}|�}�|�dz<�|�dz<|S)a
    Decorator. Given an object implemented in Python, with a name like
    ``Foo``, import the corresponding C implementation from
    ``zope.interface._zope_interface_coptimizations`` with the name
    ``Foo`` and use it instead.

    If the ``PURE_PYTHON`` environment variable is set to any value
    other than ``"0"``, or we're on PyPy, ignore the C implementation
    and return the Python version. If the C implementation cannot be
    imported, return the Python version. If ``PURE_PYTHON`` is set to
    0, *require* the C implementation (let the ImportError propagate);
    note that PyPy can import the C implementation in this case (and all
    tests pass).

    In all cases, the Python version is kept available. in the module
    globals with the name ``FooPy`` and the name ``FooFallback`` (both
    conventions have been used; the C implementation of some functions
    looks for the ``Fallback`` version, as do some of the Sphinx
    documents).

    Example::

        @_use_c_impl
        class Foo(object):
            ...
    �c�T��t�s�St�}|s�S|}t|��S)N)r&r�getattr)r�__traceback_info__r	�py_impls  ��r
�	find_implz_use_c_impl.<locals>.find_implvs1���.�0��N�*�,����N�"���u�d�#�#r�Py�Fallback)�__name__r$�	_getframe�	f_globals)r,r	�globsr-�c_impls``   r
�_use_c_implr5Xs`���6�#�7�#�#�D��/�S�]�]�1�%�/�/�E�	$��[�F�!�E�$��+��&�E�$��
���Mr)NN)�__doc__rr$rr#�PYPYrrr!r&r5rrr
�<module>r8s@���
�
�A��s�'�(����$4�
*� /r

Zerion Mini Shell 1.0