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.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01b1c5c2eae287056eead1aa9ad339b7961a09f3262f4862a9b82e1a380f1a6e |
|
MD5 | 955fc8020c289e7e310ead9b3f1fb675 |
|
BLAKE2b-256 | 922c7e1a9e449d3fe638757b4ae1bfa9ce946c75ba2cb589ed542f0399527659 |
Hashes for flake8_get_chaining-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b536bad0d18bddf30891613e7d5981b80c4b8a1891987915a4401bad38362156 |
|
MD5 | 34ac199b556cbd0e5baf1035d0e8afa1 |
|
BLAKE2b-256 | 09c9d5c43aaeeda624cae6f35327704d8dd6824c425ac6b4da82e2d93fdf1809 |