def decode(obj):
typ = obj.get('<STR_LIT>')<EOL>if typ is None:<EOL><INDENT>return obj<EOL><DEDENT>elif typ == '<STR_LIT>':<EOL><INDENT>freq = obj['<STR_LIT>'] if '<STR_LIT>' in obj else obj['<STR_LIT>']<EOL>return Timestamp(obj['<STR_LIT:value>'], tz=obj['<STR_LIT>'], freq=freq)<EOL><DEDENT>elif typ == '<STR_LIT>':<EOL><INDENT>return NaT<EOL><DEDENT>elif typ == '<STR_LIT>':<EOL><INDENT>return Period(ordinal=obj['<STR_LIT>'], freq=obj['<STR_LIT>'])<EOL><DEDENT>elif typ == '<STR_LIT:index>':<EOL><INDENT>dtype = dtype_for(obj['<STR_LIT>'])<EOL>data = unconvert(obj['<STR_LIT:data>'], dtype,<EOL>obj.get('<STR_LIT>'))<EOL>return Index(data, dtype=dtype, name=obj['<STR_LIT:name>'])<EOL><DEDENT>elif typ == '<STR_LIT>':<EOL><INDENT>return RangeIndex(obj['<STR_LIT:start>'],<EOL>obj['<STR_LIT>'],<EOL>obj['<STR_LIT>'],<EOL>name=obj['<STR_LIT:name>'])<EOL><DEDENT>elif typ == '<STR_LIT>':<EOL><INDENT>dtype = dtype_for(obj['<STR_LIT>'])<EOL>data = unconvert(obj['<STR_LIT:data>'], dtype,<EOL>obj.get('<STR_LIT>'))<EOL>data = [tuple(x) for x in data]<EOL>return MultiIndex.from_tuples(data, names=obj['<STR_LIT>'])<EOL><DEDENT>elif typ == '<STR_LIT>':<EOL><INDENT>data = unconvert(obj['<STR_LIT:data>'], np.int64, obj.get('<STR_LIT>'))<EOL>d = dict(name=obj['<STR_LIT:name>'], freq=obj['<STR_LIT>'])<EOL>freq = d.pop('<STR_LIT>', None)<EOL>return PeriodIndex(PeriodArray(data, freq), **d)<EOL><DEDENT>elif typ == '<STR_LIT>':<EOL><INDENT>data = unconvert(obj['<STR_LIT:data>'], np.int64, obj.get('<STR_LIT>'))<EOL>d = dict(name=obj['<STR_LIT:name>'], freq=obj['<STR_LIT>'])<EOL>result = DatetimeIndex(data, **d)<EOL>tz = obj['<STR_LIT>']<EOL>if tz is not None:<EOL><INDENT>result = result.tz_localize('<STR_LIT>').tz_convert(tz)<EOL><DEDENT>return result<EOL><DEDENT>elif typ in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>return globals()[obj['<STR_LIT>']].from_arrays(obj['<STR_LIT:left>'],<EOL>obj['<STR_LIT:right>'],<EOL>obj['<STR_LIT>'],<EOL>name=obj['<STR_LIT:name>'])<EOL><DEDENT>elif typ == '<STR_LIT>':<EOL><INDENT>from_codes = globals()[obj['<STR_LIT>']].from_codes<EOL>return from_codes(codes=obj['<STR_LIT>'],<EOL>categories=obj['<STR_LIT>'],<EOL>ordered=obj['<STR_LIT>'])<EOL><DEDENT>elif typ == '<STR_LIT>':<EOL><INDENT>return Interval(obj['<STR_LIT:left>'], obj['<STR_LIT:right>'], obj['<STR_LIT>'])<EOL><DEDENT>elif typ == '<STR_LIT>':<EOL><INDENT>dtype = dtype_for(obj['<STR_LIT>'])<EOL>pd_dtype = pandas_dtype(dtype)<EOL>index = obj['<STR_LIT:index>']<EOL>result = Series(unconvert(obj['<STR_LIT:data>'], dtype, obj['<STR_LIT>']),<EOL>index=index,<EOL>dtype=pd_dtype,<EOL>name=obj['<STR_LIT:name>'])<EOL>return result<EOL><DEDENT>elif typ == '<STR_LIT>':<EOL><INDENT>axes = obj['<STR_LIT>']<EOL>def create_block(b):<EOL><INDENT>values = _safe_reshape(unconvert(<EOL>b['<STR_LIT>'], dtype_for(b['<STR_LIT>']),<EOL>b['<STR_LIT>']), b['<STR_LIT>'])<EOL>if '<STR_LIT>' in b:<EOL><INDENT>placement = b['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>placement = axes[<NUM_LIT:0>].get_indexer(b['<STR_LIT>'])<EOL><DEDENT>if is_datetime64tz_dtype(b['<STR_LIT>']):<EOL><INDENT>assert isinstance(values, np.ndarray), type(values)<EOL>assert values.dtype == '<STR_LIT>', values.dtype<EOL>values = DatetimeArray(values, dtype=b['<STR_LIT>'])<EOL><DEDENT>return make_block(values=values,<EOL>klass=getattr(internals, b['<STR_LIT>']),<EOL>placement=placement,<EOL>dtype=b['<STR_LIT>'])<EOL><DEDENT>blocks = [create_block(b) for b in obj['<STR_LIT>']]<EOL>return globals()[obj['<STR_LIT>']](BlockManager(blocks, axes))<EOL><DEDENT>elif typ == '<STR_LIT>':<EOL><INDENT>return parse(obj['<STR_LIT:data>'])<EOL><DEDENT>elif typ == '<STR_LIT>':<EOL><INDENT>return np.datetime64(parse(obj['<STR_LIT:data>']))<EOL><DEDENT>elif typ == '<STR_LIT:date>':<EOL><INDENT>return parse(obj['<STR_LIT:data>']).date()<EOL><DEDENT>elif typ == '<STR_LIT>':<EOL><INDENT>return timedelta(*obj['<STR_LIT:data>'])<EOL><DEDENT>elif typ == '<STR_LIT>':<EOL><INDENT>return np.timedelta64(int(obj['<STR_LIT:data>']))<EOL><DEDENT>elif typ == '<STR_LIT>':<EOL><INDENT>return globals()[obj['<STR_LIT>']](obj['<STR_LIT>'], obj['<STR_LIT>'],<EOL>obj['<STR_LIT>'])<EOL><DEDENT>elif typ == '<STR_LIT>':<EOL><INDENT>return globals()[obj['<STR_LIT>']](obj['<STR_LIT>'], obj['<STR_LIT>'])<EOL><DEDENT>elif typ == '<STR_LIT>':<EOL><INDENT>return unconvert(obj['<STR_LIT:data>'], np.typeDict[obj['<STR_LIT>']],<EOL>obj.get('<STR_LIT>')).reshape(obj['<STR_LIT>'])<EOL><DEDENT>elif typ == '<STR_LIT>':<EOL><INDENT>if obj.get('<STR_LIT>') == '<STR_LIT>':<EOL><INDENT>return c2f(obj['<STR_LIT>'], obj['<STR_LIT>'], obj['<STR_LIT>'])<EOL><DEDENT>else:<EOL><INDENT>dtype = dtype_for(obj['<STR_LIT>'])<EOL>try:<EOL><INDENT>return dtype(obj['<STR_LIT:data>'])<EOL><DEDENT>except (ValueError, TypeError):<EOL><INDENT>return dtype.type(obj['<STR_LIT:data>'])<EOL><DEDENT><DEDENT><DEDENT>elif typ == '<STR_LIT>':<EOL><INDENT>return complex(obj['<STR_LIT>'] + '<STR_LIT:+>' + obj['<STR_LIT>'] + '<STR_LIT>')<EOL><DEDENT>elif isinstance(obj, (dict, list, set)):<EOL><INDENT>return obj<EOL><DEDENT>else:<EOL><INDENT>return obj<EOL><DEDENT>
Decoder for deserializing numpy data types.