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
flake8-typing-as-t
allows for this usage by checking if the import is inside
of a test on sys.version_info
against a tuple.
License
flake8-typing-as-t
is distributed under the terms of the MIT license.
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
Built Distribution
Close
Hashes for flake8_typing_as_t-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a32e503e98162e4783a9a95fbc04f7f6bb15d90597cfe799ec3cf0f720731d3a |
|
MD5 | 40a3728751855ab9ffc6b80b5e53f614 |
|
BLAKE2b-256 | 11d410190c3a8b556debfe5a2739ec437643b56c2493fdfdd2f69b0e645d1a54 |