ó
€k[c           @   st   d  d l  Z  d d l m Z d e f d „  ƒ  YZ d „  Z d e f d „  ƒ  YZ d	 e  j e ƒ f d
 „  ƒ  YZ d S(   iÿÿÿÿNi   (   t   typenamet   VariadicSignatureTypec           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c            sD   t  | ƒ r | j n | f } | ˆ  k pC t ‡  f d †  | Dƒ ƒ S(   Nc         3   s!   |  ] } t  | ˆ  j ƒ Vq d  S(   N(   t
   issubclasst   variadic_type(   t   .0t   other(   t   self(    s8   lib/python2.7/site-packages/multipledispatch/variadic.pys	   <genexpr>   s    (   t
   isvariadicR   t   all(   R   t   subclasst
   other_type(    (   R   s8   lib/python2.7/site-packages/multipledispatch/variadic.pyt   __subclasscheck__   s    	c         C   s(   t  | ƒ o' t |  j ƒ t | j ƒ k S(   s  
        Return True if other has the same variadic type

        Parameters
        ----------
        other : object (type)
            The object (type) to check

        Returns
        -------
        bool
            Whether or not `other` is equal to `self`
        (   R   t   setR   (   R   R   (    (    s8   lib/python2.7/site-packages/multipledispatch/variadic.pyt   __eq__   s    c         C   s   t  t |  ƒ t |  j ƒ f ƒ S(   N(   t   hasht   typet	   frozensetR   (   R   (    (    s8   lib/python2.7/site-packages/multipledispatch/variadic.pyt   __hash__    s    (   t   __name__t
   __module__R   R   R   (    (    (    s8   lib/python2.7/site-packages/multipledispatch/variadic.pyR      s   		c         C   s   t  |  t ƒ S(   s)  Check whether the type `obj` is variadic.

    Parameters
    ----------
    obj : type
        The type to check

    Returns
    -------
    bool
        Whether or not `obj` is variadic

    Examples
    --------
    >>> isvariadic(int)
    False
    >>> isvariadic(Variadic[int])
    True
    (   t
   isinstanceR   (   t   obj(    (    s8   lib/python2.7/site-packages/multipledispatch/variadic.pyR   $   s    t   VariadicSignatureMetac           B   s   e  Z d  Z d „  Z RS(   s»   A metaclass that overrides ``__getitem__`` on the class. This is used to
    generate a new type for Variadic signatures. See the Variadic class for
    examples of how this behaves.
    c         C   st   t  | t t f ƒ p t | ƒ s0 t d ƒ ‚ n  t  | t ƒ sK | f } n  t d t | ƒ d t d | d d ƒ ƒ S(   NsV   Variadic types must be type or tuple of types (Variadic[int] or Variadic[(int, float)]s   Variadic[%s]R   t	   __slots__(    (    (   R   R   t   tuplet
   ValueErrorR   R    t   dict(   R   R   (    (    s8   lib/python2.7/site-packages/multipledispatch/variadic.pyt   __getitem__@   s    !(   R   R   t   __doc__R   (    (    (    s8   lib/python2.7/site-packages/multipledispatch/variadic.pyR   ;   s   t   Variadicc           B   s   e  Z d  Z RS(   sY  A class whose getitem method can be used to generate a new type
    representing a specific variadic signature.

    Examples
    --------
    >>> Variadic[int]  # any number of int arguments
    <class 'multipledispatch.variadic.Variadic[int]'>
    >>> Variadic[(int, str)]  # any number of one of int or str arguments
    <class 'multipledispatch.variadic.Variadic[(int, str)]'>
    >>> issubclass(int, Variadic[int])
    True
    >>> issubclass(int, Variadic[(int, str)])
    True
    >>> issubclass(str, Variadic[(int, str)])
    True
    >>> issubclass(float, Variadic[(int, str)])
    False
    (   R   R   R   (    (    (    s8   lib/python2.7/site-packages/multipledispatch/variadic.pyR   N   s   (	   t   sixt   utilsR    R   R   R   R   t   with_metaclassR   (    (    (    s8   lib/python2.7/site-packages/multipledispatch/variadic.pyt   <module>   s
   	