Don't use dicts as default values for args
This commit is contained in:
parent
9b5de13c2e
commit
502bb4a37f
@ -39,7 +39,8 @@ class Resource(object):
|
|||||||
|
|
||||||
# Create
|
# Create
|
||||||
@dispatch(str, str)
|
@dispatch(str, str)
|
||||||
def __init__(self, name, base_path, args={}, tags=None, virtual_resource=None):
|
def __init__(self, name, base_path, args=None, tags=None, virtual_resource=None):
|
||||||
|
args = args or {}
|
||||||
self.name = name
|
self.name = name
|
||||||
if base_path:
|
if base_path:
|
||||||
metadata = read_meta(base_path)
|
metadata = read_meta(base_path)
|
||||||
@ -86,7 +87,8 @@ class Resource(object):
|
|||||||
k: v for k, v in ret.items() if os.path.isfile(v)
|
k: v for k, v in ret.items() if os.path.isfile(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
def create_inputs(self, args={}):
|
def create_inputs(self, args=None):
|
||||||
|
args = args or {}
|
||||||
for name, v in self.db_obj.meta_inputs.items():
|
for name, v in self.db_obj.meta_inputs.items():
|
||||||
value = args.get(name, v.get('value'))
|
value = args.get(name, v.get('value'))
|
||||||
|
|
||||||
|
@ -24,7 +24,8 @@ from solar.core import resource
|
|||||||
from solar.core import signals
|
from solar.core import signals
|
||||||
|
|
||||||
|
|
||||||
def create(name, base_path, args={}, virtual_resource=None):
|
def create(name, base_path, args=None, virtual_resource=None):
|
||||||
|
args = args or {}
|
||||||
if isinstance(base_path, provider.BaseProvider):
|
if isinstance(base_path, provider.BaseProvider):
|
||||||
base_path = base_path.directory
|
base_path = base_path.directory
|
||||||
|
|
||||||
@ -47,7 +48,8 @@ def create(name, base_path, args={}, virtual_resource=None):
|
|||||||
return rs
|
return rs
|
||||||
|
|
||||||
|
|
||||||
def create_resource(name, base_path, args={}, virtual_resource=None):
|
def create_resource(name, base_path, args=None, virtual_resource=None):
|
||||||
|
args = args or {}
|
||||||
if isinstance(base_path, provider.BaseProvider):
|
if isinstance(base_path, provider.BaseProvider):
|
||||||
base_path = base_path.directory
|
base_path = base_path.directory
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user