Skip to main content

A flake8 plugin to check typing import style

Project description

flake8-typing-as-t

PyPI - Version PyPI - Python Version


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: Bare import typing usage
  • TYT02: import typing as X where X is not literal t
  • 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flake8_typing_as_t-0.0.1.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

flake8_typing_as_t-0.0.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file flake8_typing_as_t-0.0.1.tar.gz.

File metadata

  • Download URL: flake8_typing_as_t-0.0.1.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.23.0

File hashes

Hashes for flake8_typing_as_t-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b3f9faba8ea6c0ba1ee1a096de43e7ebb683910e69f4a86fea55b7d24731470b
MD5 d23cd1d678d155955c337ac48fa98ec2
BLAKE2b-256 0fd6740d82f09f5a56aaedc02126ab0f94ad54aba8a695a39a754d9c35eece15

See more details on using hashes here.

Provenance

File details

Details for the file flake8_typing_as_t-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for flake8_typing_as_t-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f1f0cb217542cdd8e2aa1a599644d9deac0cbe4222d07fe76843edfd79f7007c
MD5 d76bc3f23faa15b8128203cefa6fcbb5
BLAKE2b-256 e1e88266cd598e4b155904ebf736a12c56ea609a5548f2c9ab6e970d21308e32

See more details on using hashes here.

Provenance

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