コード例 #1
0
def decodeXMLValue(xmlValue):
    "Converts a python value returned by xmlrpc to a SPARK value"
    if isinstance(xmlValue, UNCHANGED_TYPES):
        return xmlValue
    elif xmlValue == None:
        return sparkNULL()
    elif isinstance(xmlValue, types.DictType):
        functor = xmlValue.get(FUNCTOR)
        if functor is not None:
            args = xmlValue.get(ARGS)
            if args is None:
                raise LowError("Missing %r element for structure"%ARGS)
            return Structure(Symbol(functor), decodeXMLValues(args))
        sym = xmlValue.get(SYM)
        if sym is not None:
            return Symbol(sym)
        var = xmlValue.get(VAR)
        if var is not None:
            return Variable(var)
        # default
        return dictMap(xmlValue, decodeXMLValue)
    elif isinstance(xmlValue, types.ListType):
        return decodeXMLValues(xmlValue)
    elif isinstance(xmlValue, types.TupleType):
        return decodeXMLValues(xmlValue)
    else:
        raise LowError("Cannot convert value of type %r from XML"%xmlValue.__class__)
コード例 #2
0
ファイル: xps.py プロジェクト: jbalint/spark
def mapToSpark(**keyargs):
    "Given a set of keyword parameters representing a map, return the SPARK map object"
    return dictMap(keyargs)
コード例 #3
0
ファイル: xps.py プロジェクト: junion/butlerbot-unstable
def mapToSpark(**keyargs):
    "Given a set of keyword parameters representing a map, return the SPARK map object"
    return dictMap(keyargs)