> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.conductorquantum.com/api-reference/stanza-api/utils/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.conductorquantum.com/_mcp/server.
# stanza.utils
## Module Contents
### Functions
| Name | Description |
|------|-------------|
| [`substitute_parameters`](#stanzautilssubstitute_parameters) | Substitute parameters in a template string. |
| [`get_config_resource`](#stanzautilsget_config_resource) | Get config file content |
| [`load_device_config`](#stanzautilsload_device_config) | Load a device configuration YAML file. |
| [`generate_channel_configs`](#stanzautilsgenerate_channel_configs) | Generate ChannelConfigs for the device. |
| [`device_from_config`](#stanzautilsdevice_from_config) | Create a device from a DeviceConfig object. |
| [`device_from_yaml`](#stanzautilsdevice_from_yaml) | Load a device from a YAML configuration file. |
### API
```python
stanza.utils.substitute_parameters(
template: str, substitutions: dict[str, typing.Any]
) -> str
```
Substitute parameters in a template string.
**Parameters:**
The template string to substitute parameters in.
A dictionary of substitutions to make.
**Returns:**
The substituted string.
```python
stanza.utils.get_config_resource(
config_path: str | pathlib.Path, encoding: str = 'utf-8'
) -> str
```
Get config file content
**Parameters:**
The path to the config file.
The encoding of the config file.
**Returns:**
The config file content.
```python
stanza.utils.load_device_config(
config_path: str | pathlib.Path, is_stanza_config: bool = False
) -> stanza.models.DeviceConfig
```
Load a device configuration YAML file.
**Parameters:**
Whether the config is a stanza config.
**Returns:**
The device configuration.
**Raises:**
ValueError: If the file cannot be loaded.
```python
stanza.utils.generate_channel_configs(device_config: stanza.models.DeviceConfig) -> dict[str, stanza.base.channels.ChannelConfig]
```
Generate ChannelConfigs for the device.
**Parameters:**
The device configuration.
**Returns:**
A dictionary mapping of gate/contact name to ChannelConfigs.
```python
stanza.utils.device_from_config(
device_config: stanza.models.DeviceConfig, **driver_kwargs: typing.Any
) -> stanza.device.Device
```
Create a device from a DeviceConfig object.
**Parameters:**
The device configuration object.
**Returns:**
A configured Device instance with instantiated instruments.
**Raises:**
ValueError: If required driver field is missing or instruments cannot be instantiated.
```python
stanza.utils.device_from_yaml(
config_path: str | pathlib.Path,
is_stanza_config: bool = False,
**driver_kwargs: typing.Any
) -> stanza.device.Device
```
Load a device from a YAML configuration file.
**Parameters:**
Path to the device configuration YAML file.
Whether the config is a stanza config.
**Returns:**
A configured Device instance with instantiated instruments.
**Raises:**
ValueError: If required driver field is missing or instruments cannot be instantiated.