ó
    "%vg¦.  ã                  ó  • S SK Jr  S SKrS SKJr  S SKJrJr  SSKJ	r	J
r
  SSKJr   " S S	5      rSS
 jrSS jrSS jrSS jrSS jrSS jrSS jr\\\\\\\S.r0 4       SS jjr0 4       SS jjr0 4       SS jjrg)é    )ÚannotationsN)ÚCodeType)ÚAnyÚCallableé   )ÚImageÚ_imagingmath)Ú	deprecatec                  ó†  • \ rS rSrSrS'S jrS(S jr  S)         S*S jjrS+S jrS,S jr	S,S	 jr
S,S
 jrS-S jrS-S jrS-S jrS-S jrS-S jrS-S jrS-S jrS-S jrS-S jrS-S jrS-S jrS-S jrS,S jrS-S jrS-S jrS-S jrS-S jrS-S jrS-S jrS-S jrS-S jr S-S  jr!S-S! jr"S-S" jr#S-S# jr$S-S$ jr%S-S% jr&S&r'g).Ú_Operandé   z4Wraps an image operand, providing standard operatorsc                ó   • Xl         g ©N©Úim)Úselfr   s     Ú//usr/lib/python3/dist-packages/PIL/ImageMath.pyÚ__init__Ú_Operand.__init__   s   € Ø�ó    c                óD  • [        U[        5      (       a  UR                  R                  S;   a  UR                  R	                  S5      $ UR                  R                  S;   a  UR                  $ SUR                  R                   3n[        U5      e[        U[        [        45      (       aF  U R                  R                  S;   a,  [        R                  " SU R                  R                  U5      $ [        R                  " SU R                  R                  U5      $ )N)Ú1ÚLÚI)r   ÚFzunsupported mode: )r   r   r   r   )Ú
