Change default values from [] to None
Its well known fact that python default values initialized only once
at the stage if creation function. So if we call function with parameter
foo=[] as default value and change foo.append("bar") at the next call of
the function default value would be ["bar"]. It will save.
Change-Id: Iba9e55bc2d4dfd811ce7d068b6a9cceae7c000d6
This commit is contained in:
@@ -18,8 +18,9 @@ import six
|
||||
from ceilometerclient.common import base
|
||||
|
||||
|
||||
def _get_opt_path(simple_params=[], **kwargs):
|
||||
def _get_opt_path(simple_params=None, **kwargs):
|
||||
l = []
|
||||
simple_params = simple_params or []
|
||||
# get simple paramters
|
||||
for key in simple_params:
|
||||
val = kwargs.get(key)
|
||||
|
||||
@@ -44,7 +44,10 @@ class StatisticsManager(base.Manager):
|
||||
)
|
||||
return url_aggregates
|
||||
|
||||
def list(self, meter_name, q=None, period=None, groupby=[], aggregates=[]):
|
||||
def list(self, meter_name, q=None, period=None, groupby=None,
|
||||
aggregates=None):
|
||||
groupby = groupby or []
|
||||
aggregates = aggregates or []
|
||||
p = ['period=%s' % period] if period else []
|
||||
if isinstance(groupby, six.string_types):
|
||||
groupby = [groupby]
|
||||
|
||||
Reference in New Issue
Block a user