Esempio n. 1
0
def new(__context, __type_name, __owner=None, __object_name=None, __extra=None, **parameters):
    object_store = helpers.get_object_store(__context)
    executor = helpers.get_executor(__context)
    new_context = __context.create_child_context()
    for key, value in six.iteritems(parameters):
        if utils.is_keyword(key):
            new_context[key] = value
    return __type_name.murano_class.new(__owner, object_store, executor, name=__object_name)(new_context, **parameters)
Esempio n. 2
0
def new(__context, __type_name, __owner=None, __object_name=None, __extra=None,
        **parameters):
    object_store = helpers.get_object_store(__context)
    executor = helpers.get_executor(__context)
    new_context = __context.create_child_context()
    for key, value in six.iteritems(parameters):
        if utils.is_keyword(key):
            new_context[key] = value
    return __type_name.type.new(
        __owner, object_store, executor, name=__object_name)(
        new_context, **parameters)
Esempio n. 3
0
def filter_parameters(__fd, *args, **kwargs):
    if '*' not in __fd.parameters:
        position_args = 0
        for p in __fd.parameters.values():
            if p.position is not None:
                position_args += 1
        args = args[:position_args]
    kwargs = kwargs.copy()
    for name in list(kwargs.keys()):
        if not utils.is_keyword(name):
            del kwargs[name]
    if '**' not in __fd.parameters:
        names = {p.alias or p.name for p in __fd.parameters.values()}
        for name in list(kwargs.keys()):
            if name not in names:
                del kwargs[name]
    return args, kwargs
Esempio n. 4
0
def filter_parameters(__fd, *args, **kwargs):
    if '*' not in __fd.parameters:
        position_args = 0
        for p in six.itervalues(__fd.parameters):
            if p.position is not None:
                position_args += 1
        args = args[:position_args]
    kwargs = kwargs.copy()
    for name in kwargs.keys():
        if not utils.is_keyword(name):
            del kwargs[name]
    if '**' not in __fd.parameters:
        names = {p.alias or p.name for p in six.itervalues(__fd.parameters)}
        for name in kwargs.keys():
            if name not in names:
                del kwargs[name]
    return args, kwargs