isinstancer   r   ÚmodeÚconvertÚ
ValueErrorÚintÚfloatr   ÚnewÚsize)r   Úim1Úmsgs      r   Ú__fixupÚ_Operand.__fixup!   sÁ   € ä�cœ8×$Ñ$à�v‰v�{‰{˜jÓ(Ø—v‘v—~‘~ cÓ*Ð*Ø—‘—‘ 
Ó*Ø—v‘v�à*¨3¯6©6¯;©;¨-Ð8�Ü  “oÐ%ô ˜#¤¤U˜|×,Ñ,°·±·±ÀÓ1PÜ—y’y  d§g¡g§l¡l°CÓ8Ð8ä—y’y  d§g¡g§l¡l°CÓ8Ð8r   Nc                óH  • U R                  U5      nUcŠ  [        R                  " U=(       d    UR                  UR                  S 5      n [        [        U SUR                   35      n[        R                  " XR                  5       UR                  5       5        GO²U R                  U5      n	UR                  U	R                  :w  aB  UR                  S:w  a  UR                  S5      nU	R                  S:w  a  U	R                  S5      n	UR                  U	R                  :w  a”  [        UR                  S   U	R                  S   5      [        UR                  S   U	R                  S   5      4n
UR                  U
:w  a  UR                  SU
-   5      nU	R                  U
:w  a  U	R                  SU
-   5      n	[        R                  " U=(       d    UR                  UR                  S 5      n [        [        U SUR                   35      n[        R                  " XR                  5       UR                  5       U	R                  5       5        [        U5      $ ! [         a  nSU S3n[        U5      UeS nAff = f! [         a  nSU S3n[        U5      UeS nAff = f)NÚ_zbad operand type for 'Ú'r   r   r   )r   r   )Ú_Operand__fixupr   r"   r   r#   Úgetattrr	   ÚAttributeErrorÚ	TypeErrorÚunopÚgetimr   ÚminÚcropÚbinopr   )r   Úopr$   Úim2r   Úim_1ÚoutÚer%   Úim_2r#   s              r   ÚapplyÚ_Operand.apply3   s  € ð �|‰|˜CÓ ˆØ‰;ä—)’)˜D×- D§I¡I¨t¯y©y¸$Ó?ˆCð,Üœ\¨b¨T°°4·9±9°+Ð+>Ó?�ô ×Ò˜b§)¡)£+¨t¯z©z«|Ö<ð —<‘< Ó$ˆDØ�y‰y˜DŸI™IÓ%à—9‘9 Ó#ØŸ<™<¨Ó,�DØ—9‘9 Ó#ØŸ<™<¨Ó,�DØ�y‰y˜DŸI™IÓ%ô ˜Ÿ	™	 !™ d§i¡i°¡lÓ3Ü˜Ÿ	™	 !™ d§i¡i°¡lÓ3ð�ð —9‘9 Ó$ØŸ9™9 V¨d¡]Ó3�DØ—9‘9 Ó$ØŸ9™9 V¨d¡]Ó3�DÜ—)’)˜D×- D§I¡I¨t¯y©y¸$Ó?ˆCð,Üœ\¨b¨T°°4·9±9°+Ð+>Ó?�ô ×Ò˜r§9¡9£;°·
±
³¸d¿j¹j»lÔKÜ˜‹}Ðøô= "ó ,Ø.¨r¨d°!Ð4�Ü “n¨!Ð+ûð,ûô4 "ó ,Ø.¨r¨d°!Ð4�Ü “n¨!Ð+ûð,ús0   ÁI Ç0J  É
I=É&I8É8I=Ê 
J!Ê
JÊJ!c                ó:   • U R                   R                  5       S L$ r   )r   Úgetbbox©r   s    r   Ú__bool__Ú_Operand.__bool__a   s   € à�w‰w�‰Ó ¨Ð,Ð,r   c                ó&   • U R                  SU 5      $ )NÚabs©r:   r>   s    r   Ú__abs__Ú_Operand.__abs__e   ó   € Ø�z‰z˜% Ó&Ð&r   c                ó   • U $ r   © r>   s    r   Ú__pos__Ú_Operand.__pos__h   s   € Øˆr   c                ó&   • U R                  SU 5      $ )NÚnegrC   r>   s    r   Ú__neg__Ú_Operand.__neg__k   rF   r   c                ó&   • U R                  SX5      $ ©NÚaddrC   ©r   Úothers     r   Ú__add__Ú_Operand.__add__o   ó   € Ø�z‰z˜% Ó-Ð-r   c                ó&   • U R                  SX5      $ rP   rC   rR   s     r   Ú__radd__Ú_Operand.__radd__r   ó   € Ø�z‰z˜% Ó-Ð-r   c                ó&   • U R                  SX5      $ ©NÚsubrC   rR   s     r   Ú__sub__Ú_Operand.__sub__u   rV   r   c                ó&   • U R                  SX5      $ r\   rC   rR   s     r   Ú__rsub__Ú_Operand.__rsub__x   rZ   r   c                ó&   • U R                  SX5      $ ©NÚmulrC   rR   s     r   Ú__mul__Ú_Operand.__mul__{   rV   r   c                ó&   • U R                  SX5      $ rd   rC   rR   s     r   Ú__rmul__Ú_Operand.__rmul__~   rZ   r   c                ó&   • U R                  SX5      $ ©NÚdivrC   rR   s     r   Ú__truediv__Ú_Operand.__truediv__�   rV   r   c                ó&   • U R                  SX5      $ rl   rC   rR   s     r   Ú__rtruediv__Ú_Operand.__rtruediv__„   rZ   r   c                ó&   • U R                  SX5      $ ©NÚmodrC   rR   s     r   Ú__mod__Ú_Operand.__mod__‡   rV   r   c                ó&   • U R                  SX5      $ rt   rC   rR   s     r   Ú__rmod__Ú_Operand.__rmod__Š   rZ   r   c                ó&   • U R                  SX5      $ ©NÚpowrC   rR   s     r   Ú__pow__Ú_Operand.__pow__�   rV   r   c                ó&   • U R                  SX5      $ r|   rC   rR   s     r   Ú__rpow__Ú_Operand.__rpow__�   rZ   r   c                ó&   • U R                  SU 5      $ )NÚinvertrC   r>   s    r   Ú
__invert__Ú_Operand.__invert__”   s   € Ø�z‰z˜( DÓ)Ð)r   c                ó&   • U R                  SX5      $ ©NÚandrC   rR   s     r   Ú__and__Ú_Operand.__and__—   rV   r   c                ó&   • U R                  SX5      $ rˆ   rC   rR   s     r   Ú__rand__Ú_Operand.__rand__š   rZ   r   c                ó&   • U R                  SX5      $ ©NÚorrC   rR   s     r   Ú__or__Ú_Operand.__or__�   ó   € Ø�z‰z˜$ Ó,Ð,r   c                ó&   • U R                  SX5      $ r�   rC   rR   s     r   Ú__ror__Ú_Operand.__ror__    s   € Ø�z‰z˜$ Ó,Ð,r   c                ó&   • U R                  SX5      $ ©NÚxorrC   rR   s     r   Ú__xor__Ú_Operand.__xor__£   rV   r   c                ó&   • U R                  SX5      $ r™   rC   rR   s     r   Ú__rxor__Ú_Operand.__rxor__¦   rZ   r   c                ó&   • U R                  SX5      $ )NÚlshiftrC   rR   s     r   Ú
__lshift__Ú_Operand.__lshift__©   ó   € Ø�z‰z˜( DÓ0Ð0r   c                ó&   • U R                  SX5      $ )NÚrshiftrC   rR   s     r   Ú
__rshift__Ú_Operand.__rshift__¬   r¤   r   c                ó&   • U R                  SX5      $ )NÚeqrC   rR   s     r   Ú__eq__Ú_Operand.__eq__°   r”   r   c                ó&   • U R                  SX5      $ )NÚnerC   rR   s     r   Ú__ne__Ú_Operand.__ne__³   r”   r   c                ó&   • U R                  SX5      $ )NÚltrC   rR   s     r   Ú__lt__Ú_Operand.__lt__¶   r”   r   c                ó&   • U R                  SX5      $ )NÚlerC   rR   s     r   Ú__le__Ú_Operand.__le__¹   r”   r   c                ó&   • U R                  SX5      $ )NÚgtrC   rR   s     r   Ú__gt__Ú_Operand.__gt__¼   r”   r   c                ó&   • U R                  SX5      $ )NÚgerC   rR   s     r   Ú__ge__Ú_Operand.__ge__¿   r”   r   r   )r   úImage.Image)r$   ú_Operand | floatÚreturnrÁ   )NN)
r4   Ústrr$   rÂ   r5   ú_Operand | float | Noner   z
str | NonerÃ   r   )rÃ   Úbool)rÃ   r   )rS   rÂ   rÃ   r   )(Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r+   r:   r?   rD   rI   rM   rT   rX   r^   ra   rf   ri   rn   rq   rv   ry   r~   r�   r…   rŠ   r�   r’   r–   r›   rž   r¢   r§   r«   r¯   r³   r·   r»   r¿   Ú__static_attributes__rH   r   r   r   r      sè   † Ù>ôô9ð, (,Øð+àð+ð ð+ð %ð	+ð
 ð+ð 
õ+ô\-ô'ôô'ô.ô.ô.ô.ô.ô.ô.ô.ô.ô.ô.ô.ô*ô.ô.ô-ô-ô.ô.ô1ô1ô-ô-ô-ô-ô-÷-r   r   c                óJ   • [        U R                  R                  S5      5      $ )Nr   ©r   r   r   r>   s    r   Úimagemath_intrÏ   Ä   ó   € Ü�D—G‘G—O‘O CÓ(Ó)Ð)r   c                óJ   • [        U R                  R                  S5      5      $ )Nr   rÎ   r>   s    r   Úimagemath_floatrÒ   È   rÐ   r   c                ó$   • U R                  SXSS9$ )Nrª   r   ©r   rC   rR   s     r   Úimagemath_equalrÕ   Í   ó   € Ø�:‰:�d˜D¨cˆ:Ð2Ð2r   c                ó$   • U R                  SXSS9$ )Nr®   r   rÔ   rC   rR   s     r   Úimagemath_notequalrØ   Ñ   rÖ   r   c                ó&   • U R                  SX5      $ )Nr1   rC   rR   s     r   Úimagemath_minrÚ   Õ   ó   € Ø�:‰:�e˜TÓ)Ð)r   c                ó&   • U R                  SX5      $ )NÚmaxrC   rR   s     r   Úimagemath_maxrÞ   Ù   rÛ   r   c                óJ   • [        U R                  R                  U5      5      $ r   rÎ   )r   r   s     r   Úimagemath_convertrà   Ý   s   € Ü�D—G‘G—O‘O DÓ)Ó*Ð*r   )r    r!   ÚequalÚnotequalr1   rÝ   r   c                ór  • U(       a  [        SSS5        [        R                  5       nUR                  U5        UR                  U5        UR	                  5        H3  u  pE[        U[        R                  5      (       d  M&  [        U5      X4'   M5     U " U5      n UR                  $ ! [         a    Us $ f = f)a”  
Returns the result of an image function.

:py:mod:`~PIL.ImageMath` only supports single-layer images. To process multi-band
images, use the :py:meth:`~PIL.Image.Image.split` method or
:py:func:`~PIL.Image.merge` function.

:param expression: A function that receives a dictionary.
:param options: Values to add to the function's dictionary. Deprecated.
                You can instead use one or more keyword arguments.
:param **kw: Values to add to the function's dictionary.
:return: The expression result. This is usually an image object, but can
         also be an integer, a floating point value, or a pixel tuple,
         depending on the expression.
zImageMath.lambda_eval optionsé   z'ImageMath.lambda_eval keyword arguments)
r
   ÚopsÚcopyÚupdateÚitemsr   r   r   r   r-   )Ú
expressionÚoptionsÚkwÚargsÚkÚvr7   s          r   Úlambda_evalrï   ì   s˜   € ö* ÜØ+ØØ5ô	
ô Ÿ8™8›:€DØ‡K�K�ÔØ‡K�K�„OØ—
‘
–‰ˆÜ�aœŸ™×%Ó%Ü˜q“kˆD‹Gñ ñ �TÓ
€CðØ�v‰vˆøÜó ØŠ
ðús   ÂB' Â'B6Â5B6c                ó´  ^^^	• U(       a  [        SSS5        [        R                  5       m[        UR	                  5       5      [        UR	                  5       5      -    H/  nSU;   d  [        [        U5      (       d  M   SU S3n[        U5      e   TR                  U5        TR                  U5        TR                  5        H4  u  p5[        U[        R                  5      (       d  M&  [        U5      TU'   M6     [        U SS5      mSUUU	4S	 jjm	T	" T5        [        R                  " U S
S[        00T5      n UR                   $ ! ["         a    Us $ f = f)a�  
Evaluates an image expression. This uses Python's ``eval()`` function to process
the expression string, and carries the security risks of doing so. It is not
recommended to process expressions without considering this.
:py:meth:`~lambda_eval` is a more secure alternative.

:py:mod:`~PIL.ImageMath` only supports single-layer images. To process multi-band
images, use the :py:meth:`~PIL.Image.Image.split` method or
:py:func:`~PIL.Image.merge` function.

:param expression: A string containing a Python-style expression.
:param options: Values to add to the evaluation context. Deprecated.
                You can instead use one or more keyword arguments.
:param **kw: Values to add to the evaluation context.
:return: The evaluated expression. This is usually an image object, but can
         also be an integer, a floating point value, or a pixel tuple,
         depending on the expression.
zImageMath.unsafe_eval optionsrä   z'ImageMath.unsafe_eval keyword argumentsÚ__r*   ú' not allowedz<string>Úevalc                óÒ   >• U R                    H$  n[        U5      [        T5      L d  M  T" U5        M&     U R                   H"  nUT;  d  M  US:w  d  M  SU S3n[        U5      e   g )NrB   r*   rò   )Ú	co_constsÚtypeÚco_namesr   )ÚcodeÚconstÚnamer%   rì   Úcompiled_codeÚscans       €€€r   rü   Úunsafe_eval.<locals>.scanD  s_   ø€ Ø—^”^ˆEÜ�E‹{œd =Ó1Ô1Ù�U–ñ $ð —M”MˆDØ˜4Õ D¨E¥MØ˜$˜˜}Ð-�Ü  “oÐ%ò "r   Ú
__builtinsrB   )rø   r   rÃ   ÚNone)r
   rå   ræ   ÚlistÚkeysÚhasattrÚbuiltinsr   rç   rè   r   r   r   Úcompileró   rB   r   r-   )
ré   rê   rë   rí   r%   rî   r7   rì   rû   rü   s
          @@@r   Úunsafe_evalr    s  ú€ ö0 ÜØ+ØØ5ô	
ô Ÿ8™8›:€DÜ�'—,‘,“.Ó!¤D¨¯©«£OÔ3ˆØ�1‹9œ¤¨!×,Ó,Ø�a�S˜Ð&ˆCÜ˜S“/Ð!ñ 4ð
 	‡K�K�ÔØ‡K�K�„OØ—
‘
–‰ˆÜ�aœŸ™×%Ó%Ü˜q“kˆD�‹Gñ ô ˜J¨
°FÓ;€M÷&ñ &ñ 	ˆÔÜ
�-Š-˜
 \°E¼3°<Ð$@À$Ó
G€CðØ�v‰vˆøÜó ØŠ
ðús   Ä<E ÅEÅEc                ó4   • [        SSS5        [        X40 UD6$ )a  
Evaluates an image expression.

Deprecated. Use lambda_eval() or unsafe_eval() instead.

:param expression: A string containing a Python-style expression.
:param _dict: Values to add to the evaluation context.  You
              can either use a dictionary, or one or more keyword
              arguments.
:return: The evaluated expression. This is usually an image object, but can
         also be an integer, a floating point value, or a pixel tuple,
         depending on the expression.

..  deprecated:: 10.3.0
zImageMath.evalrä   z.ImageMath.lambda_eval or ImageMath.unsafe_eval)r
   r  )ré   Ú_dictrë   s      r   ró   ró   V  s'   € ô* ØØ
Ø8ôô
 �zÑ/¨BÑ/Ð/r   )r   r   rÃ   r   )r   r   rS   rÅ   rÃ   r   )r   r   r   rÄ   rÃ   r   )ré   zCallable[[dict[str, Any]], Any]rê   údict[str, Any]rë   r   rÃ   r   )ré   rÄ   rê   r  rë   r   rÃ   r   )ré   rÄ   r  r  rë   r   rÃ   r   )Ú
__future__r   r  Útypesr   Útypingr   r   Ú r   r	   Ú
_deprecater
   r   rÏ   rÒ   rÕ   rØ   rÚ   rÞ   rà   rå   rï   r  ró   rH   r   r   Ú<module>r     só   ðõ" #ã Ý ß  ç !Ý !÷e-ñ e-ôR*ô*ô
3ô3ô*ô*ô+ð
 ØØØ"ØØØ ñ€ð !ð'Ø/ð'àð'ð ð'ð 	õ	'ðX !ð=Øð=àð=ð ð=ð 	õ	=ðD ð0Øð0àð0ð ð0ð 	ö	0r   