Skip to main content

flake8 plugin to enforce use of `|` over `typing.Union`

Project description

flake8-pep604

flake8 plugin which forbids use of typing.Union (in favour of |), per PEP 604.

Note the | notation is a syntax error for Python < 3.10. In this case you can use the annotations feature (see PEP 563).

flake8 Codes

Code Description
UNT001 Use | in place of typing.Union. See PEP-604

Motivation

Motivated by just wanting to make a codebase consistent in usage between typing.Union and union types.

Note you could also automate this via pyupgrade

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

flake8_pep604-1.1.0.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

flake8_pep604-1.1.0-py3-none-any.whl (3.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page