def loadFromPickled(cls, file, format="<L", statHandler=None): ''' :param file: should be path or binary file stream :type file: file | str :rtype: stream ''' if isinstance(file, basestring): file = openByExtension(file, mode='r', buffering=2**12) return cls(stream.__unpickleStreamGenerator(file, format, statHandler))
def loadFromPickled(cls, file, format="<L", statHandler=None): ''' :param file: should be path or binary file stream :type file: file | str :rtype: stream ''' if isinstance(file, basestring): file = openByExtension(file, mode='r', buffering=2 ** 12) return cls(stream.__unpickleStreamGenerator(file, format, statHandler))
def readFromBinaryChunkStream(readStream, format="<L", statHandler=None): ''' :param file: should be path or binary file stream :param statHandler: statistics handler, will be called before every yield with a tuple (n,size) :type statHandler: callable :type file: file | str :rtype: stream[T] ''' if isinstance(readStream, basestring): readStream = openByExtension(readStream, mode='r', buffering=2 ** 12) return stream(stream.__binaryChunksStreamGenerator(readStream, format, statHandler))
def loadFromPickled(file, format="<L", statHandler=None): ''' :param file: should be path or binary file stream :param statHandler: statistics handler, will be called before every yield with a tuple (n,size) :type statHandler: callable :type file: file | str :rtype: stream[T] ''' if isinstance(file, basestring): file = openByExtension(file, mode='r', buffering=2 ** 12) return stream.readFromBinaryChunkStream(file, format, statHandler).map(pickle.loads)