YAPF 0.17.0 发布,Python 代码格式化工具

栏目: 软件资讯 · 发布时间: 8年前

内容简介:YAPF 0.17.0 已发布,YAPF 是 Google 开源的一个用来格式化 Python 代码的工具。 目前用于 Python 的格式化程序(如 autopep8 和 pep8ify)都用于删除代码中的 lint 错误。这有很明显的局限性。YAPF 采用了不同的...

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.

下载地址:


【声明】文章转载自:开源中国社区 [http://www.oschina.net]


以上所述就是小编给大家介绍的《YAPF 0.17.0 发布,Python 代码格式化工具》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Understanding Machine Learning

Understanding Machine Learning

Shai Shalev-Shwartz、Shai Ben-David / Cambridge University Press / 2014 / USD 48.51

Machine learning is one of the fastest growing areas of computer science, with far-reaching applications. The aim of this textbook is to introduce machine learning, and the algorithmic paradigms it of......一起来看看 《Understanding Machine Learning》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

MD5 加密
MD5 加密

MD5 加密工具