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}'
(
uri: str,
var_dict: t.Optional[variable.VariableValueDict] = None,
**kwargs: variable.VariableValue,
)
| 17 | |
| 18 | |
| 19 | def expand( |
| 20 | uri: str, |
| 21 | var_dict: t.Optional[variable.VariableValueDict] = None, |
| 22 | **kwargs: variable.VariableValue, |
| 23 | ) -> str: |
| 24 | """Expand the template with the given parameters. |
| 25 | |
| 26 | :param str uri: The templated URI to expand |
| 27 | :param dict var_dict: Optional dictionary with variables and values |
| 28 | :param kwargs: Alternative way to pass arguments |
| 29 | :returns: str |
| 30 | |
| 31 | Example:: |
| 32 | |
| 33 | expand('https://api.github.com{/end}', {'end': 'users'}) |
| 34 | expand('https://api.github.com{/end}', end='gists') |
| 35 | |
| 36 | .. note:: Passing values by both parts, may override values in |
| 37 | ``var_dict``. For example:: |
| 38 | |
| 39 | expand('https://{var}', {'var': 'val1'}, var='val2') |
| 40 | |
| 41 | ``val2`` will be used instead of ``val1``. |
| 42 | |
| 43 | """ |
| 44 | return URITemplate(uri).expand(var_dict, **kwargs) |
| 45 | |
| 46 | |
| 47 | def partial( |
searching dependent graphs…