§
    ?�’j-  ã                   óÂ   — d Z ddlmZ ddlZddlZddlZddlmZmZ ddl	m
Z
  ed¦  «        Z	 d„ Zd„ Zd	„ Zd
„ Z G d„ d¦  «        Z	 	 dd„Zdedefd„Zd„ Zddœd„ZdS )zUseful utility decorators. é    )ÚTypeVarN)ÚwrapsÚupdate_wrapper©Úsympy_deprecation_warningÚTc                 óp   ‡ ‡‡‡‡— ddl mŠ ddlmŠ ddlmŠ t          ‰ ¦  «        ˆˆ ˆˆˆfd„¦   «         }|S )z'A factory for ``threaded`` decorators. r   )Úsympify)Ú
MatrixBase)Úiterablec                 óÎ  •‡‡— t          | ‰¦  «        r|                      ˆˆˆfd„¦  «        S  ‰| ¦  «        r6	 |                      ˆˆˆfd„| D ¦   «         ¦  «        S # t          $ r | cY S w xY w ‰| ¦  «        } ‰r$| j        r | j        ˆˆˆfd„| j        D ¦   «         Ž S | j        r4|                       ‰| j        g‰¢R i ‰¤Ž ‰| j        g‰¢R i ‰¤Ž¦  «        S  ‰| g‰¢R i ‰¤ŽS )Nc                 ó   •—  ‰| g‰¢R i ‰¤ŽS ©N© )ÚfÚargsÚfuncÚkwargss    €€€úGC:\Projects\DSCons\.venv\Lib\site-packages\sympy\utilities\decorator.pyú<lambda>z9threaded_factory.<locals>.threaded_func.<locals>.<lambda>   s!   ø€ ¨D¨D°Ð,D°TÐ,DÐ,DÐ,D¸VÐ,DÐ,D€ ó    c                 ó(   •— g | ]} ‰|g‰¢R i ‰¤Ž‘ŒS r   r   ©Ú.0r   r   r   r   s     €€€r   ú
<listcomp>z;threaded_factory.<locals>.threaded_func.<locals>.<listcomp>   s3   ø€ Ð&NÐ&NÐ&NÀA t t¨AÐ'?°Ð'?Ð'?Ð'?¸Ð'?Ð'?Ð&NÐ&NÐ&Nr   c                 ó(   •— g | ]} ‰|g‰¢R i ‰¤Ž‘ŒS r   r   r   s     €€€r   r   z;threaded_factory.<locals>.threaded_func.<locals>.<listcomp>#   s3   ø€ Ð'VÐ'VÐ'VÀa¨¨¨aÐ)A°$Ð)AÐ)AÐ)A¸&Ð)AÐ)AÐ'VÐ'VÐ'Vr   )	Ú
isinstanceÚ	applyfuncÚ	__class__Ú	TypeErrorÚis_Addr   Úis_RelationalÚlhsÚrhs)Úexprr   r   r   r   r   r
   Úuse_adds    ``€€€€€r   Úthreaded_funcz'threaded_factory.<locals>.threaded_func   sn  øøø€ å�d˜JÑ'Ô'ð 	3Ø—>’>Ð"DÐ"DÐ"DÐ"DÐ"DÐ"DÑEÔEÐEØˆX�d‰^Œ^ð 	3ðØ—~’~Ð&NÐ&NÐ&NÐ&NÐ&NÐ&NÈÐ&NÑ&NÔ&NÑOÔOÐOøÝð ð ð Ø���ðøøøð �7˜4‘=”=ˆDàð 3˜4œ;ð 3Ø%�t”~Ð'VÐ'VÐ'VÐ'VÐ'VÐ'VÈ4Ì9Ð'VÑ'VÔ'VÐWÐWØÔ#ð 3Ø—~’~ d d¨4¬8Ð&E°dÐ&EÐ&EÐ&E¸fÐ&EÐ&EØ&* d¨4¬8Ð&E°dÐ&EÐ&EÐ&E¸fÐ&EÐ&EñGô Gð Gð �t˜DÐ2 4Ð2Ð2Ð2¨6Ð2Ð2Ð2s   º"A ÁA,Á+A,)Ú
