@contextmanager
def patched_input(code):
 def lines():
  for line in code.splitlines():
   (yield line)
  raise EOFError()
 def patch_raw_input(lines=lines()):
  return next(lines)
 try:
  raw_input = yapf.py3compat.raw_input
  yapf.py3compat.raw_input = patch_raw_input
  (yield)
 finally:
  yapf.py3compat.raw_input = raw_input

@ contextmanager def patched_input ( code ) : def lines ( ) : for line in code . splitlines ( ) : ( yield line ) raise EOFError ( ) def patch_raw_input ( lines = lines ( ) ) : return next ( lines ) try : raw_input = yapf . py3compat . raw_input yapf . py3compat . raw_input = patch_raw_input ( yield ) finally : yapf . py3compat . raw_input = raw_input
monkey patch code as though it were coming from stdin .