Yup, all of this is fairly tricky for YAPF as well (<a href="https:&#x2F;&#x2F;github.com&#x2F;google&#x2F;yapf" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;google&#x2F;yapf</a>). We ended up reusing clang-format&#x27;s algorithm