Source code for metaprompting.util

from collections.abc import Iterable


[docs] def make_iterable(x, type_check=True): if type_check: if isinstance(x, Iterable): return x else: return [x] else: try: _ = iter(x) except TypeError: x = [x] return x
[docs] def read_multiline_input(prefix=""): contents = [] while True: try: line = input(prefix) except EOFError: break contents.append(line) print() return "\n".join(contents)