(settings)
Perform file format conversion.
Perform file format conversion.
Perform file format conversion .
def _convert(settings):
    """Perform file format conversion."""
    mode, in_name, out_name = settings.conv_params
    with basic.Session(**settings.session_params) as session:
        # binary stdin if no name supplied - use BytesIO buffer for seekability
        with session.bind_file(in_name or io.BytesIO(stdio.stdin.buffer.read())) as infile:
            session.execute(b'LOAD "%s"' % (infile,))
        with session.bind_file(out_name or stdio.stdout.buffer, create=True) as outfile:
            mode_suffix = b',%s' % (mode,) if mode.upper() in (b'A', b'P') else b''
            session.execute(b'SAVE "%s"%s' % (outfile, mode_suffix))
def _convert ( settings ) : mode , in_name , out_name = settings . conv_params with basic . Session ( * * settings . session_params ) as session : # binary stdin if no name supplied - use BytesIO buffer for seekability with session . bind_file ( in_name or io . BytesIO ( stdio . stdin . buffer . read ( ) ) ) as infile : session . execute ( b'LOAD "%s"' % ( infile , ) ) with session . bind_file ( out_name or stdio . stdout . buffer , create = True ) as outfile : mode_suffix = b',%s' % ( mode , ) if mode . upper ( ) in ( b'A' , b'P' ) else b'' session . execute ( b'SAVE "%s"%s' % ( outfile , mode_suffix ) )