def do_black()

in bindings/python/stub.py [0:0]


def do_black(content, is_pyi):
    mode = black.Mode(
        target_versions={black.TargetVersion.PY35},
        line_length=119,
        is_pyi=is_pyi,
        string_normalization=True,
        experimental_string_processing=False,
    )
    try:
        content = content.replace("$self", "self")
        return black.format_file_contents(content, fast=True, mode=mode)
    except black.NothingChanged:
        return content