Mercurial > hgrepos > Python > libs > ConfigMix
annotate configmix/constants.py @ 654:0d6673d06c2c
Add support for using "tomllib" (in Python's stdlib since 3.11) and "tomli" TOML packages.
They are preferred if they are found to be installed.
But note that the declared dependency for the "toml" extra nevertheless
is the "toml" package. Because it is available for all supported Python
versions.
So use Python 3.11+ or install "tomli" manually if you want to use the
alternate packages.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 19 May 2022 22:10:59 +0200 |
| parents | 4499e9b4855d |
| children |
| rev | line source |
|---|---|
|
303
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
1 # -*- coding: utf-8 -*- |
|
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
2 # :- |
|
593
f454889e41fa
Adjust copyright year (the end) to 2022
Franz Glasner <fzglas.hg@dom66.de>
parents:
358
diff
changeset
|
3 # :Copyright: (c) 2015-2022, Franz Glasner. All rights reserved. |
|
303
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
4 # :License: BSD-3-Clause. See LICENSE.txt for details. |
|
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
5 # :- |
|
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
6 """Some important public contants |
|
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
7 |
|
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
8 """ |
|
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
9 |
|
358
8ce46c9e70ab
Make the "u()" import in constants non exportable
Franz Glasner <fzglas.hg@dom66.de>
parents:
357
diff
changeset
|
10 from .compat import u as _u |
|
303
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
11 |
|
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
12 |
|
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
13 COMMENTS = [ |
|
358
8ce46c9e70ab
Make the "u()" import in constants non exportable
Franz Glasner <fzglas.hg@dom66.de>
parents:
357
diff
changeset
|
14 _u("__comment"), |
|
8ce46c9e70ab
Make the "u()" import in constants non exportable
Franz Glasner <fzglas.hg@dom66.de>
parents:
357
diff
changeset
|
15 _u("__doc"), |
|
303
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
16 ] |
|
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
17 """Prefixes for comment configuration keys that are to be handled as |
|
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
18 comments |
|
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
19 |
|
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
20 """ |
|
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
21 |
|
358
8ce46c9e70ab
Make the "u()" import in constants non exportable
Franz Glasner <fzglas.hg@dom66.de>
parents:
357
diff
changeset
|
22 DIR_PREFIX = _u("<dir>") |
|
303
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
23 """Prefix for configuration values to read other configuration files from |
|
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
24 given directory |
|
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
25 |
|
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
26 """ |
|
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
27 |
|
358
8ce46c9e70ab
Make the "u()" import in constants non exportable
Franz Glasner <fzglas.hg@dom66.de>
parents:
357
diff
changeset
|
28 DEL_VALUE = _u("{{::DEL::}}") |
|
303
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
29 """Value for configuration items to signal that the corresponding |
|
637
4499e9b4855d
The ``{{::DEL::}}`` is not subject to interpolation any more.
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
593
diff
changeset
|
30 key-value is to be deleted when configurations are merged. |
|
4499e9b4855d
The ``{{::DEL::}}`` is not subject to interpolation any more.
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
593
diff
changeset
|
31 |
|
4499e9b4855d
The ``{{::DEL::}}`` is not subject to interpolation any more.
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
593
diff
changeset
|
32 Despite having "interpolation" syntax this value will **never** be |
|
4499e9b4855d
The ``{{::DEL::}}`` is not subject to interpolation any more.
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
593
diff
changeset
|
33 substituted. |
|
303
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
34 |
|
2a2f5b86fe34
Move some important public constants into the .constants sub-module
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
35 """ |
|
305
f529ca46dd50
Implemented the "ref" namespace to get configuration tree references.
Franz Glasner <fzglas.hg@dom66.de>
parents:
303
diff
changeset
|
36 |
|
358
8ce46c9e70ab
Make the "u()" import in constants non exportable
Franz Glasner <fzglas.hg@dom66.de>
parents:
357
diff
changeset
|
37 REF_NAMESPACE = _u("ref") |
|
305
f529ca46dd50
Implemented the "ref" namespace to get configuration tree references.
Franz Glasner <fzglas.hg@dom66.de>
parents:
303
diff
changeset
|
38 """Special internal namespace used for implementation of tree |
|
f529ca46dd50
Implemented the "ref" namespace to get configuration tree references.
Franz Glasner <fzglas.hg@dom66.de>
parents:
303
diff
changeset
|
39 `references` |
|
f529ca46dd50
Implemented the "ref" namespace to get configuration tree references.
Franz Glasner <fzglas.hg@dom66.de>
parents:
303
diff
changeset
|
40 |
|
f529ca46dd50
Implemented the "ref" namespace to get configuration tree references.
Franz Glasner <fzglas.hg@dom66.de>
parents:
303
diff
changeset
|
41 """ |
|
357
dd454e1efea4
Use constants for the names of the "None" and "Empty" filters
Franz Glasner <fzglas.hg@dom66.de>
parents:
305
diff
changeset
|
42 |
|
358
8ce46c9e70ab
Make the "u()" import in constants non exportable
Franz Glasner <fzglas.hg@dom66.de>
parents:
357
diff
changeset
|
43 NONE_FILTER = _u("None") |
|
357
dd454e1efea4
Use constants for the names of the "None" and "Empty" filters
Franz Glasner <fzglas.hg@dom66.de>
parents:
305
diff
changeset
|
44 """The public name of the special `None` filter""" |
|
dd454e1efea4
Use constants for the names of the "None" and "Empty" filters
Franz Glasner <fzglas.hg@dom66.de>
parents:
305
diff
changeset
|
45 |
|
358
8ce46c9e70ab
Make the "u()" import in constants non exportable
Franz Glasner <fzglas.hg@dom66.de>
parents:
357
diff
changeset
|
46 EMPTY_FILTER = _u("Empty") |
|
357
dd454e1efea4
Use constants for the names of the "None" and "Empty" filters
Franz Glasner <fzglas.hg@dom66.de>
parents:
305
diff
changeset
|
47 """The public name of the special `None` filter""" |
