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
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.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be3b1320bd7d712b2eb9f3a1a27924e291a3cb54df5fce78ae69f0a48b0671b6 |
|
MD5 | f3086319f9a72fa48f3cdc1b6bcea608 |
|
BLAKE2b-256 | 00857d5b2506182c97903c3cc63427b852e941ca36a6c5283256771f6304b6fc |