<div align="center" size="15px">
# flake8-get-chaining
A [flake8](https://github.com/PyCQA/flake8) plugin finding likely bugs when chaining dict.get calls
[![CI](https://github.com/Sacrimento/flake8-get-chaining/actions/workflows/ci.yml/badge.svg)](https://github.com/Sacrimento/flake8-get-chaining/actions/workflows/ci.yml)
[![Code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/flake8-get-chaining)](https://pypi.org/project/flake8-get-chaining/)
[![PyPI - Version](https://img.shields.io/pypi/v/flake8-get-chaining)](https://pypi.org/project/flake8-get-chaining/)
</div>
`flake8-get-chaining` plugin checks for chained `dict.get` calls and makes sure valid defaults are provided.
## Installation
------------
Install from `pip` with:
```sh
$ pip install flake8-get-chaining
```
It will then automatically be run as part of `flake8`; you can check it has been picked up with:
```sh
$ 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")`
Raw data
{
"_id": null,
"home_page": "",
"name": "flake8-get-chaining",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "flake8,get-chaining,bugs,pyflakes,pylint,linter,qa",
"author": "",
"author_email": "Augustin Bouverot <augustin.bouverot@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/fb/65/01aeb7949e6f312e421383630e0cc3065292d88e06fd43675a50f5b50c0b/flake8_get_chaining-0.2.0.tar.gz",
"platform": null,
"description": "<div align=\"center\" size=\"15px\">\n\n# flake8-get-chaining\n\nA [flake8](https://github.com/PyCQA/flake8) plugin finding likely bugs when chaining dict.get calls\n\n[![CI](https://github.com/Sacrimento/flake8-get-chaining/actions/workflows/ci.yml/badge.svg)](https://github.com/Sacrimento/flake8-get-chaining/actions/workflows/ci.yml)\n[![Code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/flake8-get-chaining)](https://pypi.org/project/flake8-get-chaining/)\n[![PyPI - Version](https://img.shields.io/pypi/v/flake8-get-chaining)](https://pypi.org/project/flake8-get-chaining/)\n\n</div>\n\n`flake8-get-chaining` plugin checks for chained `dict.get` calls and makes sure valid defaults are provided.\n\n## Installation\n------------\n\nInstall from `pip` with:\n\n```sh\n$ pip install flake8-get-chaining\n```\n\nIt will then automatically be run as part of `flake8`; you can check it has been picked up with:\n\n```sh\n$ flake8 --version\n5.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\n```\n\n## List of warnings\n------------\n\n**DGC1001**: Missing default argument when chaining dict.get \nThis warning is emitted when `dict.get` calls are chained, and no default was provided. \n \n_Example_: `my_dict.get(\"foo\").get(\"bar\")` \n \n \n**DGC1002**: Invalid default argument when chaining dict.get \nThis warning is emitted when `dict.get` calls are chained, and the default value is \ninvalid (i.e not a dict nor an identifier) \n \n_Example_: `my_dict.get(\"foo\", \"bar\").get(\"baz\")` \n \n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A plugin for flake8 finding likely bugs when chaining dict.get calls",
"version": "0.2.0",
"split_keywords": [
"flake8",
"get-chaining",
"bugs",
"pyflakes",
"pylint",
"linter",
"qa"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "eb5f83884170e88b50aa9a389ab30bea565961c03ea4b591697431aec2437819",
"md5": "0eaab79ee088aa26e45123ad823cdaa0",
"sha256": "9d9a04d67a6437474cece7d126bee80175c259e6026e010a0821d424616ab59c"
},
"downloads": -1,
"filename": "flake8_get_chaining-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0eaab79ee088aa26e45123ad823cdaa0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 4302,
"upload_time": "2023-01-31T23:05:15",
"upload_time_iso_8601": "2023-01-31T23:05:15.975836Z",
"url": "https://files.pythonhosted.org/packages/eb/5f/83884170e88b50aa9a389ab30bea565961c03ea4b591697431aec2437819/flake8_get_chaining-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "fb6501aeb7949e6f312e421383630e0cc3065292d88e06fd43675a50f5b50c0b",
"md5": "f1969c8e20a8086d42934e1763881a78",
"sha256": "5dd896f0c77997fed4f14b1a25360c965e712a7bbe9ebaaccad1dbd5932eeaab"
},
"downloads": -1,
"filename": "flake8_get_chaining-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "f1969c8e20a8086d42934e1763881a78",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 4449,
"upload_time": "2023-01-31T23:05:17",
"upload_time_iso_8601": "2023-01-31T23:05:17.022152Z",
"url": "https://files.pythonhosted.org/packages/fb/65/01aeb7949e6f312e421383630e0cc3065292d88e06fd43675a50f5b50c0b/flake8_get_chaining-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-31 23:05:17",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "flake8-get-chaining"
}