U
    9%e                     @  s^   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	d
Zdd ZdS )    )annotations)AnyN   )
DispatcherMethodDispatcherambiguity_warnzdict[str, Any]global_namespace)	namespaceon_ambiguityc                   s   t  fd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                   sX   | j }t| r(t jj|t|}n| kr<t| |<  | }|j	| d |S )N)r
   )
__name__ismethodinspectcurrentframef_backf_localsgetr   r   add)funcname
dispatcherr	   r
   types Z/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/sympy/multipledispatch/core.py_;   s    zdispatch.<locals>._)tuple)r	   r
   r   r   r   r   r   dispatch   s    ,r   c                 C  s   t | }|jdddk	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   r   r   r   r   L   s    
r   )
__future__r   typingr   r   r   r   r   r   r   __annotations__r   r   r   r   r   r   <module>   s    ?