@@ -19,7 +19,7 @@ In version `2.0`, [fsspec][] was introduced. With it, we can even include files
19
19
pip install " pyyaml-include"
20
20
```
21
21
22
- Since we are using [ fsspec] [ ] to open including files from v2.0, an installation can be performed like below, if want to open remote files:
22
+ Because [ fsspec] [ ] was introduced to open the including files since v2.0, an installation can be performed like below, if want to open remote files:
23
23
24
24
- for files on website:
25
25
@@ -63,7 +63,7 @@ Consider we have such [YAML][] files:
63
63
64
64
To include `1.yml`, `2.yml` in `0.yml`, we shall :
65
65
66
- 1. Register a `yaml_include.Constructor` to [PyYAML][]'s loader class, with `!inc` as it's tag :
66
+ 1. Register a `yaml_include.Constructor` to [PyYAML][]'s loader class, with `!inc`(or any other tags start with `!` character) as it's tag :
67
67
68
68
` ` ` python
69
69
import yaml
@@ -73,14 +73,14 @@ To include `1.yml`, `2.yml` in `0.yml`, we shall:
73
73
yaml.add_constructor("!inc", yaml_include.Constructor(base_dir='/your/conf/dir'))
74
74
` ` `
75
75
76
- 1. Write `!inc` tags in `0.yaml` :
76
+ 1. Use `!inc` tag(s) in `0.yaml` :
77
77
78
78
` ` ` yaml
79
79
file1: !inc include.d/1.yml
80
80
file2: !inc include.d/2.yml
81
81
` ` `
82
82
83
- 1. Load it
83
+ 1. Load `0.yaml` in your Python program
84
84
85
85
` ` ` python
86
86
with open('0.yml') as f:
@@ -91,7 +91,7 @@ To include `1.yml`, `2.yml` in `0.yml`, we shall:
91
91
we'll get :
92
92
93
93
` ` ` python
94
- {'file1':{'name':'1'},'file2':{'name':'2'}}
94
+ {'file1': {'name': '1'}, 'file2': {'name': '2'}}
95
95
` ` `
96
96
97
97
1. (optional) the constructor can be unregistered :
0 commit comments