YAPF
A formatter for Python files
YAPF is a Python code formatter that automatically rewrites source to match a chosen style, using a clang-format–inspired algorithm to search for the “best” layout under your rules. Instead of relying on a fixed set of heuristics, it explores formatting decisions and chooses the lowest-cost result, aiming to produce code a human would write when following a style guide. You can run it as a command-line tool or call it as a library via FormatCode / FormatFile, making it easy to embed in editors...