U
    T³d	  ã                   @   sˆ   d Z ddlZddlmZ ddlmZ ddlmZ dZ	de
ejej eje
dœdd	„Zde
ejej ejedœd
d„Ze
edœdd„ZdS )zf

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

This module contains the very simple API provided by uritemplate.

é    N)Úvariable)Ú
OrderedSet)ÚURITemplate)r   r   ÚexpandÚpartialÚ	variables)ÚuriÚvar_dictÚkwargsÚreturnc                 K   s   t | ƒj|f|ŽS )aq  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   r   ©r   r	   r
   © r   ú3/tmp/pip-unpacked-wheel-qt7p1f5q/uritemplate/api.pyr      s    r   c                 K   s   t | ƒj|f|ŽS )aÕ  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   r   r   r   r   r   r   .   s    r   )r   r   c                 C   s   t t| ƒjƒS )ah  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'}

    )r   r   Zvariable_names)r   r   r   r   r   E   s    r   )N)N)Ú__doc__ÚtypingÚtZuritemplater   Zuritemplate.orderedsetr   Zuritemplate.templater   Ú__all__ÚstrÚOptionalZVariableValueDictZVariableValuer   r   r   r   r   r   r   Ú<module>   s(    þ
ü þ
ü