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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06d860a3cc0a93e522cd66fdfd734a8a0a561112e0281559ac90791239d986a1 |
|
MD5 | e5ce91c0d7bc4d3d0fd16cdbbf4a6bf0 |
|
BLAKE2b-256 | 033a349e1c5c27a303dc411f5b94fde1e474aba351b9fac410d8e9cf2c23f13a |
Hashes for flake8_postponed_annotations-1.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45607353aa7c4b146049ac6301ef19cd5a3b4799e2b38c178478da6c2327d164 |
|
MD5 | 62fafb2318bbab316b57a9fb4e97e866 |
|
BLAKE2b-256 | 5c5c3931b472b218c03293b98113bcbd746d9720a98944033319b9201b2181ce |