HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/docx/parts/__pycache__/image.cpython-310.pyc
o

$we�	�@sTdZddlmZddlZddlmZddlmZddlm	Z	m
Z
Gdd�de�ZdS)	z7The proxy class for an image part, and related objects.�)�annotationsN)�Image)�Part)�Emu�Inchescs|eZdZdZ	dd�fd
d�
Zedd
��Zedd��Zedd��Ze	dd��Z
eddd��Ze	dd��Zedd��Z
�ZS)�	ImagePartzlAn image part.

    Corresponds to the target part of a relationship with type RELATIONSHIP_TYPE.IMAGE.
    N�partname�str�content_type�blob�bytes�image�Image | Nonecstt|��|||�||_dS�N)�superr�__init__�_image)�selfrr
rr
��	__class__��I/home/arjun/projects/env/lib/python3.10/site-packages/docx/parts/image.pyrs
zImagePart.__init__cCs |jj}|jj}||}t|�S)zkNative width of this image, calculated from its width in pixels and
        horizontal dots per inch (dpi).)r
�px_width�horz_dpir)rrr�width_in_inchesrrr�
default_cxszImagePart.default_cxcCs$|jj}|jj}d||}t|�S)zkNative height of this image, calculated from its height in pixels and
        vertical dots per inch (dpi).i��
)r
�	px_heightrr)rrr�
height_in_emurrr�
default_cy!szImagePart.default_cycCs|jdur	|jjSd|jjS)a?Filename from which this image part was originally created.

        A generic name, e.g. 'image.png', is substituted if no name is available, for
        example when the image was loaded from an unnamed stream. In that case a default
        extension is applied based on the detected MIME type of the image.
        Nzimage.%s)r�filenamer�ext�rrrrr*s
zImagePart.filenamecCst||j|j|�S)zZReturn an |ImagePart| instance newly created from `image` and assigned
        `partname`.)rr
r)�clsr
rrrr�
from_image6szImagePart.from_image�returnrcCs|jdurt�|j�|_|jSr)rr�	from_blobrr!rrrr
<s
zImagePart.imagecCs||||�S)zCalled by ``docx.opc.package.PartFactory`` to load an image part from a
        package being opened by ``Document(...)`` call.r)r"rr
r�packagerrr�loadBszImagePart.loadcCst�|j���S)z0SHA1 hash digest of the blob of this image part.)�hashlib�sha1�_blob�	hexdigestr!rrrr)HszImagePart.sha1r)rr	r
r	rrr
r)r$r)�__name__�
__module__�__qualname__�__doc__r�propertyrrr�classmethodr#r
r'r)�
__classcell__rrrrrs$�




r)r/�
__future__rr(�docx.image.imager�
docx.opc.partr�docx.sharedrrrrrrr�<module>s