Revive a value
@param {Object | Array} context
@param {string} key
@param {*} value
@param {function(key: string, value: *)} reviver
@return {*}
972674
function reviveValue (context, key, value, reviver) {
  if (Array.isArray(value)) {
    return reviver.call(context, key, reviveArray(value, reviver));
  }
  else if (value && typeof value === 'object' && !value.isLosslessNumber) {
    // note the special case for LosslessNumber,
    // we don't want to iterate over the internals of a LosslessNumber
    return reviver.call(context, key, reviveObject(value, reviver))
  }
  else {
    return reviver.call(context, key, value)
  }
}
42177
def value_series(self, key, start=None, end=None, interval=None,
                     namespace=None, cache=None):
        """"""
        return self.make_context(key=key, start=start, end=end,
                                 interval=interval, namespace=namespace,
                                 cache=cache).value_series()
561615
public EncryptionContext withContext(String key, String value) {
    this.context.put(key, value);
    return this;
  }
1365858
function copycontext(context) {
    var t = {};
    var keys =  context.keys();
    var i = keys.length;
    var k, v, j;
    while (i--) {
      k = keys[i];
      if (k[0] == '_')
        continue;
      v = context.get(k);
      if (v && {}.toString.call(v) === '[object Function]')
        continue;

      try {
        j = JSON.stringify(v);
        t[k] = JSON.parse(j);
      } catch(err) {
        t[k] = "Exception: " + err;
      }
    }
    
    return t;
  }
1074701
def set(self, key, value):
        
        value_encoded = encode(value)

        if key in self.data and self.data[key] == value_encoded:
            return []

        self.data[key] = value_encoded
        return self.trigger_callbacks(key)
817435
public V put(K key, V value)
  {
    Entry<V> oldValue = _cache.put(key, new Entry<V>(_expireInterval, value));

    if (oldValue != null)
      return oldValue.getValue();
    else
      return null;
  }
1212296
function Persistable (key, value) {
        const __self = this;
        __self.key = key;

        // Set value and type of object.
        if (value === undefined || value === null) {
            __self.value = undefined;
            __self.type = typeof undefined;
        } else if (value instanceof Array) {
            __self.value = [];
            value.forEach(function (e, i) {
                __self.value.push(new Persistable(key + '[' + i + ']', e));
            });
            __self.type = Type.ARRAY;
        } else {
            switch (typeof value) {
                case Type.STRING:
                case Type.NUMBER:
                case Type.BOOLEAN:
                    __self.value = value;
                    __self.type = typeof value;
                    break;
                case Type.OBJECT:
                    __self.value = [];
                    Object.keys(value).forEach(function (e) {
                        __self.value.push(new Persistable(key + '[' + e + ']', value[e]));
                    });
                    __self.type = typeof value;
                    break;
                default:
                    _logUnknownType(typeof value);
            }
        }

        __self.timestamp = Date.now();

        __self.toOriginal = function () {
            return _fromPersistable(__self);
        };
    }
805283
function datesTransformReviver(key, value) {

    if (key === DATES_FIELD) {
      dates = value
      return null
    }

    if (value && typeof value === 'object' && value.hasOwnProperty(DATES_FIELD)) {
      for (const prop in value) {
        if (value.hasOwnProperty(prop) && dates.indexOf(value[prop]) !== -1) {
          value[prop] = new Date(Number.parseInt(value[prop]))
        }
      }

      datesHolders.push(value)
      dates = undefined
    }

    if (key === '') { //root object
      datesHolders.forEach(datesHolder => {
        delete datesHolder[DATES_FIELD]
      })

      datesHolders = []
    }

    return value
  }
232897
public FluentValidator putClosure2Context(String key, Closure value) {
        if (context == null) {
            context = new ValidatorContext();
        }
        context.setClosure(key, value);
        return this;
    }
857165
function createKeyVal(key, value) {
    return {
      key,
      val: (typeof value === 'function')
        ? function (bidResponse) {
          return value(bidResponse);
        }
        : function (bidResponse) {
          return getValue(bidResponse, value);
        }
    };
  }
886090
function (key, value) {
        var accessor = getAccessors(this)[key],
            oldVal = this.get(key);


        this.triggerBeforeChanged(key, oldVal);

        if (accessor) {
            accessor.target.set(accessor.key, value);
        } else {

            if (this['set_' + key]) {
                this['set_' + key](value);
            } else {
                this[key] = value;
            }
        }
        this.triggerChanged(key, oldVal);
    }
687360
function(key, value) {
          const key2 = key.toLowerCase().replace(/[^a-z0-9]/ig, '');
          res.serverassist.headers[key]    = value;
          res.serverassist.headers2[key2]  = value;
        }
