# Path: plover/machine/base.py
# class SerialStenotypeBase(ThreadedStenotypeBase):
#     """For use with stenotype machines that connect via serial port.
# 
#     This class implements the three methods necessary for a standard
#     stenotype interface: start_capture, stop_capture, and
#     add_callback.
# 
#     """
# 
#     def __init__(self, serial_params):
#         """Monitor the stenotype over a serial port.
# 
#         Keyword arguments are the same as the keyword arguments for a
#         serial.Serial object.
# 
#         """
#         ThreadedStenotypeBase.__init__(self)
#         self.serial_port = None
#         self.serial_params = serial_params
# 
#     def start_capture(self):
#         if self.serial_port:
#             self.serial_port.close()
# 
#         try:
#             self.serial_port = serial.Serial(**self.serial_params)
#         except (serial.SerialException, OSError) as e:
#             print e
#             self._error()
#             return
#         if self.serial_port is None or not self.serial_port.isOpen():
#             self._error()
#             return
#         return ThreadedStenotypeBase.start_capture(self)
# 
#     def stop_capture(self):
#         """Stop listening for output from the stenotype machine."""
#         ThreadedStenotypeBase.stop_capture(self)
#         if self.serial_port:
#             self.serial_port.close()
# 
#     @staticmethod
#     def get_option_info():
#         """Get the default options for this machine."""
#         bool_converter = lambda s: s == 'True'
#         sb = lambda s: int(float(s)) if float(s).is_integer() else float(s)
#         return {
#             'port': (None, str), # TODO: make first port default
#             'baudrate': (9600, int),
#             'bytesize': (8, int),
#             'parity': ('N', str),
#             'stopbits': (1, sb),
#             'timeout': (2.0, float),
#             'xonxoff': (False, bool_converter),
#             'rtscts': (False, bool_converter)
#         }


from plover.machine.base import SerialStenotypeBase
from itertools import izip_longest
    'C': 'S-',
    'T': 'T-',
    'K': 'K-',
    'P': 'P-',
    'W': 'W-',
    'H': 'H-',
    'R': 'R-',
    '~': '*',
    '*': '*',
    'A': 'A-',
    'O': 'O-',
    'E': '-E',
    'U': '-U',
    'F': '-F',
    'Q': '-R',
    'N': '-P',
    'B': '-B',
    'L': '-L',
    'G': '-G',
    'Y': '-T',
    'X': '-S',
    'D': '-D',
    'Z': '-Z',
}


class Stenotype(SerialStenotypeBase):
    """Passport interface."""

    def __init__(self, params):

# Path: plover/machine/base.py
# class SerialStenotypeBase(ThreadedStenotypeBase):
#     """For use with stenotype machines that connect via serial port.
# 
#     This class implements the three methods necessary for a standard
#     stenotype interface: start_capture, stop_capture, and
#     add_callback.
# 
#     """
# 
#     def __init__(self, serial_params):
#         """Monitor the stenotype over a serial port.
# 
#         Keyword arguments are the same as the keyword arguments for a
#         serial.Serial object.
# 
#         """
#         ThreadedStenotypeBase.__init__(self)
#         self.serial_port = None
#         self.serial_params = serial_params
# 
#     def start_capture(self):
#         if self.serial_port:
#             self.serial_port.close()
# 
#         try:
#             self.serial_port = serial.Serial(**self.serial_params)
#         except (serial.SerialException, OSError) as e:
#             print e
#             self._error()
#             return
#         if self.serial_port is None or not self.serial_port.isOpen():
#             self._error()
#             return
#         return ThreadedStenotypeBase.start_capture(self)
# 
#     def stop_capture(self):
#         """Stop listening for output from the stenotype machine."""
#         ThreadedStenotypeBase.stop_capture(self)
#         if self.serial_port:
#             self.serial_port.close()
# 
#     @staticmethod
#     def get_option_info():
#         """Get the default options for this machine."""
#         bool_converter = lambda s: s == 'True'
#         sb = lambda s: int(float(s)) if float(s).is_integer() else float(s)
#         return {
#             'port': (None, str), # TODO: make first port default
#             'baudrate': (9600, int),
#             'bytesize': (8, int),
#             'parity': ('N', str),
#             'stopbits': (1, sb),
#             'timeout': (2.0, float),
#             'xonxoff': (False, bool_converter),
#             'rtscts': (False, bool_converter)
#         }


# Path: plover/machine/passport.py
from plover.machine.base import SerialStenotypeBase
from itertools import izip_longest

    'C': 'S-',
    'T': 'T-',
    'K': 'K-',
    'P': 'P-',
    'W': 'W-',
    'H': 'H-',
    'R': 'R-',
    '~': '*',
    '*': '*',
    'A': 'A-',
    'O': 'O-',
    'E': '-E',
    'U': '-U',
    'F': '-F',
    'Q': '-R',
    'N': '-P',
    'B': '-B',
    'L': '-L',
    'G': '-G',
    'Y': '-T',
    'X': '-S',
    'D': '-D',
    'Z': '-Z',
}


class Stenotype(SerialStenotypeBase):
    """Passport interface."""

    def __init__(self, params):

        SerialStenotypeBase.__init__(self, params)