sympy.corer
   Úsympy.matricesr   Úsympy.utilities.iterablesr   r   )r   r&   r'   r   r   r
   s   `` @@@r   Úthreaded_factoryr+      s‚   øøøøø€ à"Ð"Ð"Ð"Ð"Ð"Ø)Ð)Ð)Ð)Ð)Ð)Ø2Ð2Ð2Ð2Ð2Ð2å
ˆ4�[„[ð3ð 3ð 3ð 3ð 3ð 3ð 3ð 3ñ „[ð3ð& Ðr   c                 ó"   — t          | d¦  «        S )aU  Apply ``func`` to sub--elements of an object, including :class:`~.Add`.

    This decorator is intended to make it uniformly possible to apply a
    function to all elements of composite objects, e.g. matrices, lists, tuples
    and other iterable containers, or just expressions.

    This version of :func:`threaded` decorator allows threading over
    elements of :class:`~.Add` class. If this behavior is not desirable
    use :func:`xthreaded` decorator.

    Functions using this decorator must have the following signature::

      @threaded
      def function(expr, *args, **kwargs):

    T©r+   ©r   s    r   Úthreadedr/   -   s   € õ" ˜D $Ñ'Ô'Ð'r   c                 ó"   — t          | d¦  «        S )aX  Apply ``func`` to sub--elements of an object, excluding :class:`~.Add`.

    This decorator is intended to make it uniformly possible to apply a
    function to all elements of composite objects, e.g. matrices, lists, tuples
    and other iterable containers, or just expressions.

    This version of :func:`threaded` decorator disallows threading over
    elements of :class:`~.Add` class. If this behavior is not desirable
    use :func:`threaded` decorator.

    Functions using this decorator must have the following signature::

      @xthreaded
      def function(expr, *args, **kwargs):

    Fr-   r.   s    r   Ú	xthreadedr1   A   s   € õ" ˜D %Ñ(Ô(Ð(r   c                 ó>   ‡ ‡— ddl Šˆ ˆfd„}t          |‰ ¦  «        }|S )zwAfter the function finishes, resets the value of ``mpmath.mp.dps`` to
    the value it had before the function was run.r   Nc                  óh   •— ‰j         j        }	  ‰| i |¤Ž|‰j         _        S # |‰j         _        w xY wr   )ÚmpÚdps)r   r   r5   r   Úmpmaths      €€r   Úfunc_wrapperz)conserve_mpmath_dps.<locals>.func_wrapperZ   sC   ø€ ØŒiŒmˆð	 Ø�4˜Ð( Ð(Ð(àˆFŒIŒMˆMø˜CˆFŒIŒMÐÐÐÐs   �# £1)r6   r   )r   r7   r6   s   ` @r   Úconserve_mpmath_dpsr8   U   sD   øø€ ð €M€M€Mð ð  ð  ð  ð  ð  õ " ,°Ñ5Ô5€LØÐr   c                   ó    — e Zd ZdZd„ Zdd„ZdS )Úno_attrs_in_subclassaE  Don't 'inherit' certain attributes from a base class

    >>> from sympy.utilities.decorator import no_attrs_in_subclass

    >>> class A(object):
    ...     x = 'test'

    >>> A.x = no_attrs_in_subclass(A, A.x)

    >>> class B(A):
    ...     pass

    >>> hasattr(A, 'x')
    True
    >>> hasattr(B, 'x')
    False

    c                 ó"   — || _         || _        d S r   )Úclsr   )Úselfr<   r   s      r   Ú__init__zno_attrs_in_subclass.__init__x   s   € ØˆŒØˆŒˆˆr   Nc                 ó”   — || j         k    r7t          | j        d¦  «        r| j                             ||¦  «        S | j        S t          ‚)NÚ__get__)r<   Úhasattrr   r@   ÚAttributeError)r=   ÚinstanceÚowners      r   r@   zno_attrs_in_subclass.__get__|   sF   € Ø�D”HÒÐÝ�t”v˜yÑ)Ô)ð 7Ø”v—~’~ h°Ñ6Ô6Ð6Ø”6ˆMÝÐr   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r>   r@   r   r   r   r:   r:   e   sA   € € € € € ðð ð$ð ð ðð ð ð ð ð r   r:   c                 ój   ‡‡— i Š| �| ‰d<   |�|‰d<   |�|‰d<   |�|‰d<   |�|‰d<   ˆfd„Šˆˆfd„}|S )	a­  
    Adds metadata about the dependencies which need to be met for doctesting
    the docstrings of the decorated objects.

    ``exe`` should be a list of executables

    ``modules`` should be a list of modules

    ``disable_viewers`` should be a list of viewers for :func:`~sympy.printing.preview.preview` to disable

    ``python_version`` should be the minimum Python version required, as a tuple
    (like ``(3, 0)``)
    NÚexecutablesÚmodulesÚdisable_viewersÚpython_versionÚground_typesc                  ó|   •— ddl m} m}m}  |¦   «         } ||d ¦  «        }	  |j        di ‰¤Ž dS # | $ r Y dS w xY w)Nr   )ÚDependencyErrorÚSymPyDocTestsÚPyTestReporterFTr   )Úsympy.testing.runtestsrP   rQ   rR   Ú_check_dependencies)rP   rQ   rR   ÚrÚtÚdependenciess        €r   Ú	skiptestsz%doctest_depends_on.<locals>.skiptestsŸ   sˆ   ø€ ØYÐYÐYÐYÐYÐYÐYÐYÐYÐYØˆNÑÔˆØˆM˜!˜TÑ"Ô"ˆð	Ø!ˆAÔ!Ð1Ð1 LÐ1Ð1Ð1ð �5øð ð 	ð 	ð 	Ø�4�4ð	øøøs   £2 ²;º;c                 ó´   •— ‰| _         ‰| _        t          j        | ¦  «        r4t	          | | j         ¦  «        | _        t	          | | j        ¦  «        | _        | S r   )Ú_doctest_depends_onÚ__doctest_skip__ÚinspectÚisclassr:   Ú_doctest_depdends_on)ÚfnrW   rX   s    €€r   Údepends_on_decoz+doctest_depends_on.<locals>.depends_on_decoª   s^   ø€ Ø!-ˆÔØ'ˆÔåŒ?˜2ÑÔð 	)Ý&:Ø�BÔ*ñ',ô ',ˆBÔ#å"6Ø�BÔ'ñ#)ô #)ˆBÔàˆ	r   r   )ÚexerK   rL   rM   rN   r`   rW   rX   s         @@r   Údoctest_depends_onrb   „   s›   øø€ ð €LØ
