httpstan.services.arguments
¶
Lookup arguments and argument default values for stan::services functions.
Module Contents¶
Functions¶
|
Turn CmdStan C++ type name into Python type. |
|
Fetch default for named argument in a stan:services function. |
|
Get function arguments for stan::services function_name. |
Attributes¶
- httpstan.services.arguments.Method¶
- httpstan.services.arguments.DEFAULTS_LOOKUP¶
- httpstan.services.arguments._pythonize_cmdstan_type(type_name: str) type [source]¶
Turn CmdStan C++ type name into Python type.
For example, “double” becomes
float
(the type).
- httpstan.services.arguments.lookup_default(method: Method, arg: str) Union[float, int] [source]¶
Fetch default for named argument in a stan:services function.
Uses defaults from CmdStan. The file
cmdstan-help-all.json
is generated with the scriptscripts/parse_cmdstan_help.py
from the output of running a CmdStan binary with the argumenthelp-all
(e.g., `` examples/bernoulli/bernoulli help-all``)
- httpstan.services.arguments.function_arguments(function_name: str, services_module: types.ModuleType) List[str] [source]¶
Get function arguments for stan::services function_name.
This function parses a function’s docstring to get argument names. This is an inferior method to using inspect.Signature.from_callable(function). Unfortunately, pybind11 does not support this use of inspect.
A compiled services_module is required for the lookup. Only simple function arguments are returned. For example, callback writers and var_context arguments are dropped.
- Parameters
function_name – Name of the function.
services_module (module) – Compiled model-specific services extension module.
- Returns
Argument names for function_name.