File: ipywidgets_docs_utils.py

package info (click to toggle)
ipywidgets 8.1.5-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,520 kB
  • sloc: python: 7,041; javascript: 1,764; sh: 62; makefile: 36
file content (19 lines) | stat: -rw-r--r-- 672 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import subprocess

def jupyterlab_markdown_heading(heading_text):
    """Use JupyterLab-style anchors for a consistent authoring/viewing experience.

    This _must_ be defined in an external file as local functions can't be asssigned
    to config values, as they can't be pickled.
    """
    return heading_text.replace(" ", "-")

def run_if_needed(args, cwd, skip_if=None):
    print(f"in {cwd}...")
    if skip_if:
        print("... skipping if found:", "\n".join(list(map(str, skip_if))))
        if all(s.exists() for s in skip_if):
            print("...skipping")
            return
    print(">>>", " ".join(args))
    subprocess.check_call(args, cwd=str(cwd))