xtuml/load.py
def deserialize_value(ty, value):
    '''
    Deserialize a value of some type
    '''
    uty = ty.upper()
    
    if uty == 'BOOLEAN':
        if value.isdigit():
            return bool(int(value))
        elif value.upper() == 'FALSE':
            return False
        elif value.upper() == 'TRUE':
            return True
        else:
            return None
    
    elif uty == 'INTEGER': 
        if '"' in value:
            return uuid.UUID(value[1:-1]).int
        else:
            return int(value)
    
    elif uty == 'REAL': 
        return float(value)
    
    elif uty == 'STRING': 
        return value[1:-1].replace("''", "'")
    
    elif uty == 'UNIQUE_ID': 
        if '"' in value:
            return uuid.UUID(value[1:-1]).int
        else:
            return int(value)
def deserialize_value(ty, value):
    '''
    Deserialize a value of some type
    '''
    uty = ty.upper()
    
    if uty == 'BOOLEAN':
        if value.isdigit():
            return bool(int(value))
        elif value.upper() == 'FALSE':
            return False
        elif value.upper() == 'TRUE':
            return True
        else:
            return None
    
    elif uty == 'INTEGER': 
        if '"' in value:
            return uuid.UUID(value[1:-1]).int
        else:
            return int(value)
    
    elif uty == 'REAL': 
        return float(value)
    
    elif uty == 'STRING': 
        return value[1:-1].replace("''", "'")
    
    elif uty == 'UNIQUE_ID': 
        if '"' in value:
            return uuid.UUID(value[1:-1]).int
        else:
            return int(value)
def deserialize_value ( ty , value ) : uty = ty . upper ( ) if uty == 'BOOLEAN' : if value . isdigit ( ) : return bool ( int ( value ) ) elif value . upper ( ) == 'FALSE' : return False elif value . upper ( ) == 'TRUE' : return True else : return None elif uty == 'INTEGER' : if '"' in value : return uuid . UUID ( value [ 1 : - 1 ] ) . int else : return int ( value ) elif uty == 'REAL' : return float ( value ) elif uty == 'STRING' : return value [ 1 : - 1 ] . replace ( "''" , "'" ) elif uty == 'UNIQUE_ID' : if '"' in value : return uuid . UUID ( value [ 1 : - 1 ] ) . int else : return int ( value )
Deserialize a value of some type
Deserialize a value of some type