Skip to content

Commit f4ca06c

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Fix Mutable default argument"
2 parents 097d35e + dc5a8fa commit f4ca06c

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

openstackclient/common/utils.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def get_field(item, field):
163163
raise exceptions.CommandError(msg)
164164

165165

166-
def get_item_properties(item, fields, mixed_case_fields=[], formatters={}):
166+
def get_item_properties(item, fields, mixed_case_fields=None, formatters=None):
167167
"""Return a tuple containing the item properties.
168168
169169
:param item: a single item resource (e.g. Server, Project, etc)
@@ -172,6 +172,11 @@ def get_item_properties(item, fields, mixed_case_fields=[], formatters={}):
172172
:param formatters: dictionary mapping field names to callables
173173
to format the values
174174
"""
175+
if mixed_case_fields is None:
176+
mixed_case_fields = []
177+
if formatters is None:
178+
formatters = {}
179+
175180
row = []
176181

177182
for field in fields:
@@ -187,7 +192,7 @@ def get_item_properties(item, fields, mixed_case_fields=[], formatters={}):
187192
return tuple(row)
188193

189194

190-
def get_dict_properties(item, fields, mixed_case_fields=[], formatters={}):
195+
def get_dict_properties(item, fields, mixed_case_fields=None, formatters=None):
191196
"""Return a tuple containing the item properties.
192197
193198
:param item: a single dict resource
@@ -196,6 +201,11 @@ def get_dict_properties(item, fields, mixed_case_fields=[], formatters={}):
196201
:param formatters: dictionary mapping field names to callables
197202
to format the values
198203
"""
204+
if mixed_case_fields is None:
205+
mixed_case_fields = []
206+
if formatters is None:
207+
formatters = {}
208+
199209
row = []
200210

201211
for field in fields:

0 commit comments

Comments
 (0)