File: //usr/local/CyberPanel/lib64/python3.10/site-packages/uritemplate/__pycache__/api.cpython-310.pyc
o
��h � @ s� d Z ddlZddlmZ ddlmZ ddlmZ dZ dde
dejej d ej
d
e
fdd�Z dde
dejej d ej
d
efd
d�Zde
d
efdd�ZdS )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 � t | �j|fi |��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 �E/usr/local/CyberPanel/lib/python3.10/site-packages/uritemplate/api.pyr s r c K r )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 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 �variable_names)r r r r r F s r )N)�__doc__�typing�t�uritemplater �uritemplate.orderedsetr �uritemplate.templater �__all__�str�Optional�VariableValueDict�
VariableValuer r r r r r r �<module> s6 ��
��
���
��
