flake8 plugin to improve your type hints
Project description
flake8-kotoha
KoToHa: Kaizen Type Hint
Install
pipx
$ pipx install flake8
$ pipx inject flake8 flake8-kotoha
$ flake8 -h
...
Installed plugins: flake8-kotoha: 0.1.0, ...
venv + pip
$ python -m venv .venv --upgrade-deps
$ .venv/bin/python -m pip install flake8-kotoha
$ .venv/bin/flake8 -h
...
Installed plugins: flake8-kotoha: 0.1.0, ...
Usage
def plus_one(numbers: list[int]) -> list[int]:
return [n + 1 for n in numbers]
$ flake8 example.py
example.py:1:14: KTH101 Type hint with abstract type `collections.abc.Iterable` or `collections.abc.Sequence`, instead of concrete type `list`
Error codes
Type hints in function parameters
Use abstract types instead of concrete ones
error code | description |
---|---|
KTH101 | Use Iterable or Sequence instead of list |
KTH102 | Use Iterable or Sequence instead of tuple |
KTH103 | Use Iterable instead of set |
KTH104 | Use Iterable instead of dict |
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
flake8_kotoha-0.1.0.tar.gz
(4.5 kB
view details)
Built Distribution
File details
Details for the file flake8_kotoha-0.1.0.tar.gz
.
File metadata
- Download URL: flake8_kotoha-0.1.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff464e2456af7da8c98aad3916e5573c567277887823111efee8e0dfc21fd9b1 |
|
MD5 | 215bf5b06b4786b79e44bb7f018a2f09 |
|
BLAKE2b-256 | f466d1be2370846ac0a3cecbac41c256032936f0d8ecc6c072926f287e12588a |
File details
Details for the file flake8_kotoha-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: flake8_kotoha-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d9a1bd8f45d5e85e64df8b2a5d4ad355d047d3c62de3c728a263fc429947be1 |
|
MD5 | 53f680ab392f066a2f861ee6c000ea29 |
|
BLAKE2b-256 | e4f9d094db83867bedb19ecc785e8261266b72fe739faaff828ca4f3a9682db8 |