snam 1.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- snam-1.0.4/LICENSE +21 -0
- snam-1.0.4/PKG-INFO +243 -0
- snam-1.0.4/README.md +225 -0
- snam-1.0.4/setup.cfg +4 -0
- snam-1.0.4/setup.py +38 -0
- snam-1.0.4/snam/__init__.py +4 -0
- snam-1.0.4/snam/errors.py +34 -0
- snam-1.0.4/snam/parser.py +332 -0
- snam-1.0.4/snam/tokenizer.py +133 -0
- snam-1.0.4/snam.egg-info/PKG-INFO +243 -0
- snam-1.0.4/snam.egg-info/SOURCES.txt +18 -0
- snam-1.0.4/snam.egg-info/dependency_links.txt +1 -0
- snam-1.0.4/snam.egg-info/top_level.txt +1 -0
- snam-1.0.4/tests/test_builder.py +74 -0
- snam-1.0.4/tests/test_env.py +16 -0
- snam-1.0.4/tests/test_include.py +116 -0
- snam-1.0.4/tests/test_load.py +32 -0
- snam-1.0.4/tests/test_meld.py +89 -0
- snam-1.0.4/tests/test_parser.py +222 -0
- snam-1.0.4/tests/test_shell.py +15 -0
snam-1.0.4/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 pymlconf
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
snam-1.0.4/PKG-INFO
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: snam
|
|
3
|
+
Version: 1.0.4
|
|
4
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
5
|
+
Classifier: Intended Audience :: Developers
|
|
6
|
+
Classifier: Operating System :: OS Independent
|
|
7
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
11
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Dynamic: classifier
|
|
15
|
+
Dynamic: description
|
|
16
|
+
Dynamic: description-content-type
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
# snam
|
|
20
|
+
|
|
21
|
+
Still Not A Markup!
|
|
22
|
+
|
|
23
|
+
Another YAML parser and builder featured by:
|
|
24
|
+
|
|
25
|
+
- Include other files.
|
|
26
|
+
- Expand environment varibales.
|
|
27
|
+
- Execute and use the shell commands standard output.
|
|
28
|
+
- Merge/Melt mappings.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install snam
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## quickstart
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from snam import loads
|
|
41
|
+
|
|
42
|
+
yamldoc = '''
|
|
43
|
+
foo:
|
|
44
|
+
enabled: true
|
|
45
|
+
title: BAR
|
|
46
|
+
rate: .73
|
|
47
|
+
user: !env USER
|
|
48
|
+
greeting: !shell echo Hello
|
|
49
|
+
|
|
50
|
+
fruites:
|
|
51
|
+
- cherry
|
|
52
|
+
- melon
|
|
53
|
+
- banana
|
|
54
|
+
- pineapple
|
|
55
|
+
'''
|
|
56
|
+
|
|
57
|
+
obj = loads(ymldoc)
|
|
58
|
+
assert obj.foo.enabled
|
|
59
|
+
assert obj.title == 'BAR'
|
|
60
|
+
assert obj.rate == 0.73
|
|
61
|
+
assert obj.fruites == ['cherry', 'melon', 'banana', 'pineapple']
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Tutorial
|
|
65
|
+
|
|
66
|
+
### Parsing
|
|
67
|
+
|
|
68
|
+
You may user `loads(str)` function to parse `YAML` string, and `load(file)`
|
|
69
|
+
to parse `file-like` object or filename. these functions return a
|
|
70
|
+
`snam.Meld` object. The `Meld` object is subclass of the Python's dictionary
|
|
71
|
+
but in addtion you can access the members by `getattr`, `setattr` and
|
|
72
|
+
`delattr` operations.
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
meld = loads('foo: bar')
|
|
77
|
+
assert meld.foo == 'bar'
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
meld = load('foo.yml')
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
with open('foo.yml') as file:
|
|
86
|
+
meld = load(file)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Merging/Melting
|
|
90
|
+
|
|
91
|
+
Using the `|=` operator you may merge any other dictionary or `YAML-string`
|
|
92
|
+
into a `Meld`.
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
meld |= '''
|
|
96
|
+
foo: bar
|
|
97
|
+
baz: 23
|
|
98
|
+
'''
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
And also using the `<<=` you may load a file-like object or a filename into a
|
|
102
|
+
`Meld` object.
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
meld <<= 'foo.yml'
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
with open('foo.yml') as file:
|
|
110
|
+
meld <<= file
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
### Dump
|
|
115
|
+
|
|
116
|
+
Use `snam.dumps(obj) -> str`, `snam.dump(obj, file)` and also
|
|
117
|
+
`meld >>= filename`.
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
dumps(meld, indent=6, indentsize=2)
|
|
121
|
+
dump(meld, 'foo.yml', indent=6, indentsize=2)
|
|
122
|
+
|
|
123
|
+
with open('foo.yml', 'w') as file:
|
|
124
|
+
dump(meld, file, indent=6, indentsize=2)
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
meld >>= 'foo.yml'
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
with open('foo.yml', 'w') as file:
|
|
134
|
+
meld >>= file
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Contribution
|
|
138
|
+
|
|
139
|
+
### Dependencies
|
|
140
|
+
Install [python-makelib](https://github.com/pylover/python-makelib).
|
|
141
|
+
|
|
142
|
+
### Virtualenv
|
|
143
|
+
|
|
144
|
+
Create virtual environment:
|
|
145
|
+
```bash
|
|
146
|
+
make venv
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Delete virtual environment:
|
|
150
|
+
```bash
|
|
151
|
+
make venv-delete
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Activate the virtual environment:
|
|
155
|
+
```bash
|
|
156
|
+
source ./activate.sh
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
### Install (editable mode)
|
|
161
|
+
Install this project as editable mode and all other development dependencies:
|
|
162
|
+
```bash
|
|
163
|
+
make env
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
### Tests
|
|
168
|
+
Execute all tests:
|
|
169
|
+
```bash
|
|
170
|
+
make test
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Execute specific test(s) using wildcard:
|
|
174
|
+
```bash
|
|
175
|
+
make test F=tests/test_db*
|
|
176
|
+
make test F=tests/test_form.py::test_querystringform
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
*refer to* [pytest documentation](https://docs.pytest.org/en/7.1.x/how-to/usage.html#how-to-invoke-pytest)
|
|
180
|
+
*for more info about invoking tests.*
|
|
181
|
+
|
|
182
|
+
Execute tests and report coverage result:
|
|
183
|
+
```bash
|
|
184
|
+
make cover
|
|
185
|
+
make cover F=tests/test_static.py
|
|
186
|
+
make cover-html
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
# Lint
|
|
191
|
+
```bash
|
|
192
|
+
make lint
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
### Distribution
|
|
197
|
+
Execute these commands to create `Python`'s standard distribution packages
|
|
198
|
+
at `dist` directory:
|
|
199
|
+
```bash
|
|
200
|
+
make sdist
|
|
201
|
+
make wheel
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
### Clean build directory
|
|
206
|
+
Execute:
|
|
207
|
+
```bash
|
|
208
|
+
make clean
|
|
209
|
+
```
|
|
210
|
+
to clean-up previous `dist/*` and `build/*` directories.
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
### PyPI
|
|
214
|
+
|
|
215
|
+
> **_WARNING:_** Do not do this if you'r not responsible as author and
|
|
216
|
+
> or maintainer of this project.
|
|
217
|
+
|
|
218
|
+
Execute
|
|
219
|
+
```bash
|
|
220
|
+
make clean
|
|
221
|
+
make pypi
|
|
222
|
+
```
|
|
223
|
+
to upload `sdists` and `wheel` packages on [PyPI](https://pypi.org).
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
## Documentation
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
source activate.sh
|
|
230
|
+
make doc
|
|
231
|
+
make doclive
|
|
232
|
+
make doctest
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Or
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
source activate.sh
|
|
239
|
+
cd sphinx
|
|
240
|
+
make doctest
|
|
241
|
+
make html
|
|
242
|
+
make livehtml
|
|
243
|
+
```
|
snam-1.0.4/README.md
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# snam
|
|
2
|
+
|
|
3
|
+
Still Not A Markup!
|
|
4
|
+
|
|
5
|
+
Another YAML parser and builder featured by:
|
|
6
|
+
|
|
7
|
+
- Include other files.
|
|
8
|
+
- Expand environment varibales.
|
|
9
|
+
- Execute and use the shell commands standard output.
|
|
10
|
+
- Merge/Melt mappings.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install snam
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## quickstart
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from snam import loads
|
|
23
|
+
|
|
24
|
+
yamldoc = '''
|
|
25
|
+
foo:
|
|
26
|
+
enabled: true
|
|
27
|
+
title: BAR
|
|
28
|
+
rate: .73
|
|
29
|
+
user: !env USER
|
|
30
|
+
greeting: !shell echo Hello
|
|
31
|
+
|
|
32
|
+
fruites:
|
|
33
|
+
- cherry
|
|
34
|
+
- melon
|
|
35
|
+
- banana
|
|
36
|
+
- pineapple
|
|
37
|
+
'''
|
|
38
|
+
|
|
39
|
+
obj = loads(ymldoc)
|
|
40
|
+
assert obj.foo.enabled
|
|
41
|
+
assert obj.title == 'BAR'
|
|
42
|
+
assert obj.rate == 0.73
|
|
43
|
+
assert obj.fruites == ['cherry', 'melon', 'banana', 'pineapple']
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Tutorial
|
|
47
|
+
|
|
48
|
+
### Parsing
|
|
49
|
+
|
|
50
|
+
You may user `loads(str)` function to parse `YAML` string, and `load(file)`
|
|
51
|
+
to parse `file-like` object or filename. these functions return a
|
|
52
|
+
`snam.Meld` object. The `Meld` object is subclass of the Python's dictionary
|
|
53
|
+
but in addtion you can access the members by `getattr`, `setattr` and
|
|
54
|
+
`delattr` operations.
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
meld = loads('foo: bar')
|
|
59
|
+
assert meld.foo == 'bar'
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
meld = load('foo.yml')
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
with open('foo.yml') as file:
|
|
68
|
+
meld = load(file)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Merging/Melting
|
|
72
|
+
|
|
73
|
+
Using the `|=` operator you may merge any other dictionary or `YAML-string`
|
|
74
|
+
into a `Meld`.
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
meld |= '''
|
|
78
|
+
foo: bar
|
|
79
|
+
baz: 23
|
|
80
|
+
'''
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
And also using the `<<=` you may load a file-like object or a filename into a
|
|
84
|
+
`Meld` object.
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
meld <<= 'foo.yml'
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
with open('foo.yml') as file:
|
|
92
|
+
meld <<= file
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
### Dump
|
|
97
|
+
|
|
98
|
+
Use `snam.dumps(obj) -> str`, `snam.dump(obj, file)` and also
|
|
99
|
+
`meld >>= filename`.
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
dumps(meld, indent=6, indentsize=2)
|
|
103
|
+
dump(meld, 'foo.yml', indent=6, indentsize=2)
|
|
104
|
+
|
|
105
|
+
with open('foo.yml', 'w') as file:
|
|
106
|
+
dump(meld, file, indent=6, indentsize=2)
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
meld >>= 'foo.yml'
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
with open('foo.yml', 'w') as file:
|
|
116
|
+
meld >>= file
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Contribution
|
|
120
|
+
|
|
121
|
+
### Dependencies
|
|
122
|
+
Install [python-makelib](https://github.com/pylover/python-makelib).
|
|
123
|
+
|
|
124
|
+
### Virtualenv
|
|
125
|
+
|
|
126
|
+
Create virtual environment:
|
|
127
|
+
```bash
|
|
128
|
+
make venv
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Delete virtual environment:
|
|
132
|
+
```bash
|
|
133
|
+
make venv-delete
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Activate the virtual environment:
|
|
137
|
+
```bash
|
|
138
|
+
source ./activate.sh
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
### Install (editable mode)
|
|
143
|
+
Install this project as editable mode and all other development dependencies:
|
|
144
|
+
```bash
|
|
145
|
+
make env
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
### Tests
|
|
150
|
+
Execute all tests:
|
|
151
|
+
```bash
|
|
152
|
+
make test
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Execute specific test(s) using wildcard:
|
|
156
|
+
```bash
|
|
157
|
+
make test F=tests/test_db*
|
|
158
|
+
make test F=tests/test_form.py::test_querystringform
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
*refer to* [pytest documentation](https://docs.pytest.org/en/7.1.x/how-to/usage.html#how-to-invoke-pytest)
|
|
162
|
+
*for more info about invoking tests.*
|
|
163
|
+
|
|
164
|
+
Execute tests and report coverage result:
|
|
165
|
+
```bash
|
|
166
|
+
make cover
|
|
167
|
+
make cover F=tests/test_static.py
|
|
168
|
+
make cover-html
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
# Lint
|
|
173
|
+
```bash
|
|
174
|
+
make lint
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
### Distribution
|
|
179
|
+
Execute these commands to create `Python`'s standard distribution packages
|
|
180
|
+
at `dist` directory:
|
|
181
|
+
```bash
|
|
182
|
+
make sdist
|
|
183
|
+
make wheel
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
### Clean build directory
|
|
188
|
+
Execute:
|
|
189
|
+
```bash
|
|
190
|
+
make clean
|
|
191
|
+
```
|
|
192
|
+
to clean-up previous `dist/*` and `build/*` directories.
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
### PyPI
|
|
196
|
+
|
|
197
|
+
> **_WARNING:_** Do not do this if you'r not responsible as author and
|
|
198
|
+
> or maintainer of this project.
|
|
199
|
+
|
|
200
|
+
Execute
|
|
201
|
+
```bash
|
|
202
|
+
make clean
|
|
203
|
+
make pypi
|
|
204
|
+
```
|
|
205
|
+
to upload `sdists` and `wheel` packages on [PyPI](https://pypi.org).
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
## Documentation
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
source activate.sh
|
|
212
|
+
make doc
|
|
213
|
+
make doclive
|
|
214
|
+
make doctest
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Or
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
source activate.sh
|
|
221
|
+
cd sphinx
|
|
222
|
+
make doctest
|
|
223
|
+
make html
|
|
224
|
+
make livehtml
|
|
225
|
+
```
|
snam-1.0.4/setup.cfg
ADDED
snam-1.0.4/setup.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# This file is generated by https://github.com:pylover/python-makelib
|
|
2
|
+
import os.path
|
|
3
|
+
import re
|
|
4
|
+
|
|
5
|
+
from setuptools import setup, find_packages
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# reading package's version (same way sqlalchemy does)
|
|
9
|
+
with open(
|
|
10
|
+
os.path.join(os.path.dirname(__file__), 'snam', '__init__.py')
|
|
11
|
+
) as v_file:
|
|
12
|
+
package_version = \
|
|
13
|
+
re.compile('.*__version__ = \'(.*?)\'', re.S) \
|
|
14
|
+
.match(v_file.read()) \
|
|
15
|
+
.group(1)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
setup(
|
|
19
|
+
name='snam',
|
|
20
|
+
version=package_version,
|
|
21
|
+
long_description=open('README.md').read(),
|
|
22
|
+
long_description_content_type='text/markdown', # This is important!
|
|
23
|
+
packages=find_packages(
|
|
24
|
+
where='.',
|
|
25
|
+
include=['snam'],
|
|
26
|
+
exclude=['tests']
|
|
27
|
+
),
|
|
28
|
+
classifiers=[
|
|
29
|
+
"Development Status :: 5 - Production/Stable",
|
|
30
|
+
'Intended Audience :: Developers',
|
|
31
|
+
'Operating System :: OS Independent',
|
|
32
|
+
'Programming Language :: Python :: 3.10',
|
|
33
|
+
'Programming Language :: Python :: 3.11',
|
|
34
|
+
'Programming Language :: Python :: 3.12',
|
|
35
|
+
'Programming Language :: Python :: 3.13',
|
|
36
|
+
'Topic :: Software Development :: Libraries'
|
|
37
|
+
],
|
|
38
|
+
)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class YConfException(Exception):
|
|
5
|
+
def __init__(self, tok, title, filename=None):
|
|
6
|
+
file = (filename if filename.startswith('/')
|
|
7
|
+
else os.path.relpath(filename)) if filename else '(stream)'
|
|
8
|
+
super().__init__(
|
|
9
|
+
f'{file}:{tok.line}:{tok.column}: {title}: {tok}'
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class InvalidTokenError(YConfException):
|
|
14
|
+
def __init__(self, tok, filename=None):
|
|
15
|
+
super().__init__(tok, 'Invalid token', filename)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ExpectedTokenError(YConfException):
|
|
19
|
+
def __init__(self, tok, expected, filename=None):
|
|
20
|
+
super().__init__(tok, f'Expected {expected}, found', filename)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class UnknownTagError(YConfException):
|
|
24
|
+
def __init__(self, tok, filename=None):
|
|
25
|
+
super().__init__(tok, 'Unknown', filename)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class IncludeMismatchError(YConfException):
|
|
29
|
+
def __init__(self, tok, expectedtype, giventype, filename=None):
|
|
30
|
+
super().__init__(
|
|
31
|
+
tok,
|
|
32
|
+
f'Trying to include `{giventype}` inside `{expectedtype}`',
|
|
33
|
+
filename
|
|
34
|
+
)
|