deepforge icon indicating copy to clipboard operation
deepforge copied to clipboard

Custom serialization/deserialization for file handles

Open brollb opened this issue 6 years ago • 1 comments

It would be nice to have support for serialization/deserialization for file handles (_io.TextWrapper) out of the box. The serializer and deserializer should be rather trivial:

import os

def save_textwrapper(handle, outfile):
    os.system('ln -s ' + handle.name + ' ' + outfile.name)
def load_textwrapper(infile):
    return infile

This would result in the creation of a symbolic link on save (avoiding data copy) and just passing the file handle through when loading the file.

brollb avatar Jul 11 '19 17:07 brollb

Why is a file handle called _io.TextWrapper ? Is just an example?

umesh-timalsina avatar May 06 '20 15:05 umesh-timalsina