Deserialization helper that reconstructs a closure
    :param values: The closure values
    :return: The closure
350253
def func_reconstruct_closure(values):
    
    nums = range(len(values))
    src = ["def func(arg):"]
    src += ["  _%d = arg[%d]" % (n, n) for n in nums]
    src += ["  return lambda:(%s)" % ','.join(["_%d" % n for n in nums]), ""]
    src = '\n'.join(src)
    try:
        exec(src, globals())
    except:
        raise SyntaxError(src)
    return func(values).__closure__
405308
def unwrap(self, value, session=None):
        ''' 
        '''
        self.validate_unwrap(value)
        ret = {}
        for k, v in value.items():
            ret[k] = self.value_type.unwrap(v, session=session)
        return ret
56048
def _deserialize_dict(cls, cls_target, dict_):
        

        instance = cls_target.__new__(cls_target)
        dict_deserialized = cls._deserialize_dict_attributes(cls_target, dict_)
        instance.__dict__ = cls._fill_default_values(cls_target,
                                                     dict_deserialized)

        return instance
886639
def _decompose(self, value):
        
        data = {}
        for n, attr in zip(self.recordType.__names__, self.attrs):
            data[attr.attrname] = getattr(value, n)
        return data
1130163
def from_raw(self, rval: RawValue, jptr: JSONPointer = "") -> Value:
        """"""
        def convert(val):
            if isinstance(val, list):
                res = ArrayValue([convert(x) for x in val])
            elif isinstance(val, dict):
                res = ObjectValue({x: convert(val[x]) for x in val})
            else:
                res = val
            return res
        return convert(rval)
1274215
def _deserialize_value(val, raw: false)
      val = val.pack('C*')
      val = @desc.post_process(val) if !raw && @desc.read_processors?
      val
    end
573183
def unmarshall_value(self, value):
        
        value = str(value)
        if self.escapeValues:
            value = value.decode('hex')
        if self.compressValues:
            value = zlib.decompress(value)
        value = pickle.loads(value)
        return value
1229498
def zipObject(self, values):
        
        result = {}
        keys = self.obj
        i = 0
        l = len(keys)
        while i < l:
            result[keys[i]] = values[i]
            l = len(keys)
            i += 1

        return self._wrap(result)
697063
function deserializeValue(value) {
    var num
    try {
      return value ?
        value == "true" ||
        ( value == "false" ? false :
          value == "null" ? null :
          !isNaN(num = Number(value)) ? num :
          /^[\[\{]/.test(value) ? $.parseJSON(value) :
          value )
        : value
    } catch(e) {
      return value
    }
  }
347802
def deserialize(self, value, **kwargs):
        
        kwargs.update({'trusted': kwargs.get('trusted', False)})
        if self.deserializer is not None:
            return self.deserializer(value, **kwargs)
        if value is None:
            return None
        return self.wrapper(value).astype(self.dtype[0])
1361362
def deserialize(cls, v, bind_client=None):
        
        if v is None:
            return None
        o = cls(bind_client=bind_client)
        o.from_dict(v)
        return o
506021
def decode_numpy_dict_values(attrs: Mapping[K, V]) -> Dict[K, V]:
    
    attrs = dict(attrs)
    for k, v in attrs.items():
        if isinstance(v, np.ndarray):
            attrs[k] = v.tolist()
        elif isinstance(v, np.generic):
            attrs[k] = v.item()
    return attrs
718499
def wrap(self, values):
        
        if isinstance(values, Value):
            return values
        cols = dict([(L, []) for L in self.labels])
        try:
            # unzip list of dict
            for V in values:
                for L in self.labels:
                    try:
                        cols[L].append(V[L])
                    except (IndexError, KeyError):
                        pass
            # allow omit empty columns
            for L in self.labels:
                V = cols[L]
                if len(V) == 0:
                    del cols[L]

            try:
                return self.Value(self.type, {
                    'labels': self.labels,
                    'value': cols,
                })
            except:
                _log.error("Failed to encode '%s' with %s", cols, self.labels)
                raise
        except:
            _log.exception("Failed to wrap: %s", values)
            raise
507688
def deserialize(self, obj=None, ignore_non_existing=False):
    
    if not isinstance(obj, dict):
      if ignore_non_existing:
        return

      raise TypeError("Wrong data '{}' passed for '{}' deserialization".format(obj, self.__class__.__name__))

    definitions = {k: v for k, v in self.__class__.__dict__.items() if k[:1] != "_"}
    def_property_keys = set(definitions.keys())
    property_keys = set(obj.keys())

    existing_keys = def_property_keys & property_keys
    non_defined_keys = property_keys - def_property_keys
    non_existing_keys = def_property_keys - property_keys

    if not ignore_non_existing and non_defined_keys:
      raise TypeError(self.__class__.__name__ + " doesn't contain properties: {}".format(", ".join(non_defined_keys)))

    for k in existing_keys:
      v = obj[k]
      attr_type = definitions[k]

      try:
        if isinstance(attr_type, list) and self._isclass(attr_type[0], BaseView):
          if isinstance(v, list):
            obj_list = [attr_type[0](serialized_obj=v_item, ignore_non_existing=ignore_non_existing) for v_item in v]
          else:
            obj_list = [attr_type[0](serialized_obj=v, ignore_non_existing=ignore_non_existing)]

          self.__setattr__(k, obj_list)
        elif self._isclass(attr_type, BaseView):
          self.__setattr__(k, attr_type(v))
        else:
          self.__setattr__(k, v)
      except IndexError:
        self.__setattr__(k, v)  # check test_empty_view_deserialization test suite for test-case

    for k in non_existing_keys:
      attr_type = definitions[k]

      if attr_type is None:
        self.__setattr__(k, None)
      elif isinstance(attr_type, (list, set, tuple, dict)) and len(attr_type) == 0:
        self.__setattr__(k, attr_type.__class__())
      elif isinstance(attr_type, (list, set, tuple)) and self._isclass(attr_type[0], BaseView):
        self.__setattr__(k, attr_type.__class__())
      else:
        self.__setattr__(k, attr_type.__class__(attr_type))

    return self
642850
def deserialize(cls, assoc_s):
        
        pairs = kvform.kvToSeq(assoc_s, strict=True)
        keys = []
        values = []
        for k, v in pairs:
            keys.append(k)
            values.append(v)

        if keys != cls.assoc_keys:
            raise ValueError('Unexpected key values: %r', keys)

        version, handle, secret, issued, lifetime, assoc_type = values
        if version != '2':
            raise ValueError('Unknown version: %r' % version)
        issued = int(issued)
        lifetime = int(lifetime)
        secret = oidutil.fromBase64(secret)
        return cls(handle, secret, issued, lifetime, assoc_type)
1084673
function deserializeValue(value) {
  var num
  try {
    return value ?
      value == 'true' || value == true ||
      (value == 'false' || value == false ? false :
        value == 'null' ? null :
        !/^0/.test(value) && !isNaN(num = Number(value)) ? num :
        /^[\[\{]/.test(value) ? JSON.parse(value) :
        value)
      : value
  } catch (e) {
    return value
  }
}
754036
def _deserialize(self, value, attr, data):
        """"""
        value = super(TrimmedString, self)._deserialize(value, attr, data)
        return value.strip()