A library for building code formatters
Project description
Format Blocks
Format Blocks is a Python library for building code formatters.
Usage
Format Blocks provides a number of 'block' objects which know how to arrange text in various ways,
such as LineBlock which arranges elements on one line, and StackBlock which stacks them across
lines, and WrapBlock which wraps inserts line breaks at the margin.
However, the most import block is ChoiceBlock. ChoiceBlock accepts multiple formatting options,
and allows for the solver to pick the choices which minimize the overall formatting cost.
See the tests for some examples!
Origins
Format Blocks is a fork of the guts of Google's R Formatter, rfmt. Rfmt was structured as a formatting library with an R implementation, almost entirely decoupled. To create Format Blocks, I just did some final decoupling, then polished up the code and wrote some extra features and tests.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file format-blocks-0.1.2.tar.gz.
File metadata
- Download URL: format-blocks-0.1.2.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.10 CPython/3.8.0 Darwin/19.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
acd810bed065989b7e07a071fb13e8eafcebb91fb674a03bb428cd55d882ca59
|
|
| MD5 |
a341c61a20c4d95feff5674071c8c7bc
|
|
| BLAKE2b-256 |
02ad81396b2384846c3e69ffc63527538d249c00442e2c9d7d7f39dc5ae46a93
|
File details
Details for the file format_blocks-0.1.2-py3-none-any.whl.
File metadata
- Download URL: format_blocks-0.1.2-py3-none-any.whl
- Upload date:
- Size: 20.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.10 CPython/3.8.0 Darwin/19.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2c226e160b2189c4789340737d9adb494a9869e4b18b7e21b20a6353e56da85
|
|
| MD5 |
bff379f16c70dcee7abda4967fb11f9a
|
|
| BLAKE2b-256 |
78d5ddeae1cc145a30b3e8aa6a15f69bb306cbc34910d375087258386456a6cf
|