ó
ž^Yc           @   s;   d  Z  d d l m Z d d  Z d d  Z d   Z d S(   sf   

uritemplate.api
===============

This module contains the very simple API provided by uritemplate.

i˙˙˙˙(   t   URITemplatec         K   s   t  |   j | |  S(   sq  Expand the template with the given parameters.

    :param str uri: The templated URI to expand
    :param dict var_dict: Optional dictionary with variables and values
    :param kwargs: Alternative way to pass arguments
    :returns: str

    Example::

        expand('https://api.github.com{/end}', {'end': 'users'})
        expand('https://api.github.com{/end}', end='gists')

    .. note:: Passing values by both parts, may override values in
              ``var_dict``. For example::

                  expand('https://{var}', {'var': 'val1'}, var='val2')

              ``val2`` will be used instead of ``val1``.

    (   R    t   expand(   t   urit   var_dictt   kwargs(    (    s4   /tmp/pip-build-kpPAdC/uritemplate/uritemplate/api.pyR      s    c         K   s   t  |   j | |  S(   sŐ  Partially expand the template with the given parameters.

    If all of the parameters for the template are not given, return a
    partially expanded template.

    :param dict var_dict: Optional dictionary with variables and values
    :param kwargs: Alternative way to pass arguments
    :returns: :class:`URITemplate`

    Example::

        t = URITemplate('https://api.github.com{/end}')
        t.partial()  # => URITemplate('https://api.github.com{/end}')

    (   R    t   partial(   R   R   R   (    (    s4   /tmp/pip-build-kpPAdC/uritemplate/uritemplate/api.pyR   $   s    c         C   s   t  t |   j  S(   sh  Parse the variables of the template.

    This returns all of the variable names in the URI Template.

    :returns: Set of variable names
    :rtype: set

    Example::

        variables('https://api.github.com{/end})
        # => {'end'}
        variables('https://api.github.com/repos{/username}{/repository}')
        # => {'username', 'repository'}

    (   t   setR    t   variable_names(   R   (    (    s4   /tmp/pip-build-kpPAdC/uritemplate/uritemplate/api.pyt	   variables7   s    N(   t   __doc__t   uritemplate.templateR    t   NoneR   R   R   (    (    (    s4   /tmp/pip-build-kpPAdC/uritemplate/uritemplate/api.pyt   <module>   s   