##// END OF EJS Templates
formatting: blacken the codebase...
formatting: blacken the codebase This is using my patch to black (https://github.com/psf/black/pull/826) so we don't un-wrap collection literals. Done with: hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S # skip-blame mass-reformatting only # no-check-commit reformats foo_bar functions Differential Revision: https://phab.mercurial-scm.org/D6971

File last commit:

r43346:2372284d default
r43346:2372284d default
Show More
heredoctest.py
29 lines | 648 B | text/x-python | PythonLexer
from __future__ import absolute_import, print_function
import sys
def flush():
sys.stdout.flush()
sys.stderr.flush()
globalvars = {}
lines = sys.stdin.readlines()
while lines:
l = lines.pop(0)
if l.startswith('SALT'):
print(l[:-1])
elif l.startswith('>>> '):
snippet = l[4:]
while lines and lines[0].startswith('... '):
l = lines.pop(0)
snippet += l[4:]
c = compile(snippet, '<heredoc>', 'single')
try:
flush()
exec(c, globalvars)
flush()
except Exception as inst:
flush()
print(repr(inst))