INNER CODE UNIT · Python

p

x-cmd/x-cmd · mod/codex/lib/py/use-ds.py:44

def p(k, v, color="1;36"):
    if v is None:
        return
    line = "%-25s: %s" % (k, v)
    if tty:
        print("\033[%sm%s\033[0m" % (color, line))
    else:
        print(line)


def err(msg):
    print("error:", msg, file=sys.stderr)
    sys.exit(1)


def deep_set(doc, path, value):
    """Set a dotted-path key in a tomlkit document, creating tables as needed."""
    keys = path.split(".")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…