Mercurial > hgrepos > Python > libs > ConfigMix
comparison configmix/json.py @ 144:7e6ec99d5ff5
Allow comments as keys and filter them by default
| author | Franz Glasner <hg@dom66.de> |
|---|---|
| date | Fri, 13 Apr 2018 09:51:02 +0200 |
| parents | e84870359e1a |
| children | e2e8d21b4122 |
comparison
equal
deleted
inserted
replaced
| 143:252645c69c7b | 144:7e6ec99d5ff5 |
|---|---|
| 36 | 36 |
| 37 | 37 |
| 38 def load(filename, encoding="utf-8"): | 38 def load(filename, encoding="utf-8"): |
| 39 """Load a single JSON file with name `filename` and encoding `encoding`. | 39 """Load a single JSON file with name `filename` and encoding `encoding`. |
| 40 | 40 |
| 41 .. todo:: Allow comments in JSON files | |
| 42 | |
| 43 """ | 41 """ |
| 44 with io.open(filename, mode="rt", encoding=encoding) as jsfp: | 42 with io.open(filename, mode="rt", encoding=encoding) as jsfp: |
| 45 # | 43 # |
| 46 # The scanner (not to be changed yet) does only recognize decimal | 44 # The scanner (not to be changed yet) does only recognize decimal |
| 47 # integers yet. | 45 # integers yet. |
