Example #1
0
def _dictionaryStrKey(data):
    """check to see this is a dictionary, and all keys are strings"""
    if drawer.isDict(data):# recurse into dictionary, use key as name
        for key in data.keys():
            if not drawer.isStr(key):
                return 0 # dictionary, but a key is not a string
        return 1 # all keys are strings, a dictionary
    return 0 # not a dictionary
Example #2
0
def _evalRecurse(data):
    """recursively evaluate data in dictionaries; if data is a string, 
    dont evaluate if data is a dict, recurse"""
    keyList = list(data.keys())
    for key in keyList:
        if drawer.isDict(data[key]):
            _evalRecurse(data[key])
        else:  # not a dictionary
            try:
                data[key] = eval(data[key])
            except (NameError, SyntaxError):  # its a string
                pass
Example #3
0
def _evalRecurse(data):
    """recursively evaluate data in dictionaries; if data is a string, 
    dont evaluate if data is a dict, recurse"""
    keyList = data.keys()
    for key in keyList:
        if drawer.isDict(data[key]):
            _evalRecurse(data[key])
        else:  # not a dictionary
            try:
                data[key] = eval(data[key])
            except (NameError, SyntaxError):  # its a string
                pass