Flake8 postponed annotations validation
Project description
flake8-postponed-annotations
flake8 plugin to validate Postponed Evaluations of Annotations per PEP 563.
This plugin is used to enforce consistent usage of postponed evaluation of type annotations, returning an error code when string literals are used for a type.
Activation
By default the plugin activates when it sees an import that enables PEP563, e.g.:
from __future__ import annotations
The postponed-annotations-activation
option may be set to 'always' or 'never',
to force a specific behavior.
Installation
Standard python package installation:
pip install flake8-postponed-annotations
Options
postponed-annotations-activation
: Controls activation of the plugin,
choices: auto
, always
, never
(default: auto
)
postponed-annotations-include-name
: Include plugin name in messages
postponed-annotations-no-include-name
: Do not include plugin name in messages (default setting)
All options may be specified on the command line with a --
prefix,
or can be placed in your flake8 config file.
Error Codes
Code | Message |
---|---|
PEA001 | Remove quotes from variable type annotation 'type' |
PEA002 | Remove quotes from argument type annotation 'type' |
PEA003 | Remove quotes from return type annotation 'type' |
Examples
x: 'Foo' <-- PEA001
def foo(x: 'Foo') -> None: <-- PEA002
def foo(x: Foo) -> 'Bar': <-- PEA003
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 flake8-postponed-annotations-1.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6aadb21787c9dd083249f41c485b59690834ea1d81d35f941db1640e57be2583 |
|
MD5 | a95e147bce27155a56774209fc47bf47 |
|
BLAKE2b-256 | fd6a9f9bae7f960edfbeeae6ec6a094751e388c10f7c9134b1e143f8786db464 |
Hashes for flake8_postponed_annotations-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c8c3d81290d0cf7a672ac3a1f2c5c3ffeaf52ff1915d2bd96cacd4e95e3d988 |
|
MD5 | 7de608beda2870743532a72e2f5c5187 |
|
BLAKE2b-256 | 0ac785518c963174b375e9375828750f269131d20ff22f60c3836a25741c92be |