€Ø&)ˆ�]Ñ#ØÐØ")ˆ�YÑØÐ"Ø*9ˆÐ&Ñ'ØÐ!Ø)7ˆÐ%Ñ&ØÐØ'3ˆ�^Ñ$ð	ð 	ð 	ð 	ð 	ð	ð 	ð 	ð 	ð 	ð 	ð Ðr   ÚobjÚreturnc                 ób  — t          | t          j        ¦  «        r| j        }| j        }n_t          | t          t
          ¦  «        t
          f¦  «        r$t          j        | j                 j	        }| j        }nt          d| z  ¦  «        ‚d|vr|g|d<   n|d                              |¦  «         | S )aå  
    Append ``obj``'s name to global ``__all__`` variable (call site).

    By using this decorator on functions or classes you achieve the same goal
    as by filling ``__all__`` variables manually, you just do not have to repeat
    yourself (object's name). You also know if object is public at definition
    site, not at some random location (where ``__all__`` was set).

    Note that in multiple decorator setup (in almost all cases) ``@public``
    decorator must be applied before any other decorators, because it relies
    on the pointer to object's global namespace. If you apply other decorators
    first, ``@public`` may end up modifying the wrong namespace.

    Examples
    ========

    >>> from sympy.utilities.decorator import public

    >>> __all__ # noqa: F821
    Traceback (most recent call last):
    ...
    NameError: name '__all__' is not defined

    >>> @public
    ... def some_function():
    ...     pass

    >>> __all__ # noqa: F821
    ['some_function']

    z&expected a function or a class, got %sÚ__all__)r   ÚtypesÚFunctionTypeÚ__globals__rE   ÚtypeÚsysrK   rF   Ú__dict__r    Úappend)rc   ÚnsÚnames      r   Úpublicrp   ¸   s¬   € õ@ �#•uÔ)Ñ*Ô*ð HØŒ_ˆØŒ|ˆˆÝ	�C�$�t™*œ*¥dÐ+Ñ	,Ô	,ð HÝŒ[˜œÔ(Ô1ˆØŒ|ˆˆåÐ@À3ÑFÑGÔGÐGà˜ÐÐØ˜ˆˆ9‰ˆà
