(self, arg, console)
Initialise tape device.
Initialise tape device.
Initialise tape device .
def __init__(self, arg, console):
        """Initialise tape device."""
        addr, val = parse_protocol_string(arg)
        ext = val.split(u'.')[-1].upper()
        # WIDTH and LOC on CAS1: directly are ignored
        self.device_file = DeviceSettings()
        # by default, show messages
        self.is_quiet = False
        # console for messages
        self.console = console
        try:
            if not val:
                self.tapestream = None
            elif addr == u'WAV' or (addr != u'CAS' and ext == u'WAV'):
                # if unspecified, determine type on the basis of filename extension
                self.tapestream = CassetteStream(WAVBitStream(val, 'r'))
            else:
                # 'CAS' is default
                self.tapestream = CassetteStream(CASBitStream(val, 'r'))
        except EnvironmentError as e:
            logging.warning(u'Could not attach %s to CAS device: %s', val, e)
            self.tapestream = None
def __init__ ( self , arg , console ) : addr , val = parse_protocol_string ( arg ) ext = val . split ( u'.' ) [ - 1 ] . upper ( ) # WIDTH and LOC on CAS1: directly are ignored self . device_file = DeviceSettings ( ) # by default, show messages self . is_quiet = False # console for messages self . console = console try : if not val : self . tapestream = None elif addr == u'WAV' or ( addr != u'CAS' and ext == u'WAV' ) : # if unspecified, determine type on the basis of filename extension self . tapestream = CassetteStream ( WAVBitStream ( val , 'r' ) ) else : # 'CAS' is default self . tapestream = CassetteStream ( CASBitStream ( val , 'r' ) ) except EnvironmentError as e : logging . warning ( u'Could not attach %s to CAS device: %s' , val , e ) self . tapestream = None