Mercurial > hgrepos > Python > libs > ConfigMix
comparison configmix/json.py @ 166:b5ce9a8461bf
Use the filesystem encoding explicitely where appropriate.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 14 Mar 2019 01:35:16 +0100 |
| parents | e2e8d21b4122 |
| children | b3b5ed34d180 |
comparison
equal
deleted
inserted
replaced
| 165:6ca90e80f4f4 | 166:b5ce9a8461bf |
|---|---|
| 17 try: | 17 try: |
| 18 from ordereddict import OrderedDict as DictImpl | 18 from ordereddict import OrderedDict as DictImpl |
| 19 except ImportError: | 19 except ImportError: |
| 20 DictImpl = dict | 20 DictImpl = dict |
| 21 | 21 |
| 22 from .compat import u2fs | |
| 23 | |
| 22 | 24 |
| 23 __all__ = ["load"] | 25 __all__ = ["load"] |
| 24 | 26 |
| 25 | 27 |
| 26 # | 28 # |
| 37 | 39 |
| 38 def load(filename, encoding="utf-8"): | 40 def load(filename, encoding="utf-8"): |
| 39 """Load a single JSON file with name `filename` and encoding `encoding`. | 41 """Load a single JSON file with name `filename` and encoding `encoding`. |
| 40 | 42 |
| 41 """ | 43 """ |
| 42 with io.open(filename, mode="rt", encoding=encoding) as jsfp: | 44 with io.open(u2fs(filename), mode="rt", encoding=encoding) as jsfp: |
| 43 # | 45 # |
| 44 # The scanner (not to be changed yet) does only recognize decimal | 46 # The scanner (not to be changed yet) does only recognize decimal |
| 45 # integers yet. | 47 # integers yet. |
| 46 # | 48 # |
| 47 kwds = { | 49 kwds = { |
