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 hashes)
Built Distribution
Close
Hashes for flake8_kotoha-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d9a1bd8f45d5e85e64df8b2a5d4ad355d047d3c62de3c728a263fc429947be1 |
|
MD5 | 53f680ab392f066a2f861ee6c000ea29 |
|
BLAKE2b-256 | e4f9d094db83867bedb19ecc785e8261266b72fe739faaff828ca4f3a9682db8 |