Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
ImageMath.cpython-313.pyc75 linesDownload Raw Back to __pycache__
1�

2v�j�)����SSKJr SSKrSSKJrJr Sr\(aSSKJr SSK	J3r4 SSKJr "S	S55r
SSjrSSjrSS
jrSSjrSSjrSSjrSSjr\\\\\\\S.rSSjrSSjrg)�)�annotationsN�)�Image�_imagingmathF)�Callable)�CodeType)�Anyc��\rSrSrSrS'SjrS(SjrS)S*SjjrS+SjrS,Sjr	S,S	jr6S,S7jrS-SjrS-Sjr
S-S
jrS-SjrS-SjrS-SjrS-SjrS-SjrS-SjrS-SjrS-SjrS-SjrS,SjrS-SjrS-SjrS-SjrS-SjrS-SjrS-SjrS-SjrS-Sjr S-S jr!S-S!jr"S-S"jr#S-S#jr$S-S$jr%S-S%jr&S&r'g).�_Operand�z4Wraps an image operand, providing standard operatorsc��Xlg�N��im)�selfrs  �SD:\code\apps\devtools\python\user_packages\Python313\site-packages\PIL/ImageMath.py�__init__�_Operand.__init__!s����c�D�[U[5(aURRS;aURR	S5$URRS;aUR$SURR3n[U5e[U[[45(aFURRS;a,[R"SURRU5$[R"SURRU5$)N)�1�L�I)r�Fzunsupported mode: )rrrr)�8isinstancerr�mode�convert�9ValueError�int�floatr�new�size)r�im1�msgs   r�__fixup�_Operand.__fixup$s����c�8�$�$��v�v�{�{�j�(��v�v�~�~�c�*�*������10�*��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�8rNc�H�URU5nUc�[R"U=(d URURS5n[[USUR35n[R"XR5UR55 GO�URU5n	URU	R:waBURS:waURS5nU	RS:waU	RS5n	URU	R:wa�[URSU	RS5[URSU	RS54n11URU12:waURSU13-5nU	RU14:waU	RSU15-5n	[R"U=(d URURS5n[[USUR35n[R"XR5UR5U	R55 [U5$![anSUS3n[U5UeSnAff=f![anSUS3n[U5UeSnAff=f)N�_zbad operand type for '�'rrr)rr)�_Operand__fixuprr!rr"�getattrr�AttributeError�	TypeError�unop�getimr�min�crop�binopr)r�opr#�im2r�im_1�out�er$�im_2r"s           r�apply�_Operand.apply6s���|�|�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�;��16�17��d�j�j�l�K���}���="�
,�.�r�d�!�4����n�!�+��
,��4"�
,�.�r�d�!�4����n�!�+��
,�s0�I�0J�18I=�&I8�8I=�19J!�20J�J!c�:�URR5SL$r)r�getbbox�rs r�__bool__�_Operand.__bool__ds���w�w��� ��,�,rc�&�URSU5$)N�abs�r9r=s r�__abs__�_Operand.__abs__h����z�z�%��&�&rc��U$r�r=s r�__pos__�_Operand.__pos__ks���rc�&�URSU5$)N�negrBr=s r�__neg__�_Operand.__neg__nrErc�&�URSX5$�N�addrB�r�others  r�__add__�_Operand.__add__r����z�z�%��-�-rc�&�URSX5$rOrBrQs  r�__radd__�_Operand.__radd__u����z�z�%��-�-rc�&�URSX5$�N�subrBrQs  r�__sub__�_Operand.__sub__xrUrc�&�URSX5$r[rBrQs  r�__rsub__�_Operand.__rsub__{rYrc�&�URSX5$�N�mulrBrQs  r�__mul__�_Operand.__mul__~rUrc�&�URSX5$rcrBrQs  r�__rmul__�_Operand.__rmul__�rYrc�&�URSX5$�N�divrBrQs  r�__truediv__�_Operand.__truediv__�rUrc�&�URSX5$rkrBrQs  r�__rtruediv__�_Operand.__rtruediv__�rYrc�&�URSX5$�N�modrBrQs  r�__mod__�_Operand.__mod__�rUrc�&�URSX5$rsrBrQs  r�__rmod__�_Operand.__rmod__�rYrc�&�URSX5$�N�powrBrQs  r�__pow__�_Operand.__pow__�rUrc�&�URSX5$r{rBrQs  r�__rpow__�_Operand.__rpow__�rYrc�&�URSU5$)N�invertrBr=s r�21__invert__�_Operand.__invert__�s���z�z�(�D�)�)rc�&�URSX5$�N�andrBrQs  r�__and__�_Operand.__and__�rUrc�&�URSX5$r�rBrQs  r�__rand__�_Operand.__rand__�rYrc�&�URSX5$�N�orrBrQs  r�__or__�_Operand.__or__�����z�z�$��,�,rc�&�URSX5$r�rBrQs  r�__ror__�_Operand.__ror__�s���z�z�$��,�,rc�&�URSX5$�N�xorrBrQs  r�__xor__�_Operand.__xor__�rUrc�&�URSX5$r�rBrQs  r�__rxor__�_Operand.__rxor__�rYrc�&�URSX5$)N�lshiftrBrQs  r�22__lshift__�_Operand.__lshift__�����z�z�(�D�0�0rc�&�URSX5$)N�rshiftrBrQs  r�23__rshift__�_Operand.__rshift__�r�rc�&�URSX5$)N�eqrBrQs  r�__eq__�_Operand.__eq__�r�rc�&�URSX5$)N�nerBrQs  r�__ne__�_Operand.__ne__�r�rc�&�URSX5$)N�ltrBrQs  r�__lt__�_Operand.__lt__�r�rc�&�URSX5$)N�lerBrQs  r�__le__�_Operand.__le__�r�rc�&�URSX5$)N�gtrBrQs  r�__gt__�_Operand.__gt__�r�rc�&�URSX5$)N�gerBrQs  r�__ge__�_Operand.__ge__�r�rr)r�Image.Image)r#�_Operand | float�returnr�)NN)24r3�strr#r�r4�_Operand | float | Nonerz25str | Noner�r)r��bool)r�r)rRr�r�r)(�__name__�26__module__�__qualname__�__firstlineno__�__doc__rr*r9r>rCrHrLrSrWr]r`rerhrmrprurxr}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��__static_attributes__rGrrrrs���>��9�,(,��+��+��+�%�	+�27�+�28�
+�\-�'��'�.�.�.�.�.�.�.�.�.�.�.�.�*�.�.�-�-�.�.�1�1�-�-�-�-�-�-rrc�J�[URRS55$)Nr�rrrr=s r�
imagemath_intr������D�G�G�O�O�C�(�)�)rc�J�[URRS55$)Nrr�r=s r�imagemath_floatr��r�rc�$�URSXSS9$)Nr�r�rrBrQs  r�imagemath_equalr������:�:�d�D�c�:�2�2rc�$�URSXSS9$)Nr�rr�rBrQs  r�imagemath_notequalr��r�rc�&�URSX5$)Nr0rBrQs  r�
imagemath_minr������:�:�e�T�)�)rc�&�URSX5$)N�maxrBrQs  r�
imagemath_maxr��r�rc�J�[URRU55$rr�)rrs  r�imagemath_convertr��s���D�G�G�O�O�D�)�*�*r)rr �equal�notequalr0r�rc�(�[R5nURU5 UR5H3up4[	U[29R305(dM&[
U5X#'M5 U"U5nUR$![a Us$f=f)a	31Returns the result of an image function.32 33:py:mod:`~PIL.ImageMath` only supports single-layer images. To process multi-band34images, use the :py:meth:`~PIL.Image.Image.split` method or35:py:func:`~PIL.Image.merge` function.36 37:param expression: A function that receives a dictionary.38:param **kw: Values to add to the function's dictionary.39:return: The expression result. This is usually an image object, but can40         also be an integer, a floating point value, or a pixel tuple,41         depending on the expression.42)	�ops�copy�update�itemsrrrrr,)�43expression�kw�args�k�vr6s      r�lambda_evalr��sv���8�8�:�D��K�K��O��44�45�����a����%�%��q�k�D�G���T�46�C���v�v�
�����47��s�6B�B�Bc�^^^�[R5mUH/nSU;d[[U5(dM SUS3n[	U5e TRU5 TR
5H4up$[U[R5(dM&[U5TU'M6 [USS5mS	UUU4SjjmT"T5 [R"USS[00T5nUR$![a Us$f=f)48a�49Evaluates an image expression. This uses Python's ``eval()`` function to process50the expression string, and carries the security risks of doing so. It is not51recommended to process expressions without considering this.52:py:meth:`~lambda_eval` is a more secure alternative.53 54:py:mod:`~PIL.ImageMath` only supports single-layer images. To process multi-band55images, use the :py:meth:`~PIL.Image.Image.split` method or56:py:func:`~PIL.Image.merge` function.57 58:param expression: A string containing a Python-style expression.59:param **kw: Values to add to the evaluation context.60:return: The evaluated expression. This is usually an image object, but can61         also be an integer, a floating point value, or a pixel tuple,62         depending on the expression.63�__r)�
' not allowedz<string>�evalc��>�URH$n[U5[T5LdMT"U5 M& URH"nUT;dMUS:wdMSUS3n[U5e g)NrAr)r�)�	co_consts�type�co_namesr)�code�const�namer$r��
compiled_code�scans    ���rr��unsafe_eval.<locals>.scan+s_����^�^�E��E�{�d�=�1�1��U��$��M�M�D��4��D�E�M��$��}�-�� ��o�%�"r�64__builtinsrA)r�rr��None)r�r��hasattr�builtinsrr�r�rrr�compiler�rArr,)	r�r�r�r$r�r6r�r�r�s	      @@@r�unsafe_evalrs����&�8�8�:�D�
���1�9���!�,�,��a�S�
�&�C��S�/�!��65	�K�K��O��66�67�����a����%�%��q�k�D��G���J�68�F�;�M�&�&�	���69�-�-�70�\�E�3�<�$@�$�71G�C���v�v�
�����72��s�&C2�2D�D)rrr�r)rrrRr�r�r)rrrr�r�r)r�zCallable[[dict[str, Any]], Any]r�r	r�r	)r�r�r�r	r�r	)�73__future__rr��rr�
TYPE_CHECKING�collections.abcr�typesr�typingr	rr�r�r�r�r�r�r�r�r�rrGrr�<module>rsy��"#��!��
��(���e-�e-�R*�*�743�3�*�*�+�75�
�
�"��� ����8/r
codekingpro/portable-devtools · Team Ai