ˆ9Œ×Ò˜TÑ"Ô"Ð"à€Jr   c                 óŽ   ‡ ‡‡— d‰ j         z   Št          ¦   «         Št          ‰ ¦  «        ˆˆ ˆfd„¦   «         }t          |¦  «        S )zÍProperty decorator that caches the value of potentially expensive
    ``propfunc`` after the first evaluation. The cached value is stored in
    the corresponding property name with an attached underscore.Ú_c                 ój   •— t          | ‰‰¦  «        }|‰u r ‰| ¦  «        }t          | ‰|¦  «         |S r   )ÚgetattrÚsetattr)r=   ÚvalÚattrnameÚpropfuncÚsentinels     €€€r   Úaccessorz"memoize_property.<locals>.accessorð   sA   ø€ å�d˜H hÑ/Ô/ˆØ�(ˆ?ˆ?Ø�(˜4‘.”.ˆCÝ�D˜( CÑ(Ô(Ð(Øˆ
r   )rE   Úobjectr   Úproperty)rx   rz   rw   ry   s   ` @@r   Úmemoize_propertyr}   é   s`   øøø€ ð �XÔ&Ñ&€HÝ‰xŒx€Hå
ˆ8�_„_ðð ð ð ð ð ñ „_ðõ �HÑÔÐr   é   )Ú
stacklevelc                ó$   ‡ ‡‡— ||dœŠˆˆ ˆfd„}|S )aš  
    Mark a function as deprecated.

    This decorator should be used if an entire function or class is
    deprecated. If only a certain functionality is deprecated, you should use
    :func:`~.warns_deprecated_sympy` directly. This decorator is just a
    convenience. There is no functional difference between using this
    decorator and calling ``warns_deprecated_sympy()`` at the top of the
    function.

    The decorator takes the same arguments as
    :func:`~.warns_deprecated_sympy`. See its
    documentation for details on what the keywords to this decorator do.

    See the :ref:`deprecation-policy` document for details on when and how
    things should be deprecated in SymPy.

    Examples
    ========

    >>> from sympy.utilities.decorator import deprecated
    >>> from sympy import simplify
    >>> @deprecated("""    ... The simplify_this(expr) function is deprecated. Use simplify(expr)
    ... instead.""", deprecated_since_version="1.1",
    ... active_deprecations_target='simplify-this-deprecation')
    ... def simplify_this(expr):
    ...     """
    ...     Simplify ``expr``.
    ...
    ...     .. deprecated:: 1.1
    ...
    ...        The ``simplify_this`` function is deprecated. Use :func:`simplify`
    ...        instead. See its documentation for more information. See
    ...        :ref:`simplify-this-deprecation` for details.
    ...
    ...     """
    ...     return simplify(expr)
    >>> from sympy.abc import x
    >>> simplify_this(x*(x + 1) - x**2) # doctest: +SKIP
    <stdin>:1: SymPyDeprecationWarning:
    <BLANKLINE>
    The simplify_this(expr) function is deprecated. Use simplify(expr)
    instead.
    <BLANKLINE>
    See https://docs.sympy.org/latest/explanation/active-deprecations.html#simplify-this-deprecation
    for details.
    <BLANKLINE>
    This has been deprecated since SymPy version 1.1. It
    will be removed in a future version of SymPy.
    <BLANKLINE>
      simplify_this(x)
    x

    See Also
    ========
    sympy.utilities.exceptions.SymPyDeprecationWarning
    sympy.utilities.exceptions.sympy_deprecation_warning
    sympy.utilities.exceptions.ignore_warnings
    sympy.testing.pytest.warns_deprecated_sympy

    )Údeprecated_since_versionÚactive_deprecations_targetc                 ó²   •‡ — t          ‰ d¦  «        r  G ˆˆˆˆ fd„d‰ ¦  «        }‰ j        |_        n$t          ‰ ¦  «        ˆˆˆˆ fd„¦   «         }‰ |_        |S )NÚ__mro__c                   óp   •‡ — e Zd Z”j        Z”j        Z”Zd”j        v rˆ ˆˆˆfd„Zˆ xZS ˆ ˆˆˆfd„Zˆ xZS )ú9deprecated.<locals>.deprecated_decorator.<locals>.wrapperÚ__new__c                 ó`   •— t          ‰fi ‰¤d‰i¤Ž  t          ¦   «         j        | g|¢R i |¤ŽS ©Nr   )r   Úsuperr‡   )r<   r   r   r   Údecorator_kwargsÚmessager   s      €€€€r   r‡   zAdeprecated.<locals>.deprecated_decorator.<locals>.wrapper.__new__D  sL   ø€ Ý1°'ÐeÐeÐ=MÐeÐeÐZdÐeÐeÐeÐeØ.�u™wœwœ¨sÐD°TÐDÐDÐD¸VÐDÐDÐDr   c                 ó\   •— t          ‰fi ‰¤d‰i¤Ž  t          ¦   «         j        |i |¤Ž d S r‰   )r   rŠ   r>   )r=   r   r   r   r‹   rŒ   r   s      €€€€r   r>   zBdeprecated.<locals>.deprecated_decorator.<locals>.wrapper.__init__H  sH   ø€ Ý1°'ÐeÐeÐ=MÐeÐeÐZdÐeÐeÐeÐeØ(�™œÔ(¨$Ð9°&Ð9Ð9Ð9Ð9Ð9r   )	rE   rF   rG   rH   Ú_sympy_deprecated_funcrl   r‡   r>   Ú__classcell__)r   r‹   rŒ   r   Úwrappeds   @€€€€r   Úwrapperr†   ?  s³   øø€ € € € € Ø!œ/�Ø$Ô/�
Ø)0Ð&Ø Ô 0Ð0Ð0ðEð Eð Eð Eð Eð Eð Eð Eð Eð Eð Eð Eð:ð :ð :ð :ð :ð :ð :ð :ð :ð :ð :ð :r   r‘   c                  ó6   •— t          ‰fi ‰¤d‰i¤Ž  ‰| i |¤ŽS r‰   r   )r   r   r‹   rŒ   r   r�   s     €€€€r   r‘   z9deprecated.<locals>.deprecated_decorator.<locals>.wrapperM  s;   ø€ å)¨'Ð]Ð]Ð5EÐ]Ð]ÐR\Ð]Ð]Ð]Ð]Ø�w Ð/¨Ð/Ð/Ð/r   )rA   rE   r   rŽ   )r�   r‘   r‹   rŒ   r   s   ` €€€r   Údeprecated_decoratorz(deprecated.<locals>.deprecated_decorator=  s°   øø€ Ý�7˜IÑ&Ô&ð 	5ð:ð :ð :ð :ð :ð :ð :ð :ð :ð :˜'ñ :ô :ð :ð  'Ô/ˆGÔÐå�7‰^Œ^ð0ð 0ð 0ð 0ð 0ð 0ð 0ñ Œ^ð0ð .5ˆGÔ*Øˆr   r   )rŒ   r�   r‚   r   r“   r‹   s   `  ` @r   Ú
deprecatedr”   û   sI   øøø€ ð@ 5MØ-GðIð IÐðð ð ð ð ð ð ð,  Ðr   )NNNNN)rH   Útypingr   rk   rg   r\   Ú	functoolsr   r   Úsympy.utilities.exceptionsr   r   r+   r/   r1   r8   r:   rb   rp   r}   r”   r   r   r   ú<module>r˜      sX  ðØ !Ð !à Ð Ð Ð Ð Ð Ø 
€
€
€
Ø €€€Ø €€€Ø +Ð +Ð +Ð +Ð +Ð +Ð +Ð +à @Ð @Ð @Ð @Ð @Ð @ð €GˆC�L„L€Ø ðð ð ð:(ð (ð (ð()ð )ð )ð(ð ð ð ð ð ð ð ñ ô ð ð> @DØ9=ð1ð 1ð 1ð 1ðh.�ð .�að .ð .ð .ð .ðbð ð ð& 78ðX ð X ð X ð X ð X ð X ð X r   