(self, events)
return absinfo, prepared_events
Prepare events for passing to _uinput.enable and _uinput.setup
Prepare events for passing to _uinput.enable and _uinput.setup
Prepare events for passing to _uinput . enable and _uinput . setup
def _prepare_events(self, events):
        '''Prepare events for passing to _uinput.enable and _uinput.setup'''
        absinfo, prepared_events = [], []
        for etype, codes in events.items():
            for code in codes:
                # Handle max, min, fuzz, flat.
                if isinstance(code, (tuple, list, device.AbsInfo)):
                    # Flatten (ABS_Y, (0, 255, 0, 0, 0, 0)) to (ABS_Y, 0, 255, 0, 0, 0, 0).
                    f = [code[0]]
                    f.extend(code[1])
                    # Ensure the tuple is always 6 ints long, since uinput.c:uinput_create
                    # does little in the way of checking the length.
                    f.extend([0] * (6 - len(code[1])))
                    absinfo.append(f)
                    code = code[0]
                prepared_events.append((etype, code))
        return absinfo, prepared_events
def _prepare_events ( self , events ) : absinfo , prepared_events = [ ] , [ ] for etype , codes in events . items ( ) : for code in codes : # Handle max, min, fuzz, flat. if isinstance ( code , ( tuple , list , device . AbsInfo ) ) : # Flatten (ABS_Y, (0, 255, 0, 0, 0, 0)) to (ABS_Y, 0, 255, 0, 0, 0, 0). f = [ code [ 0 ] ] f . extend ( code [ 1 ] ) # Ensure the tuple is always 6 ints long, since uinput.c:uinput_create # does little in the way of checking the length. f . extend ( [ 0 ] * ( 6 - len ( code [ 1 ] ) ) ) absinfo . append ( f ) code = code [ 0 ] prepared_events . append ( ( etype , code ) ) return absinfo , prepared_events