flake8-new-union-types
Flake8 plugin to enforce the new Union and Optional annotation syntax defined in PEP 604.
Union[X, Y] = X | Y
Optional[X] = X | None
Note that it's impossible to use forward references in the new syntax, like this:
"X" | int
such a case can be expressed as a string containing both union terms:
"X | int"
Installation
pip install flake8-new-union-types
or if you use poetry:
poetry add --dev flake8-new-union-types
Usage
Error list
- NU001 Use
Foo | Barsyntax instead of Union (PEP 604) - NU002 Use
Foo | Nonesyntax instead of Optional (PEP 604) - NU003 Present the whole expression as a string to annotate forward refs, e.g.
"int | Foo"(PEP 604)
Configuration
There is no way to configure the plugin at the moment.
Metadata
Release files for flake8-new-union-types 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flake8-new-union-types-0.4.0.tar.gz | 4.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flake8_new_union_types-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.0 kB
Release files / flake8-new-union-types-0.4.0.tar.gz
| Download URL | flake8-new-union-types-0.4.0.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0d969f547f7d8d48bf5fc6e8339c4843f9f1e7950d98a92f28e45cf2faeebf84
|
|
BLAKE2b-256 checksum How to use checksums |
109ec9d4c64404b1a44c3c8fde9a8c6bd0808d1761de1a7671eae4f257dcffb1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.10.3
|
Release files / flake8_new_union_types-0.4.0-py3-none-any.whl
| Download URL | flake8_new_union_types-0.4.0-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e751c212185ce4d0f32d79b041822157fe554a368329f6a058c8affe39d5b4ec
|
|
BLAKE2b-256 checksum How to use checksums |
b275a0f64eb2ac4da3f5c3df05a186c59ea87a82d0db617d9d4784c9b4d492d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.10.3
|