From 11de0f38733b2d276b4c9aa3019fe39deb98f326 Mon Sep 17 00:00:00 2001 From: xianming mao Date: Sun, 25 Sep 2016 12:01:05 +0800 Subject: [PATCH] Avoid use xx=[] for parameter to initialize it's value This patch is deprecated use xx = [] for the parameter initial value, this parameter will only be initialized at the first call,this is not what we expected. Better choice is to set the initial value to None, then initialize xx with xx= xx or [] in method body. More details:http://effbot.org/zone/default-values.htm Change-Id: Ie538081bb8905ed9b6d5ec5fa75c344a8074fb0e --- mistralclient/openstack/common/apiclient/fake_client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mistralclient/openstack/common/apiclient/fake_client.py b/mistralclient/openstack/common/apiclient/fake_client.py index 5f08790f..e24c63dc 100644 --- a/mistralclient/openstack/common/apiclient/fake_client.py +++ b/mistralclient/openstack/common/apiclient/fake_client.py @@ -33,7 +33,9 @@ from six.moves.urllib import parse from mistralclient.openstack.common.apiclient import client -def assert_has_keys(dct, required=[], optional=[]): +def assert_has_keys(dct, required=None, optional=None): + required = required or [] + optional = optional or [] for k in required: try: assert k in dct