def k2a(a, x):
    """Rescale data from a K object x to array a.

    """
    func, scale = None, 1
    t = abs(x._t)
    # timestamp (12), month (13), date (14) or datetime (15)
    if 12 <= t <= 15:
        unit = get_unit(a)
        attr, shift, func, scale = _UNIT[unit]
        a[:] = getattr(x, attr).data
        a += shift
    # timespan (16), minute (17), second (18) or time (19)
    elif 16 <= t <= 19:
        unit = get_unit(a)
        func, scale = _SCALE[unit]
        a[:] = x.timespan.data
    else:
        a[:] = list(x)

    if func is not None:
        func = getattr(numpy, func)
        a[:] = func(a.view(dtype='i8'), scale)

    if a.dtype.char in 'mM':
        n = x.null
        if n.any:
            a[n] = None
def k2a ( a , x ) : func , scale = None , 1 t = abs ( x . _t ) if 12 <= t <= 15 : unit = get_unit ( a ) attr , shift , func , scale = _UNIT [ unit ] a [ : ] = getattr ( x , attr ) . data a += shift elif 16 <= t <= 19 : unit = get_unit ( a ) func , scale = _SCALE [ unit ] a [ : ] = x . timespan . data else : a [ : ] = list ( x ) if func is not None : func = getattr ( numpy , func ) a [ : ] = func ( a . view ( dtype = 'i8' ) , scale ) if a . dtype . char in 'mM' : n = x . null if n . any : a [ n ] = None
Rescale data from a K object x to array a.