Allow variable and expression in YAML file
Project description
yamlx
yaml内で変数や計算式を扱えるようにしたもの
How to install
>> pip install yamlx
How to use
存在しているキーの値を代入したいとき -> ${key1.key2.key3 ...}
計算式を入れたいとき -> 普通に演算子を用いて書いてください(+,-,*,/,%,//,**)が使えます.${...}も使えます.
# example.yaml
train :
batch_size : 16
learning_rate : 0.001
epochs : 50
signal :
sample_rate : 16000
hop_size : 256
n_mels : 80
eps : 1 / 100
max_len : ${signal.sample_rate} // ${signal.hop_size}
model :
input_dim : 128
input_channel : ${signal.n_mels}
output_channel : 5
>> import yamlx
>> path = "./example.yaml"
>> data = yamlx.load(path)
>> print(data)
>> {'train': {'batch_size': 16, 'learning_rate': 0.001, 'epochs': 50}, 'signal': {'sample_rate': 16000, 'hop_size': 256, 'n_mels': 80, 'eps': 0.01, 'max_len': 62.0}, 'model': {'input_dim': 128, 'input_channel': 80, 'output_channel': 5}}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
yamlx-0.0.8.tar.gz
(5.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
yamlx-0.0.8-py3-none-any.whl
(5.6 kB
view details)
File details
Details for the file yamlx-0.0.8.tar.gz.
File metadata
- Download URL: yamlx-0.0.8.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95884b69a7c35161058615ae5920b2f31ccc62897afe9b3a0ef9422e6f68b3bf
|
|
| MD5 |
f55c2163ca10ff6fb52150448e082ee9
|
|
| BLAKE2b-256 |
17908c6778e5d2aac6d37f519d08673e38892602b74c45157cda14b41831581e
|
File details
Details for the file yamlx-0.0.8-py3-none-any.whl.
File metadata
- Download URL: yamlx-0.0.8-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23633a499822616330be6403426166c00ddd9a8af453b04f9aefed53e1a04b82
|
|
| MD5 |
5ba316b69cc921285ecfe2591b21d0bf
|
|
| BLAKE2b-256 |
e9ef988af576d25978d1f66a1a7193bebc5528d7d7d5481764407e96ae6dac9f
|