Handle mutable default arguments cleanly

When generating code, ensure that default list/dict arguments are
initialised in local scope if unspecified or `None`.
This commit is contained in:
Arun Babu Neelicattu
2020-07-07 18:13:43 +02:00
committed by Bouke Versteegh
parent 42e197f985
commit 0ba0692dec
6 changed files with 63 additions and 2 deletions

20
poetry.lock generated
View File

@@ -475,6 +475,20 @@ pytest = ">=4.6"
[package.extras]
testing = ["fields", "hunter", "process-tests (2.0.2)", "six", "pytest-xdist", "virtualenv"]
[[package]]
category = "dev"
description = "Thin-wrapper around the mock package for easier use with pytest"
name = "pytest-mock"
optional = false
python-versions = ">=3.5"
version = "3.1.1"
[package.dependencies]
pytest = ">=2.7"
[package.extras]
dev = ["pre-commit", "tox", "pytest-asyncio"]
[[package]]
category = "main"
description = "Alternative regular expression module, to replace re."
@@ -623,7 +637,7 @@ testing = ["jaraco.itertools", "func-timeout"]
compiler = ["black", "jinja2", "protobuf"]
[metadata]
content-hash = "375411698ec644810d09af809ac8a004abc9821f0b718178505424625f407c14"
content-hash = "7a2aa57a3a2b58e70aa05be75bff08272c2f070ecc1872a1c825f228299b82c2"
python-versions = "^3.6"
[metadata.files]
@@ -972,6 +986,10 @@ pytest-cov = [
{file = "pytest-cov-2.10.0.tar.gz", hash = "sha256:1a629dc9f48e53512fcbfda6b07de490c374b0c83c55ff7a1720b3fccff0ac87"},
{file = "pytest_cov-2.10.0-py2.py3-none-any.whl", hash = "sha256:6e6d18092dce6fad667cd7020deed816f858ad3b49d5b5e2b1cc1c97a4dba65c"},
]
pytest-mock = [
{file = "pytest-mock-3.1.1.tar.gz", hash = "sha256:636e792f7dd9e2c80657e174c04bf7aa92672350090736d82e97e92ce8f68737"},
{file = "pytest_mock-3.1.1-py3-none-any.whl", hash = "sha256:a9fedba70e37acf016238bb2293f2652ce19985ceb245bbd3d7f3e4032667402"},
]
regex = [
{file = "regex-2020.6.8-cp27-cp27m-win32.whl", hash = "sha256:fbff901c54c22425a5b809b914a3bfaf4b9570eee0e5ce8186ac71eb2025191c"},
{file = "regex-2020.6.8-cp27-cp27m-win_amd64.whl", hash = "sha256:112e34adf95e45158c597feea65d06a8124898bdeac975c9087fe71b572bd938"},