A plugin for flake8 finding likely bugs when chaining dict.get calls
Project description
flake8-get-chaining
plugin checks for chained dict.get
calls and makes sure valid defaults are provided.
Installation
Install from pip
with:
$ pip install flake8-get-chaining
It will then automatically be run as part of flake8
; you can check it has been picked up with:
$ flake8 --version
5.0.4 (flake8-get-chaining: 0.1.0, mccabe: 0.7.0, pycodestyle: 2.9.1, pyflakes: 2.5.0) CPython 3.10.9 on Linux
List of warnings
DGC1001: Missing default argument when chaining dict.get
This warning is emitted when dict.get
calls are chained, and no default was provided.
Example: my_dict.get("foo").get("bar")
DGC1002: Invalid default argument when chaining dict.get
This warning is emitted when dict.get
calls are chained, and the default value is
invalid (i.e not a dict nor an identifier)
Example: my_dict.get("foo", "bar").get("baz")
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
Hashes for flake8_get_chaining-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5dd896f0c77997fed4f14b1a25360c965e712a7bbe9ebaaccad1dbd5932eeaab |
|
MD5 | f1969c8e20a8086d42934e1763881a78 |
|
BLAKE2b-256 | fb6501aeb7949e6f312e421383630e0cc3065292d88e06fd43675a50f5b50c0b |
Hashes for flake8_get_chaining-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d9a04d67a6437474cece7d126bee80175c259e6026e010a0821d424616ab59c |
|
MD5 | 0eaab79ee088aa26e45123ad823cdaa0 |
|
BLAKE2b-256 | eb5f83884170e88b50aa9a389ab30bea565961c03ea4b591697431aec2437819 |