Skip to main content

A plugin for flake8 finding likely bugs when chaining dict.get calls

Project description

flake8-get-chaining

A flake8 plugin finding likely bugs when chaining dict.get calls

CI Code style PyPI - Python Version PyPI - Version

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


Download files

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

Source Distribution

flake8_get_chaining-0.2.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flake8_get_chaining-0.2.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file flake8_get_chaining-0.2.0.tar.gz.

File metadata

  • Download URL: flake8_get_chaining-0.2.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for flake8_get_chaining-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5dd896f0c77997fed4f14b1a25360c965e712a7bbe9ebaaccad1dbd5932eeaab
MD5 f1969c8e20a8086d42934e1763881a78
BLAKE2b-256 fb6501aeb7949e6f312e421383630e0cc3065292d88e06fd43675a50f5b50c0b

See more details on using hashes here.

File details

Details for the file flake8_get_chaining-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for flake8_get_chaining-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d9a04d67a6437474cece7d126bee80175c259e6026e010a0821d424616ab59c
MD5 0eaab79ee088aa26e45123ad823cdaa0
BLAKE2b-256 eb5f83884170e88b50aa9a389ab30bea565961c03ea4b591697431aec2437819

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page