A flake8 plugin to check typing import style
Project description
flake8-typing-as-t
Table of Contents
Overview
This is a flake8
plugin which ensures that imports from the typing
library must be written using import typing as t
.
Installation
pip install flake8-typing-as-t
Checks
TYT01
: Bareimport typing
usageTYT02
:import typing as X
whereX
is not literalt
TYT03
:from typing import X
usage
Handling typing-extensions
A common pattern for compatibility is to do a sys.version_info
-guarded
dispatch over typing_extensions
. e.g.
if sys.version_info < (3, 8):
from typing_extensions import Literal
else:
from typing import Literal
Currently, flake8-typing-as-t
does not have special handling for this.
Users should use a noqa
comment as follows:
if sys.version_info < (3, 8):
from typing_extensions import Literal
else:
from typing import Literal # noqa: TYT03
License
flake8-typing-as-t
is distributed under the terms of the MIT license.
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
Close
Hashes for flake8_typing_as_t-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1f0cb217542cdd8e2aa1a599644d9deac0cbe4222d07fe76843edfd79f7007c |
|
MD5 | d76bc3f23faa15b8128203cefa6fcbb5 |
|
BLAKE2b-256 | e1e88266cd598e4b155904ebf736a12c56ea609a5548f2c9ab6e970d21308e32 |