'load(alt:[fn: loadablefilenamestring+ or
fn: loadableiterableofstrings+]
[use_readline = boolean+]) -> Stat
Load heapy-related data from a serialized form. Currently it handles
data generated by Stat.dump.
Arguments
fn: loadablefilenamestring+
A string argument is treated as a file name.
fn: loadableiterableofstrings+
An open file or an iterator will be iterated over enough
to read one package of data, and another call to load
will read the next package.
use_readline = boolean+
If true, the method will use .readline() instead of
iteration, which may be necessary in case the input
comes from a pipe since otherwise the Python runtime
would try to read ahead a big block before returning the
first package of data.
Returns
one package of statistical data.
References
[0] heapy_Use.html#heapykinds.Use.load'

def load(self, fn, use_readline=0):

    if isinstance(fn, basestring):
        f = open(fn)
        def get_trows():
            pos = 0
            while 1:
                f.seek(pos)
                line = f.readline()
                if (not line):
                    break
                pos = f.tell()
                (yield line)
    elif (hasattr(fn, '__iter__') and (not hasattr(fn, 'next'))):
        def get_trows():
            return fn
    elif hasattr(fn, 'next'):
        if use_readline:
            get_line = fn.readline
        else:
            get_line = fn.next
        trows = []
        line = get_line()
        if (not line):
            raise StopIteration
        endline = ('.end:    %s' % line)
        try:
            while line:
                trows.append(line)
                if (line == endline):
                    break
                line = get_line()
            else:
                raise StopIteration
        except StopIteration:
            trows.append(endline)
        def get_trows():
            return trows
    else:
        raise TypeError, 'Argument    should    be    a    string,    file    or    an    iterable    yielding    strings.'
    a = iter(get_trows()).next()
    if (not a.startswith('.loader:')):
        raise ValueError, ('Format    error    in    %r:    no    initial    .loader    directive.' % fn)
    loader = a[(a.index(':') + 1):].strip()
    try:
        loader = getattr(self, loader)
    except AttributeError:
        raise ValueError, ('Format    error    in    %r:    no    such    loader:    %r.' % (fn, loader))
    return loader(get_trows)
