
    (ph=                     p    S r SSKrSSKr\R                  S:  rS r\" \S5      rS rS r	S r
S	 rSS
 jrg)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.
    N)      c                     [        U [        5      (       a  [        U S5      n [        U [        5      (       a  U $ [        S5      e)Nasciiz)name must be a string or ASCII-only bytes)
isinstancebytesstr	TypeError)names    I/var/www/html/venv/lib/python3.13/site-packages/zope/interface/_compat.py_normalize_namer      s9    $4!$
?
@@    pypy_version_infoc                  N    [         R                  R                  S5      n U S:H  nU$ )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%     zz~~m,HCIr   c                  \    [        5       (       a  SO[        4n  SSKJn  U$ ! U  a     gf = f)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!   2   s4     ,--BK>EJ s   " ++c                  `    [         R                  R                  S5      n U SL=(       a    U S:g  $ )z.
The opposite of `_c_optimizations_required`.
r   Nr   r   )r   s    r   _c_optimizations_ignoredr#   D   s*     zz~~m,H43HO3r   c                  p    [        [        S5      n [        5       (       a  gU (       a  g[        5       (       + $ )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sysr   r#   )is_pypys    r   _should_attempt_c_optimizationsr(   L   s/     c./G ""')))r   c                    ^ ^ T=(       d    T R                   mU=(       d     [        R                  " S5      R                  nUU 4S jnU" 5       nT UTS-   '   T UTS-   '   U$ )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                  h   > [        5       (       d  T$ [        5       n U (       d  T$ U n[        U T5      $ )N)r(   r!   getattr)r    __traceback_info__r   py_impls     r   	find_impl_use_c_impl.<locals>.find_implz   s4    .00N*,N"ud##r   PyFallback)__name__r&   	_getframe	f_globals)r.   r   globsr/   c_impls   ``   r   _use_c_implr8   \   s`    6 #7##D/S]]1%//E	$ [F !E$+&E$
Mr   )NN)__doc__r   r&   version_infoPY313_OR_OLDERr   r%   PYPYr   r!   r#   r(   r8   r   r   r   <module>r=      sR    
 
 !!G+A s'($4* /r   