Mercurial > hgrepos > Python > libs > ConfigMix
comparison configmix/json.py @ 124:be6cdc9cb79c
Use keyword "mode" for file file mode
| author | Franz Glasner <f.glasner@feldmann-mg.com> |
|---|---|
| date | Wed, 04 Apr 2018 10:12:04 +0200 |
| parents | 4218c66b9281 |
| children | 5b62d2c0e5a8 |
comparison
equal
deleted
inserted
replaced
| 123:4218c66b9281 | 124:be6cdc9cb79c |
|---|---|
| 24 .. todo:: Allow all Python string literals | 24 .. todo:: Allow all Python string literals |
| 25 | 25 |
| 26 .. todo:: Use OrderedDict as default mapping implementation (Python 2.7+) | 26 .. todo:: Use OrderedDict as default mapping implementation (Python 2.7+) |
| 27 | 27 |
| 28 """ | 28 """ |
| 29 with io.open(filename, "rt", encoding=encoding) as jsfp: | 29 with io.open(filename, mode="rt", encoding=encoding) as jsfp: |
| 30 decoder = json.decoder.JSONDecoder( | 30 decoder = json.decoder.JSONDecoder( |
| 31 parse_int=lambda n: int(n, 0), | 31 parse_int=lambda n: int(n, 0), |
| 32 strict=False) | 32 strict=False) |
| 33 return decoder.decode(jsfp.read()) | 33 return decoder.decode(jsfp.read()) |
