
    wg                    \    U d dl mZ d dlmZ d dlZddlmZmZmZ i Z	de
d<   e	edd	Zd
 Zy)    )annotations)AnyN   )
DispatcherMethodDispatcherambiguity_warnzdict[str, Any]global_namespace)	namespaceon_ambiguityc                0     t               fd}|S )aD   Dispatch function on the types of the inputs

    Supports dispatch on all non-keyword arguments.

    Collects implementations based on the function name.  Ignores namespaces.

    If ambiguous type signatures occur a warning is raised when the function is
    defined suggesting the additional method to break the ambiguity.

    Examples
    --------

    >>> from sympy.multipledispatch import dispatch
    >>> @dispatch(int)
    ... def f(x):
    ...     return x + 1

    >>> @dispatch(float)
    ... def f(x): # noqa: F811
    ...     return x - 1

    >>> f(3)
    4
    >>> f(3.0)
    2.0

    Specify an isolated namespace with the namespace keyword argument

    >>> my_namespace = dict()
    >>> @dispatch(int, namespace=my_namespace)
    ... def foo(x):
    ...     return x + 1

    Dispatch on instance methods within classes

    >>> class MyClass(object):
    ...     @dispatch(list)
    ...     def __init__(self, data):
    ...         self.data = data
    ...     @dispatch(int)
    ...     def __init__(self, datum): # noqa: F811
    ...         self.data = [datum]
    c                   | j                   }t        |       rBt        j                         j                  j
                  j                  |t        |            }n|vrt        |      |<   |   }|j                  |        |S )N)r   )
__name__ismethodinspectcurrentframef_backf_localsgetr   r   add)funcname
dispatcherr
   r   typess      `/home/mcse/projects/flask/flask-venv/lib/python3.12/site-packages/sympy/multipledispatch/core.py_zdispatch.<locals>._;   s|    }}D> --/66??CC &(J 9$",T"2	$"4Jud>    )tuple)r
   r   r   r   s   ``` r   dispatchr      s    X %LE Hr   c                h    t        j                  |       }|j                  j                  dd      duS )z Is func a method?

    Note that this has to work as the method is defined but before the class is
    defined.  At this stage methods look like functions.
    selfN)r   	signature
parametersr   )r   r!   s     r   r   r   L   s2     !!$'I##FD1==r   )
__future__r   typingr   r   r   r   r   r   r	   __annotations__r   r    r   r   <module>r'      s3    "   D D $& . %  0n <~>r   