项目作者: PeterJCLaw

项目描述 :
Semi-automated python formatting
高级语言: Python
项目地址: git://github.com/PeterJCLaw/tuck.git
创建时间: 2019-12-11T19:33:07Z
项目社区:https://github.com/PeterJCLaw/tuck

开源协议:Apache License 2.0

下载


Tuck

CircleCI

Semi-automated Python formatting.

The aim of this tool is to build up developer-assistance tooling for python
formatting. In general it will only format things when it needs to or when
directly instructed to.

Usage

Most usage of Tuck is expected to be within editor extensions:

Tuck can be also used as a command line tool:

  1. python -m tuck --positions <line>:<col> -- file.py

Style

The wrapped statement style which Tuck targets aims to reduce diff noise without
concern for vertical space.

Example: Function definition

  1. def foo(bar: str, quox: int = 0) -> float:
  2. return 4.2

wraps to:

  1. def foo(
  2. bar: str,
  3. quox: int = 0,
  4. ) -> float:
  5. return 4.2

Example: List comprehension

  1. [x for x in 'aBcD' if x.isupper()]

wraps to:

  1. [
  2. x
  3. for x in 'aBcD'
  4. if x.isupper()
  5. ]

Development

Setup with:

  1. pip install -r script/requirements-dev.txt -e .

Run validations with:

  1. ./script/check