maldil / JavaFyPy

adapting Java AST mining tools to Python
2 stars 1 forks source link

Implement async functions, async with, await #12

Open maldil opened 3 years ago

maldil commented 3 years ago
async def run_clang_format_on_file(filename, semaphore, verbose=False):
    """
    Run clang-format on the provided file.
    """
    # -style=file picks up the closest .clang-format, -i formats the files inplace.
    cmd = "{} -style=file -i {}".format(CLANG_FORMAT_PATH, filename)
    async with semaphore:
        proc = await asyncio.create_subprocess_shell(cmd)
        _ = await proc.wait()
    if verbose:
        print("Formatted {}".format(filename))
maldil commented 3 years ago

file2() - TestPyTorch.java