(name, mode, pos)
return io.open(os.devnull, mode)
Unpickle a file object.
Unpickle a file object.
Unpickle a file object .
def unpickle_file(name, mode, pos):
    """Unpickle a file object."""
    if name is None:
        if mode == 'rb' or (PY2 and mode == 'r'):
            return stdio.stdin.buffer
        elif mode == 'r':
            return stdio.stdin
        elif mode == 'wb' or (PY2 and mode == 'w'):
            return stdio.stdout.buffer
        elif mode == 'w':
            return stdio.stdout
    try:
        if 'w' in mode and pos > 0:
            # preserve existing contents of writable file
            with io.open(name, 'rb') as f:
                buf = f.read(pos)
            f = io.open(name, mode)
            f.write(buf)
        else:
            f = io.open(name, mode)
            if pos > 0:
                f.seek(pos)
    except IOError:
        pass
    else:
        return f
    logging.warning('Could not re-open file %s. Replacing with null file.', name)
    return io.open(os.devnull, mode)
def unpickle_file ( name , mode , pos ) : if name is None : if mode == 'rb' or ( PY2 and mode == 'r' ) : return stdio . stdin . buffer elif mode == 'r' : return stdio . stdin elif mode == 'wb' or ( PY2 and mode == 'w' ) : return stdio . stdout . buffer elif mode == 'w' : return stdio . stdout try : if 'w' in mode and pos > 0 : # preserve existing contents of writable file with io . open ( name , 'rb' ) as f : buf = f . read ( pos ) f = io . open ( name , mode ) f . write ( buf ) else : f = io . open ( name , mode ) if pos > 0 : f . seek ( pos ) except IOError : pass else : return f logging . warning ( 'Could not re-open file %s. Replacing with null file.' , name ) return io . open ( os . devnull , mode )