How to use the yaql.language.specs.name function in yaql

To help you get started, we’ve selected a few yaql examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openstack / murano / murano / dsl / yaql_functions.py View on Github external
@specs.name('type')
@specs.parameter('object_', dsl.MuranoObjectParameter(nullable=True))
def type_legacy(object_):
    return None if object_ is None else object_.type.name
github openstack / murano / murano / dsl / reflection.py View on Github external
@specs.name('name')
def argument_name(method_argument):
    return method_argument.name
github openstack / yaql / yaql / standard_library / date_time.py View on Github external
@specs.name('datetime')
@specs.parameter('string', yaqltypes.String())
@specs.parameter('format__', yaqltypes.String(True))
def datetime_from_string(string, format__=None):
    if not format__:
        result = parser.parse(string)
    else:
        result = DATETIME_TYPE.strptime(string, format__)
    if not result.tzinfo:
        return result.replace(tzinfo=UTCTZ)
    return result
github openstack / murano / murano / dsl / yaql_functions.py View on Github external
@specs.name('#unary_operator_:')
def ns_resolve_unary(context, name):
    return ns_resolve(context, '', name)
github openstack / yaql / yaql / standard_library / collections.py View on Github external
@specs.name('keys')
@specs.method
def dict_keys(d):
    """:yaql:keys

    Returns an iterator over the dictionary keys.

    :signature: dict.keys()
    :receiverArg dict: input dictionary
    :argType dict: dictionary
    :returnType: iterator

    .. code::

        yaql> {"a" => 1, "b" => 2}.keys()
        ["a", "b"]
    """
github openstack / yaql / yaql / standard_library / queries.py View on Github external
@specs.name('#operator_.')
def collection_attribution(collection, attribute, operator):
    """:yaql:operator .

    Retrieves the value of an attribute for each element in a collection and
    returns a list of results.

    :signature: collection.attribute
    :arg collection: input collection
    :argType collection: iterable
    :arg attribute: attribute to get on every collection item
    :argType attribute: keyword
    :returnType: list

    .. code::

        yaql> [{"a" => 1}, {"a" => 2, "b" => 3}].a
github openstack / yaql / yaql / standard_library / regex.py View on Github external
@specs.name('replace')
def replace_string(string, regexp, repl, count=0):
    return replace(regexp, string, repl, count)
github openstack / murano / murano / dsl / contracts / contracts.py View on Github external
        @specs.name('#finalize')
        def finalize(obj):
            if isinstance(obj, dict):
                obj.pop('_notNull', None)
            return obj
github openstack / murano / murano / dsl / lhs_expression.py View on Github external
    @specs.name('#operator_:')
    def ns_resolve(context, prefix, name):
        return _wrap_type_reference(
            yaql_functions.ns_resolve(context, prefix, name), context)