diff --git a/doc/source/ext/resources.py b/doc/source/ext/resources.py index 86e9493110..ded7326be3 100644 --- a/doc/source/ext/resources.py +++ b/doc/source/ext/resources.py @@ -346,7 +346,7 @@ class ContribResourcePages(ResourcePages): return 'heat.engine.plugins' -def _filter_resources(prefix=None, path=None, statuses=[]): +def _filter_resources(prefix=None, path=None, statuses=None): def not_hidden_match(cls): return cls.support_status.status != support.HIDDEN @@ -360,6 +360,7 @@ def _filter_resources(prefix=None, path=None, statuses=[]): def status_match(cls): return cls.support_status.status in statuses + statuses = statuses or [] filtered_resources = {} for name in sorted(six.iterkeys(all_resources)): if prefix_match(name): diff --git a/heat/db/sqlalchemy/utils.py b/heat/db/sqlalchemy/utils.py index a6a12f5cfd..dae156dcb6 100644 --- a/heat/db/sqlalchemy/utils.py +++ b/heat/db/sqlalchemy/utils.py @@ -16,8 +16,8 @@ import sqlalchemy -def clone_table(name, parent, meta, newcols=[], ignorecols=[], swapcols={}, - ignorecons=[]): +def clone_table(name, parent, meta, newcols=None, ignorecols=None, + swapcols=None, ignorecons=None): """Helper function that clones parent table schema onto new table. :param name: new table name @@ -30,6 +30,11 @@ def clone_table(name, parent, meta, newcols=[], ignorecols=[], swapcols={}, :return: sqlalchemy.Table instance """ + newcols = newcols or [] + ignorecols = ignorecols or [] + swapcols = swapcols or {} + ignorecons = ignorecons or [] + cols = [c.copy() for c in parent.columns if c.name not in ignorecols if c.name not in swapcols] diff --git a/heat/engine/resource.py b/heat/engine/resource.py index c5e7d851e0..bd23147dc3 100644 --- a/heat/engine/resource.py +++ b/heat/engine/resource.py @@ -643,7 +643,7 @@ class Resource(object): else: self.state_set(action, self.COMPLETE) - def action_handler_task(self, action, args=[], action_prefix=None): + def action_handler_task(self, action, args=None, action_prefix=None): """A task to call the Resource subclass's handler methods for action. Calls the handle_() method for the given action and then calls @@ -655,6 +655,7 @@ class Resource(object): If a prefix is supplied, the handler method handle__() is called instead. """ + args = args or [] handler_action = action.lower() check = getattr(self, 'check_%s_complete' % handler_action, None) diff --git a/heat/tests/test_resource.py b/heat/tests/test_resource.py index 6c2572c84b..c1f85d188b 100644 --- a/heat/tests/test_resource.py +++ b/heat/tests/test_resource.py @@ -2900,7 +2900,8 @@ class ResourceHookTest(common.HeatTestCase): class ResourceAvailabilityTest(common.HeatTestCase): - def _mock_client_plugin(self, service_types=[], is_available=True): + def _mock_client_plugin(self, service_types=None, is_available=True): + service_types = service_types or [] mock_client_plugin = mock.Mock() mock_service_types = mock.PropertyMock(return_value=service_types) type(mock_client_plugin).service_types = mock_service_types diff --git a/heat/tests/test_template.py b/heat/tests/test_template.py index b6c1490002..4a815fae99 100644 --- a/heat/tests/test_template.py +++ b/heat/tests/test_template.py @@ -89,7 +89,8 @@ class DummyClass(object): class TemplatePluginFixture(fixtures.Fixture): - def __init__(self, templates={}): + def __init__(self, templates=None): + templates = templates or {} super(TemplatePluginFixture, self).__init__() self.templates = [extension.Extension(k, None, v, None) for (k, v) in templates.items()]