Flake8 plugin to enforce the new Union and Optional annotation syntax defined in PEP 604
Project description
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.
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 flake8-new-union-types-0.4.1.tar.gz.
File metadata
- Download URL: flake8-new-union-types-0.4.1.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a9dd421099f2525f8be525977ff6632b13b68719a7b0807cf49028d4287b0aa
|
|
| MD5 |
46178a22294741328aaab3847643e075
|
|
| BLAKE2b-256 |
0bf0b07ec2ded79aec3f95e676d5fbffc5c7e7ce6fe7640cd69d2ce109daca41
|
File details
Details for the file flake8_new_union_types-0.4.1-py3-none-any.whl.
File metadata
- Download URL: flake8_new_union_types-0.4.1-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92737a2f598772d5aedd05b5450c5dd200e0f1acd42b3c1f95dbbe3211af2009
|
|
| MD5 |
8998712042619085f46be000278d683b
|
|
| BLAKE2b-256 |
c32f487aeffaab826bb3d23b51c20059c5b9519bca456748652f536df274ac6f
|