Mercurial > hgrepos > Python > libs > ConfigMix
comparison configmix/compat.py @ 320:98490375d90c
Allow variable name quoting to be used in .getvar() and .getvar_s() and references
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 06 May 2021 09:45:51 +0200 |
| parents | eed16a1ec8f3 |
| children | 396d8d9aaead |
comparison
equal
deleted
inserted
replaced
| 319:5427ca342c1e | 320:98490375d90c |
|---|---|
| 12 | 12 |
| 13 __all__ = ["PY2", | 13 __all__ = ["PY2", |
| 14 "text_to_native_os_str", | 14 "text_to_native_os_str", |
| 15 "native_os_str_to_text", | 15 "native_os_str_to_text", |
| 16 "u", | 16 "u", |
| 17 "u2fs"] | 17 "u2fs", |
| 18 "uchr"] | |
| 18 | 19 |
| 19 | 20 |
| 20 import sys | 21 import sys |
| 21 import os | 22 import os |
| 22 import locale | 23 import locale |
| 65 if not force and os.name in ("nt", "ce"): | 66 if not force and os.name in ("nt", "ce"): |
| 66 # WinNT and CE have native Unicode support: nothing to convert | 67 # WinNT and CE have native Unicode support: nothing to convert |
| 67 return s | 68 return s |
| 68 return s.encode(_FS_ENCODING) | 69 return s.encode(_FS_ENCODING) |
| 69 | 70 |
| 71 def uchr(n): | |
| 72 return unichr(n) | |
| 73 | |
| 70 else: | 74 else: |
| 71 | 75 |
| 72 def text_to_native_os_str(s, encoding=None): | 76 def text_to_native_os_str(s, encoding=None): |
| 73 return s | 77 return s |
| 74 | 78 |
| 94 return `s` unchanged. | 98 return `s` unchanged. |
| 95 | 99 |
| 96 """ | 100 """ |
| 97 assert isinstance(s, str) | 101 assert isinstance(s, str) |
| 98 return s | 102 return s |
| 103 | |
| 104 def uchr(n): | |
| 105 return chr(n) |
