Пример #1
0
def load_config(obj, config_format, config):
    config_format = _parse_config_format(config_format)

    class Locals(object):
        def __setitem__(self, key, value):
            try:
                stmt = config_format[key][1]
            except KeyError:
                return
            _exec(stmt, locals=_ObjLocals(obj), globals={'v': value})

        def __getitem__(self, key):
            raise KeyError()

        def __delitem__(self, key):
            raise KeyError()

    _exec(config, locals=Locals())
Пример #2
0
def load_config(obj, config_format, config):
    config_format = _parse_config_format(config_format)

    class Locals(object):
        def __setitem__(self, key, value):
            try:
                stmt = config_format[key][1]
            except KeyError:
                return
            _exec(stmt, locals=_ObjLocals(obj), globals={"v": value})

        def __getitem__(self, key):
            raise KeyError()

        def __delitem__(self, key):
            raise KeyError()

    _exec(config, locals=Locals())
Пример #3
0
 def __setitem__(self, key, value):
     try:
         stmt = config_format[key][1]
     except KeyError:
         return
     _exec(stmt, locals=_ObjLocals(obj), globals={'v': value})
Пример #4
0
 def __setitem__(self, key, value):
     try:
         stmt = config_format[key][1]
     except KeyError:
         return
     _exec(stmt, locals=_ObjLocals(obj), globals={"v": value})