发布于 2017-08-26 23:24:25 | 91 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的精品教程,程序狗速度看过来!

YAPF Python 代码格式化工具

YAPF 是 Google 开发的一个用来格式化 Python 代码的工具。


YAPF 0.17.0 已发布,YAPF 是 Google 开源的一个用来格式化 Python 代码的工具。

目前用于 Python 的格式化程序(如 autopep8 和 pep8ify)都用于删除代码中的 lint 错误。这有很明显的局限性。YAPF 采用了不同的方法,基于 Daniel Jasper 开发的 “clang-format” 。从本质上来说,该算法取走代码并重新排版,以符合样式指南的最佳格式,即便原始代码没有违反样式指南。这个想法也是类似于 Go 编程语言的 gofmt 工具。其最终目标是让 YAPE 所产生的代码可以与程序员所写的代码一样好(前提是程序员遵循样式指南),它取代了一些维护代码的苦差。

更新内容:

新增

  • Option `NO_SPACES_AROUND_SELECTED_BINARY_OPERATORS` prevents adding spaces around selected binary operators, in accordance with the current style guide.

更改

  • Adjust blank lines on formatting boundaries when using the `--lines` option.

  • Return 1 if a diff changed the code. This is in line with how GNU diff acts.

修复

  • Corrected how `DEDENT_CLOSING_BRACKETS` and `COALESCE_BRACKETS` interacted.

  • Fix return value to return a boolean.

  • Correct vim plugin not to clobber edited code if yapf returns an error.

  • Ensured comma-terminated tuples with multiple elements are split onto separate lines.

下载地址:



历史版本 :
YAPF 0.17.0 发布,Python 代码格式化工具
最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务