toylang on yaml or json
command line example
main.yaml
code:
$import: ./filters.py
as: f
definitions:
$let:
nums: {$load: ./nums.yaml#/definitions/nums0/enum}
odds:
type: integer
enum:
$f.odds: {$get: nums}
even:
type: integer
enum:
$f.evens: {$get: nums}
nums.yaml
definitions:
nums0:
type: integer
enum:
[1, 2, 3, 4, 5, 6]
nums1:
type: integer
enum:
[1, 2, 3, 5, 7, 11]
filters.py
def odds(nums):
return [n for n in nums if n % 2 == 1]
def evens(nums):
return [n for n in nums if n % 2 == 0]
run.
$ zenmai examples/readme2/main.yaml
output
zenmai main.yaml
definitions:
odds:
type: integer
enum:
- 1
- 3
- 5
even:
type: integer
enum:
- 2
- 4
- 6
config loader
using zenmai as config loader.
from zenma.loader import load
with open("config.yaml") as rf:
d = load(rf)
0.3.0
$concat improvement
tiny error reporting improvement
changing $load’s scope
0.2.3
fix loader bug
0.2.2
fix –data bug
0.2.1
raw format
0.2.0
add $inherit action
zenmai as config loader
0.1.0:
first release
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
zenmai-0.3.0.tar.gz
(9.2 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
File details
Details for the file zenmai-0.3.0.tar.gz.
File metadata
- Download URL: zenmai-0.3.0.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bd953fa684ac6da28c6deff54a526790a10c645fb42b79063f5d2f6fd7cc229
|
|
| MD5 |
bdc148d21ff631fe0ab90724c0931646
|
|
| BLAKE2b-256 |
83097473287c9ab008ccf1a279770afa5e1398bbe7b277566a5c39127615e8c6
|
File details
Details for the file zenmai-0.3.0-py2.py3-none-any.whl.
File metadata
- Download URL: zenmai-0.3.0-py2.py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
334bafa0a313c09799c491715a4fb3f5f9ff62328b57136df2af373d72a7a814
|
|
| MD5 |
8f149389c76f5915d955da9e7c44dfe3
|
|
| BLAKE2b-256 |
163d4d5d3680e1c0c28e2abc22dbbcb4712eb3e5bba84c29987daa18d682b897
|