\drdZdgZddlmZddlmZGddeZgZdZdZ e dZ e d Z e d Z e d Z e d Ze d Ze dZe dZe dZe dZe dZe dZe dZdS)z/Class representing image/* type MIME documents. MIMEImage)encoders)MIMENonMultipartc.eZdZdZdejfdddZdS)rz1Class for generating image/* type MIME documents.N)policyc |t|n|}|tdtj|d|fd|i|||||dS)aCreate an image/* type MIME document. _imagedata contains the bytes for the raw image data. If the data type can be detected (jpeg, png, gif, tiff, rgb, pbm, pgm, ppm, rast, xbm, bmp, webp, and exr attempted), then the subtype will be automatically included in the Content-Type header. Otherwise, you can specify the specific image subtype via the _subtype parameter. _encoder is a function which will perform the actual encoding for transport of the image data. It takes one argument, which is this Image instance. It should use get_payload() and set_payload() to change the payload to the encoded form. It should also add any Content-Transfer-Encoding or other headers to the message as necessary. The default encoding is Base64. Any additional keyword arguments are passed to the base class constructor, which turns them into parameters on the Content-Type header. Nz"Could not guess image MIME subtypeimager)_what TypeErrorr__init__ set_payload)self _imagedata_subtype_encoderr_paramss !..\python\lib\email\mime\image.pyr zMIMEImage.__init__s*)1(85$$$h  @AA A!$ - -& -$+ - - - $$$)__name__ __module__ __qualname____doc__r encode_base64r rrrr sD;;,0"0<@rc<tD]}||x}r|cSdSN)_rules)dataruleress rr r 2s;$t** 3 JJJ trc:t||Sr)rappend)rulefuncs rrr:s MM( OrcB|dddvrdS|dddkrdSdS)z1JPEG data with JFIF or Exif markers; and raw JPEG )sJFIFsExifjpegNsrhs r_jpegr+?s> 2w$$$v 2A2% % %v & %rc4|drdSdS)NsPNG  png startswithr)s r_pngr0Hs&||())urc"|dddvrdSdS)zGIF ('87 and '89 variants)Nr%)sGIF87asGIF89agifrr)s r_gifr3Ns% !u&&&u'&rc"|dddvrdSdS)z-TIFF (can be in Motorola or Intel byte order)N)sMMsIItiffrr)s r_tiffr7Us$ !uvrc4|drdSdS)zSGI image librarysrgbNr.r)s r_rgbr:\' ||K  urct|dkr/|dtdkr|ddvr|ddvrdSd Sd Sd Sd S) zPBM (portable bitmap)rPs14r5 pbmNlenordr)s r_pbmrEc^ 1vv{{ aDCII  !A$%--AaDJ4F4Fu{  --4F4Frct|dkr/|dtdkr|ddvr|ddvrdSd Sd Sd Sd S) zPGM (portable graymap)r=rr>r?s25r5r@pgmNrBr)s r_pgmrIkrFrct|dkr/|dtdkr|ddvr|ddvrdSd Sd Sd Sd S) zPPM (portable pixmap)r=rr>r?s36r5r@ppmNrBr)s r_ppmrLsrFrc4|drdSdS)zSun raster filesYjrastNr.r)s r_rastrO{s( ||'((vrc4|drdSdS)zX bitmap (X10 or X11)s#define xbmNr.r)s r_xbmrRr;rc4|drdSdS)NsBMbmpr.r)s r_bmprUs%||EurcT|dr|dddkrdSdSdS)NsRIFF sWEBPwebpr.r)s r_webprZs=||G1R4G!3!3v!3!3rc4|drdSdS)Nsv/1exrr.r)s r_exrr]s&||'((urN)r__all__emailremail.mime.nonmultipartrrrr rr+r0r3r7r:rErIrLrOrRrUrZr]rrrras 65 -444444 B          r