ó
    ‹*£h°+  ã                   óº   • S r SSKJr  SSKrSSKrSSKrSSKJrJr  SSK	J
r
  \" S5      r S rS rS	 rS
 r " S S5      r  SS jrS\S\4S jrS rSS.S jrg)zUseful utility decorators. é    )ÚTypeVarN)ÚwrapsÚupdate_wrapper©Úsympy_deprecation_warningÚTc                 ód   ^ ^^^^• SSK Jm  SSKJm  SSKJm  [        T 5      UU UUU4S j5       nU$ )z'A factory for ``threaded`` decorators. r   )Úsympify)Ú
MatrixBase)Úiterablec           
      óZ  >^^• [        U T5      (       a  U R                  UUU4S j5      $ T" U 5      (       a-   U R                  U  Vs/ s H  nT" U/TQ70 TD6PM     sn5      $ T" U 5      n T(       aE  U R                  (       a4  U R                  " U R
                   Vs/ s H  nT" U/TQ70 TD6PM     sn6 $ U R                  (       a:  U R                  T" U R                  /TQ70 TD6T" U R                  /TQ70 TD65      $ T" U /TQ70 TD6$ s  snf ! [         a    U s $ f = fs  snf )Nc                 ó   >• T" U /TQ70 TD6$ ©N© )ÚfÚargsÚfuncÚkwargss    €€€ÚV/home/mande/repo/quber/.venv/lib/python3.13/site-packages/sympy/utilities/decorator.pyÚ<lambda>Ú9threaded_factory.<locals>.threaded_func.<locals>.<lambda>   s   ø€ ©D°Ð,D°TÒ,D¸VÒ,Dó    )	Ú
isinstanceÚ	applyfuncÚ	__class__Ú	TypeErrorÚis_Addr   Úis_RelationalÚlhsÚrhs)	Úexprr   r   r   r   r   r   r
   Úuse_adds	    `` €€€€€r   Úthreaded_funcÚ'threaded_factory.<locals>.threaded_func   s  ú€ ä�d˜J×'Ñ'Ø—>‘>Ö"DÓEÐEÙ�d�^‰^ðØ—~‘~ÉÓ&NÊÀA¡t¨AÐ'?°Ò'?¸Ô'?ÉÑ&NÓOÐOñ ˜4“=ˆDæ˜4Ÿ;Ÿ;Ø—~’~È4Ï9Ê9Ó'VÊ9Àa©¨aÐ)A°$Ò)A¸&Ô)AÉ9Ñ'VÐWÐWØ×#×#Ø—~‘~¡d¨4¯8©8Ð&E°dÒ&E¸fÑ&EÙ&*¨4¯8©8Ð&E°dÒ&E¸fÑ&EóGð Gñ ˜DÐ2 4Ò2¨6Ñ2Ð2ùò 'OøÜó Ø’ðüò (Ws)   ºD Á	DÁD Â D(ÄD ÄD%Ä$D%)Ú
sympy.corer
   Úsympy.matricesr   Úsympy.utilities.iterablesr   r   )r   r"   r#   r   r   r
   s   `` @@@r   Úthreaded_factoryr(      s/   ü€ å"Ý)Ý2ä
ˆ4ƒ[÷3ð 3ó ð3ð& Ðr   c                 ó   • [        U S5      $ )a-  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                 ó   • [        U S5      $ )a0  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   Ú	xthreadedr.   A   s   € ô" ˜D %Ó(Ð(r   c                 ó8   ^ ^• SSK mU U4S jn[        UT 5      nU$ )zsAfter the function finishes, resets the value of ``mpmath.mp.dps`` to
the value it had before the function was run.r   Nc                  ó�   >• TR                   R                  n T" U 0 UD6UTR                   l        $ ! UTR                   l        f = fr   )ÚmpÚdps)r   r   r2   r   Úmpmaths      €€r   Úfunc_wrapperÚ)conserve_mpmath_dps.<locals>.func_wrapperZ   s9   ø€ Ø�i‰i�m‰mˆð	 Ù˜Ð( Ñ(àˆF�I‰I�Mø˜CˆF�I‰I�Mús	   ™2 ²A)r3   r   )r   r4   r3   s   ` @r   Úconserve_mpmath_dpsr6   U   s!   ù€ ó ö ô " ,°Ó5€LØÐr   c                   ó(   • \ rS rSrSrS rSS jrSrg)Úno_attrs_in_subclassée   a  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                 ó   • Xl         X l        g r   ©Úclsr   )Úselfr<   r   s      r   Ú__init__Úno_attrs_in_subclass.__init__x   s   € ØŒØ�r   Nc                 ó°   • X R                   :X  aB  [        U R                  S5      (       a  U R                  R                  X5      $ U R                  $ [        e)NÚ__get__)r<   Úhasattrr   rA   ÚAttributeError)r=   ÚinstanceÚowners      r   rA   Úno_attrs_in_subclass.__get__|   s?   € Ø—H‘HÓÜ�t—v‘v˜y×)Ñ)Ø—v‘v—~‘~ hÓ6Ð6Ø—6‘6ˆMÜÐr   r;   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r>   rA   Ú__static_attributes__r   r   r   r8   r8   e   s   † ñò$÷r   r8   c                 óx   ^^• 0 mU b  U TS'   Ub  UTS'   Ub  UTS'   Ub  UTS'   Ub  UTS'   U4S jmUU4S jnU$ )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)``)
ÚexecutablesÚmodulesÚdisable_viewersÚpython_versionÚground_typesc                  óx   >• SSK Jn JnJn  U" 5       nU" US 5      n UR                  " S0 TD6  g! U  a     gf = f)Nr   )ÚDependencyErrorÚSymPyDocTestsÚPyTestReporterFTr   )Úsympy.testing.runtestsrT   rU   rV   Ú_check_dependencies)rT   rU   rV   ÚrÚtÚdependenciess        €r   Ú	skiptestsÚ%doctest_depends_on.<locals>.skiptestsŸ   sL   ø€ ßYÑYÙÓˆÙ˜!˜TÓ"ˆð	Ø×!Ò!Ñ1 LÒ1ð øð ó 	Ùð	ús   �0 °9¸9c                 óÂ   >• TU l         TU l        [        R                  " U 5      (       a4  [	        X R                   5      U l        [	        X R                  5      U l        U $ r   )Ú_doctest_depends_onÚ__doctest_skip__ÚinspectÚisclassr8   Ú_doctest_depdends_on)Úfnr[   r\   s    €€r   Údepends_on_decoÚ+doctest_depends_on.<locals>.depends_on_decoª   sS   ø€ Ø!-ˆÔØ'ˆÔä�?Š?˜2×ÑÜ&:Ø×*Ñ*ó',ˆBÔ#ä"6Ø×'Ñ'ó#)ˆBÔàˆ	r   r   )ÚexerO   rP   rQ   rR   re   r[   r\   s         @@r   Údoctest_depends_onrh   „   sm   ù€ ð €LØ
�Ø&)ˆ�]Ñ#ØÑØ")ˆ�YÑØÑ"Ø*9ˆÐ&Ñ'ØÑ!Ø)7ˆÐ%Ñ&ØÑØ'3ˆ�^Ñ$õ	ö	ð Ðr   ÚobjÚreturnc                 ó†  • [        U [        R                  5      (       a  U R                  nU R                  nOf[        U [        [
        5      [
        45      (       a4  [        R                  U R                     R                  nU R                  nO[        SU -  5      eSU;  a  U/US'   U $ US   R                  U5        U $ )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__rG   ÚtypeÚsysrO   rH   Ú__dict__r   Úappend)ri   ÚnsÚnames      r   Úpublicrv   ¸   s¥   € ô@ �#”u×)Ñ)×*Ñ*Ø�_‰_ˆØ�|‰|‰Ü	�Cœ$œt›*¤dÐ+×	,Ñ	,Ü�[‰[˜Ÿ™Ñ(×1Ñ1ˆØ�|‰|‰äÐ@À3ÑFÓGÐGà˜ÓØ˜ˆˆ9‰ð €Jð 	ˆ9‰×Ñ˜TÔ"à€Jr   c                 ó|   ^ ^^• ST R                   -   m[        5       m[        T 5      UU U4S j5       n[        U5      $ )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                 óV   >• [        U TT5      nUTL a  T" U 5      n[        U TU5        U$ r   )ÚgetattrÚsetattr)r=   ÚvalÚattrnameÚpropfuncÚsentinels     €€€r   ÚaccessorÚ"memoize_property.<locals>.accessorð   s2   ø€ ä�d˜H hÓ/ˆØ�(Š?Ù˜4“.ˆCÜ�D˜( CÔ(Øˆ
r   )rG   Úobjectr   Úproperty)r~   r€   r}   r   s   ` @@r   Úmemoize_propertyr„   é   s?   ú€ ð �X×&Ñ&Ñ&€HÜ‹x€Hä
ˆ8ƒ_öó ðô �HÓÐr   é   )Ú
stacklevelc                ó&   ^ ^^• UUS.mUU U4S jnU$ )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 S5      (       a$   " UUUU 4S jST 5      nT R                  Ul        U$ [        T 5      UUUU 4S j5       nT Ul        U$ )NÚ__mro__c                   óª   >^ • \ rS rSr YR                  r YR                  r YrS YR                  ;   a  U UUU4S jrSr	U =r
$ U UUU4S jrSr	U =r
$ )Ú9deprecated.<locals>.deprecated_decorator.<locals>.wrapperi?  Ú__new__c                 óL   >• [        T40 TDST0D6  [        TU ]  " U /UQ70 UD6$ ©Nr†   )r   ÚsuperrŽ   )r<   r   r   r   Údecorator_kwargsÚmessager†   s      €€€€r   rŽ   ÚAdeprecated.<locals>.deprecated_decorator.<locals>.wrapper.__new__D  s0   ø€ Ü1°'ÑeÐ=MÑeÐZdÓeÜ$™wš¨sÐD°TÒD¸VÑDÐDr   c                 óF   >• [        T40 TDST0D6  [        TU ]  " U0 UD6  g r�   )r   r‘   r>   )r=   r   r   r   r’   r“   r†   s      €€€€r   r>   ÚBdeprecated.<locals>.deprecated_decorator.<locals>.wrapper.__init__H  s)   ø€ Ü1°'ÑeÐ=MÑeÐZdÓeÜ™Ò(¨$Ð9°&Ó9r   r   )rG   rH   rI   rJ   rK   Ú_sympy_deprecated_funcrr   rŽ   r>   rL   Ú__classcell__)r   r’   r“   r†   Úwrappeds   @€€€€r   Úwrapperr�   ?  sA   ù† Ù!Ÿ/™/�Ù$×/Ñ/�
Ù)0Ð&Ø¡× 0Ñ 0Ó0÷Eö E÷:ö :r   rš   c                  ó4   >• [        T40 TDST0D6  T" U 0 UD6$ r�   r   )r   r   r’   r“   r†   r™   s     €€€€r   rš   r�   M  s'   ø€ ä)¨'Ñ]Ð5EÑ]ÐR\Ó]Ù Ð/¨Ñ/Ð/r   )rB   rG   r   r—   )r™   rš   r’   r“   r†   s   ` €€€r   Údeprecated_decoratorÚ(deprecated.<locals>.deprecated_decorator=  s_   ù€ Ü�7˜I×&Ñ&÷:ò :˜'ô :ð  '×/Ñ/ˆGÔð ˆô �7‹^÷0ó ð0ð .5ˆGÔ*Øˆr   r   )r“   rˆ   r‰   r†   rœ   r’   s   `  ` @r   Ú
deprecatedrž   û   s#   ú€ ð@ 5MØ-GñIÐ÷ð,  Ðr   )NNNNN)rK   Útypingr   rq   rm   ra   Ú	functoolsr   r   Úsympy.utilities.exceptionsr   r   r(   r,   r.   r6   r8   rh   rv   r„   rž   r   r   r   Ú<module>r¢      sz   ðÙ !å Û 
Û Û ß +å @ñ ˆCƒL€Ø òò:(ò()ò(÷ ñ ð> @DØ9=ô1ðh.�ð .�aô .òbð& 78öX r   