Mercurial > hgrepos > Python > libs > ConfigMix
diff configmix/__init__.py @ 195:28e6c1413947
Added support for TOML style configuration files
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Fri, 03 May 2019 21:51:09 +0200 |
| parents | 8af600d0e5c0 |
| children | 7865f28038a4 |
line wrap: on
line diff
--- a/configmix/__init__.py Fri May 03 20:21:12 2019 +0200 +++ b/configmix/__init__.py Fri May 03 21:51:09 2019 +0200 @@ -119,6 +119,11 @@ return ini.load(filename) +def _load_toml(filename): + from . import toml + return toml.load(filename) + + EMACS_MODELINE = re.compile(r"-\*-(.*?)-\*-") EMACS_MODE = re.compile(r"(?:\A\s*|;\s*)mode[:=]\s*([-_.a-zA-Z0-9]+)") @@ -154,6 +159,7 @@ "conf": _load_ini, "conf-windows": _load_ini, "ini": _load_ini, + "toml": _load_toml, "javascript": _load_json, "json": _load_json, } @@ -166,6 +172,7 @@ ("*.json", "json"), ("*.py", "python"), ("*.ini", "conf"), + ("*.toml", "toml"), ] """The builtin default associations of filename extensions with file modes -- in that order.
