A tool for indentation in text files
Project description
Canonicalise the leading indentation of blank lines in text files.
Synopsis
For the purposes of this tool, a “blank line” is a line containing only whitespace characters.
Intentionally Blank can apply one or more formatters to a text file for the purposes of modifying the arrangement or representation of whitespace.
To get command-line help, use the --help option:
$ intentionally-blank --help Usage: intentionally-blank [OPTIONS] COMMAND [ARGS]... Options: --verbosity [CRITICAL|ERROR|WARNING|INFO|DEBUG|NOTSET] The logging level to use. --version Show the version and exit. --help Show this message and exit. Commands: describe-format format list-formats
To list the available formatters, used the list-formats command:
$ intentionally-blank list-formats empty identity leading visible
To describe the action of particular formatter, use the describe-format command:
$ intentionally-blank describe-format --format=leading Blank lines have leading whitespace equal to that on the previous non-blank line.
To actually reformat a text file, we can use the format command. To get help on a particular command, like format, use the command and the --help option:
$ intentionally-blank format --help Usage: intentionally-blank format [OPTIONS] INPUT OUTPUT Options: --format [empty|identity|leading|visible] --help Show this message and exit.
Now, use the format command to adjust whitespace:
$ intentionally-blank format --format=leading infile.txt outfile.txt
To have blank lines be completely empty save for the terminating newline sequence, use --format=empty:
$ intentionally-blank format --format=empty infile.txt outfile.txt
Multiple --format options can be provided, and they will be applied in the order given. Here we apply the “leading” format, and then the “visible” format which makes whitespace characters visible:
$ intentionally-blank format --format=leading --format=visible infile.txt outfile.txt
Either the INPUT or OUTPUT positional arguments can be replaced with a hyphen - to cause input to be read from stdin or output to be written to stdout:
$ intentionally-blank format --format=leading --format=visible infile.txt - """Model␣for␣aircraft␣flights."""↵ ↵ ↵ class␣Flight:↵ ␣␣␣␣"""A␣flight␣with␣a␣particular␣passenger␣aircraft."""↵ ␣␣␣␣↵ ␣␣␣␣def␣__init__(self,␣number,␣aircraft):↵ ␣␣␣␣␣␣␣␣if␣not␣number[:2].isalpha():↵ ␣␣␣␣␣␣␣␣␣␣␣␣raise␣ValueError(f"No␣airline␣code␣in␣'{number}'")↵ ␣␣␣␣␣␣␣␣␣␣␣␣↵
## CI/CD
LOL.
To release, there is a short manual process:
$ bumpversion patch $ python setup.py sdist bdist_wheel $ twine upload dist/* –config-file=path/to/sixty-north.pypirc
Project details
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
Hashes for intentionally-blank-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9635fd387fec1cf549f58259244d49c82583ea5bf29536ff9772a54c64617b80 |
|
MD5 | 090474129bd8716e4cd60a857533251d |
|
BLAKE2b-256 | f0b76cb9c18a005e0d67ae80b9724d508b14942787b67be095f6717e7b5d5523 |
Hashes for intentionally_blank-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f26f98f9640bf4747d98063c6abad54d373e2fe76ce5f3ae8d603752fb81e998 |
|
MD5 | 17078356610c67394e091be4b9c81278 |
|
BLAKE2b-256 | c63fc4b4c2e9db514ead1fd5cc4d5e6f9598e6f51a157c025ce74bf679278d45 |