flake8-future-annotations
Verifies python 3.7+ files use from __future__ import annotations if a type is used in the module that can be rewritten using PEP 563.
Pairs well with pyupgrade with the --py37-plus flag or higher, since pyupgrade only replaces type annotations with the PEP 563 rules if from __future__ import annotations is present.
For example:
import typing as t
from typing import List
def function(a_dict: t.Dict[str, t.Optional[int]]) -> None:
a_list: List[str] = []
a_list.append("hello")
As a result, this plugin will emit:
hello.py:1:1: F Missing from __future__ import annotations but imports: List, t.Dict, t.Optional
After adding the future annotations import, running pyupgrade allows the code to be automatically rewritten as:
from __future__ import annotations
def function(a_dict: dict[str, int | None]) -> None:
a_list: list[str] = []
a_list.append("hello")
Release files for flake8-future-annotations 0.0.4
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-future-annotations-0.0.4.tar.gz | 4.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flake8_future_annotations-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.7 kB
Release files / flake8-future-annotations-0.0.4.tar.gz
| Download URL | flake8-future-annotations-0.0.4.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
609f7b72dafba55988acbc822a1aae6dde8ec2036d86751a627175dac3e58b46
|
|
BLAKE2b-256 checksum How to use checksums |
01dea6e961ac829942f18294ad44b2dab457b5a05c4917d7d6ce69b6dc0a3556
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/3.7.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2
|
Release files / flake8_future_annotations-0.0.4-py3-none-any.whl
| Download URL | flake8_future_annotations-0.0.4-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
43add640b11a47eb8cfd5380727d894c5f821b4b3de7e14200b27810b61ac329
|
|
BLAKE2b-256 checksum How to use checksums |
8748026e401135f511b61b9601e4111f7472a4f187974a92ab5830ae74e218cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/3.7.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2
|