371566
function (key, value) {
            if (!base.isString(key)) {
                var l = this.__heap.push(this.__makeNode(key, value));
                this.__upHeap(l - 1);
            } else {
                throw new TypeError("Invalid key");
            }
        }
90796
def context_value(name):
    

    def context_value(_value, context, **_params):
        return defer.succeed(context[name])

    return context_value
942507
function (cb, context) {
        context !== void 0 && (cb = bind(cb, context));
        for (var key in this.data) {
            this.data.hasOwnProperty(key) && cb(this.data[key], key);
        }
    }
194230
def restore(self, value, context=None):
        
        # ensure this value is a string type
        if isinstance(value, (str, unicode)):
            value = projex.text.decoded(value)

        return super(AbstractStringColumn, self).restore(value, context)
634444
function ContextHelper(contexts) {

    var self = {};

    /**
     * ContextHelper Constructor
     * */
    var init = function(contexts) {

        if ( typeof(contexts) == 'undefined' ) {
            var contexts = {
                paths : {}
            }
        }

        self.contexts = contexts;

        if ( typeof(ContextHelper.initialized) != 'undefined' && ContextHelper.instance) {
            self = ContextHelper.instance;
        } else {
            ContextHelper.initialized = true;
            ContextHelper.instance = self
        }



        return self
    }

    self.configure = function(contexts) {
        joinContext(contexts)
    }

    joinContext = function(context) {
        merge(self.contexts, context, true)
    }

    var parseCtxObject = function (o, obj) {

        for (var i in o) {
            if (o[i] !== null && typeof(o[i]) == 'object') {
                parseCtxObject(o[i], obj);
            } else if (o[i] == '_content_'){
                o[i] = obj
            }
        }

        return o
    }

    setContext = function(name, obj, force) {

        if (arguments.length > 1) {
            //console.log("Globla setter active ", name, obj);
            if ( typeof(name) == 'undefined' || name == '' ) {
                var name = 'global'
            }

            if (/\./.test(name) ) {
                var keys        = name.split(/\./g)
                    , newObj    = {}
                    , str       = '{'
                    , _count    = 0;

                for (var k = 0, len = keys.length; k<len; ++k) {
                    str +=  "\""+ keys.splice(0,1)[0] + "\":{";

                    ++_count;
                    if (k == len-1) {
                        str = str.substr(0, str.length-1);
                        str += "\"_content_\"";
                        for (var c = 0; c<_count; ++c) {
                            str += "}"
                        }
                    }
                }

                newObj = parseCtxObject(JSON.parse(str), obj);
                if (force) {
                    var key = name.split(/\./g);
                    self.contexts = merge(self.contexts, newObj, true);
                } else {
                    self.contexts =  merge(self.contexts, newObj)
                }

            } else {
                if (!self.contexts[name])
                    self.contexts[name] = {};

                if ( typeof(self.contexts[name]) != 'undefined' && !force) {
                    self.contexts[name] = obj
                } else {
                    self.contexts[name] = merge(self.contexts[name], obj, force)
                }
            }

        } else {
            //console.debug("setting context ", arguments[0]);
            self.contexts = arguments[0]
        }

        ContextHelper.instance = self;
    }

    getContext = function(name) {

        if ( typeof(name) != 'undefined' ) {
            try {
                //return clone(self.contexts[name])
                return self.contexts[name]
            } catch (err) {
                return undefined
            }
        } else {
            return self.contexts
        }
    }


    var throwError = function(code, err) {
        var router      = getContext('router');
        if (router) {
            var res                 = router.response
                , next              = router.next
                , hasViews          = router.hasViews
                , isUsingTemplate   = isUsingTemplate
                , code              = code;


            if (arguments.length < 2) {
                var err = code;
                code = 500
            }

            if ( !hasViews || !isUsingTemplate ) {
                if (!res.headersSent) {
                    res.writeHead(code, { 'Content-Type': 'application/json'} );
                    res.end(JSON.stringify({
                        status: code,
                        error: 'Error '+ code +'. '+ err.stack
                    }))
                } else {
                    next()
                }

            } else {
                if (!res.headersSent) {
                    res.writeHead(code, { 'Content-Type': 'text/html'} );
                    res.end('<h1>Error '+ code +'.</h1><pre>'+ err.stack + '</pre>')
                } else {
                    next()
                }
            }
        } else {
            throw err
        }
    }

    /**
     * Get bundle library
     *
     * TODO - cleanup
     *
     * @param {string} [ bundle ] - Bundle name
     * @param {string} lib  - Library name (module or file)
     *
     * */
    getLib = function(bundle, lib) {
        var ctx       = self.contexts;

        if (arguments.length == 1 || !bundle) {
            //console.debug(
            //    '\n[ 0 ] = '+ __stack[0].getFileName(),
            //    '\n[ 1 ] = '+ __stack[1].getFileName(),
            //    '\n[ 2 ] = '+ __stack[2].getFileName(),
            //    '\n[ 3 ] = '+ __stack[3].getFileName(),
            //    '\n[ 4 ] = '+ __stack[4].getFileName(),
            //    '\n[ 5 ] = '+ __stack[5].getFileName(),
            //    '\n[ 6 ] = '+ __stack[6].getFileName()
            //);
            var lib         = (arguments.length == 1) ? bundle : lib
                , bundle    = null
                , libPath   = null
                , file      = null
                , stackFileName = null;
                //, file      = ( !/node_modules/.test(__stack[1].getFileName()) ) ?  __stack[1].getFileName() : __stack[2].getFileName()
            for (var i = 1, len = 10; i<len; ++i) {
                stackFileName = __stack[i].getFileName();
                if ( stackFileName && !/node_modules/.test(stackFileName) ) {
                    file = stackFileName;
                    break;
                }
            }
            var a           = file.replace('.js', '').split('/')
                , i         = a.length-1;

            if (bundle == lib) {
                bundle = ctx.bundle
            } else {

                if (ctx.bundles) {
                    for (; i >= 0; --i) {
                        index = ctx.bundles.indexOf(a[i]);
                        if ( index > -1 ) {
                            ctx.bundle = bundle = ctx.bundles[index];

                            break
                        }
                    }
                } else if (ctx.bundle) {
                    bundle = ctx.bundle
                }

            }
        }
        // else {
        //     var libPath     = null
        //         , conf      = getContext('gina').config
        //         , env       = conf.env
        //         , cacheless = conf.isCacheless();
        // }
        var env     = ctx.env;
        var cacheless = ctx.cacheless;
        var Config  = ctx.gina.Config;
        var conf = new Config({
            env             : env,
            executionPath   : getPath('root'),
            startingApp     : bundle,
            ginaPath        : getPath('gina').core
        }).getInstance(bundle);

        if ( typeof(lib) != 'undefined' ) {

            try {

                if (!libPath)
                    libPath = conf.bundlesConfiguration.conf[bundle][env].libPath;

                var libToLoad = _(libPath +'/'+ lib, true);

                if (cacheless) delete require.cache[libToLoad];

                // init with options
                try {
                    var LibClass = require(libToLoad);
                    /**
                     * getConfig
                     *
                     * @param {string} [name]
                     *
                     * @return {object} bundleConfiguration - By default config from the bundle where the lib is located
                     * */
                    LibClass.prototype.getConfig = function (name) {
                        if ( typeof(name) != 'undefined' && typeof( conf.envConf[bundle][env].content[name] ) != 'undefined' ) {
                            return conf.envConf[bundle][env].content[name]
                        }

                        return conf.envConf[bundle][env]
                    };

                    return new LibClass ({
                        bundle      : bundle,
                        env         : env,
                        cacheless   : cacheless,
                        libPath     : libPath
                    })

                } catch(err) {
                    throwError(500, err)
                }

            } catch (err) {
                console.error(err.stack||err.message||err);
                throwError(500, err);
                return undefined
            }
        } else {
            console.error( new Error("no `lib` found"));
            throwError(500, new Error("`lib` [ "+name+" ] not found"))
            return undefined
        }

    }

    /**
     * Whisper
     * Convert replace constant names dictionary by its value
     *
     * @param {object} dictionary
     * @param {object} replaceable
     *
     * @return {object} revealed
     * */
    whisper = function(dictionary, replaceable, rule) {
        var s, key;
        if ( typeof(rule) != 'undefined') {
            return replaceable.replace(rule, function(s, key) {
                return dictionary[key] || s;
            })
        } else {

            if ( typeof(replaceable) == 'object' &&  !/\[native code\]/.test(replaceable.constructor) ||  typeof(replaceable) == 'function' /** && /Object/.test(replaceable.constructor) */ ) { // /Object/.test(replaceable.constructor)
                for (var attr in replaceable) {
                    if ( typeof(replaceable[attr]) != 'function') {
                        replaceable[attr] = (typeof(replaceable[attr]) != 'string' && typeof(replaceable[attr]) != 'object') ? JSON.stringify(replaceable[attr], null, 2) : replaceable[attr];
                        if (replaceable[attr] && typeof(replaceable[attr]) != 'object') {
                            replaceable[attr] = replaceable[attr].replace(/\{(\w+)\}/g, function(s, key) {
                                return dictionary[key] || s;
                            })
                        }
                    }
                }
                return replaceable
            } else { // mixing with classes
                replaceable = JSON.stringify(replaceable, null, 2);

                return JSON.parse(
                    replaceable.replace(/\{(\w+)\}/g, function(s, key) {
                        return dictionary[key] || s;
                    })
                )
            }
        }
    }

    isWin32 = function() {
        return (os.platform() == 'win32') ? true : false;
    }

    return init(contexts)
}