Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/pycompat.py @ 33874:cfcfbe6c96f8
py3: select input or raw_input by pycompat
This seems slightly cleaner.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 16 Aug 2017 13:54:24 +0900 |
parents | 524b13fc711f |
children | 192f7b126ed2 |
comparison
equal
deleted
inserted
replaced
33873:f18b11534274 | 33874:cfcfbe6c96f8 |
---|---|
61 sysexecutable = sys.executable | 61 sysexecutable = sys.executable |
62 if sysexecutable: | 62 if sysexecutable: |
63 sysexecutable = os.fsencode(sysexecutable) | 63 sysexecutable = os.fsencode(sysexecutable) |
64 stringio = io.BytesIO | 64 stringio = io.BytesIO |
65 maplist = lambda *args: list(map(*args)) | 65 maplist = lambda *args: list(map(*args)) |
66 rawinput = input | |
66 | 67 |
67 # TODO: .buffer might not exist if std streams were replaced; we'll need | 68 # TODO: .buffer might not exist if std streams were replaced; we'll need |
68 # a silly wrapper to make a bytes stream backed by a unicode one. | 69 # a silly wrapper to make a bytes stream backed by a unicode one. |
69 stdin = sys.stdin.buffer | 70 stdin = sys.stdin.buffer |
70 stdout = sys.stdout.buffer | 71 stdout = sys.stdout.buffer |
310 getcwd = os.getcwd | 311 getcwd = os.getcwd |
311 sysexecutable = sys.executable | 312 sysexecutable = sys.executable |
312 shlexsplit = shlex.split | 313 shlexsplit = shlex.split |
313 stringio = cStringIO.StringIO | 314 stringio = cStringIO.StringIO |
314 maplist = map | 315 maplist = map |
316 rawinput = raw_input | |
315 | 317 |
316 class _pycompatstub(object): | 318 class _pycompatstub(object): |
317 def __init__(self): | 319 def __init__(self): |
318 self._aliases = {} | 320 self._aliases = {} |
319 | 321 |