labpack/messaging/telegram.py
def _compile_keypad(self, keypad_type, persist_buttons):
        
        ''' a helper method to compile keypad buttons to telegram api format

        :param keypad_type: string with type of keypad to emulate
        :param persist_buttons: boolean to keep buttons around after exiting
        :return: string in json serial format
        '''

        import json
        keyboard_list = []
        if keypad_type == 'phone':
            row_list = [ {'text': '1'}, {'text': '2'}, {'text': '3'} ]
            keyboard_list.append(row_list)
            row_list = [ {'text': '4'}, {'text': '5'}, {'text': '6'} ]
            keyboard_list.append(row_list)
            row_list = [ {'text': '7'}, {'text': '8'}, {'text': '9'} ]
            keyboard_list.append(row_list)
            row_list = [ {'text': '*'}, {'text': '0'}, {'text': '#'} ]
            keyboard_list.append(row_list)
        elif keypad_type == 'calculator':
            row_list = [ {'text': '7'}, {'text': '8'}, {'text': '9'}, {'text': '/'} ]
            keyboard_list.append(row_list)
            row_list = [ {'text': '4'}, {'text': '5'}, {'text': '6'}, {'text': '*'} ]
            keyboard_list.append(row_list)
            row_list = [ {'text': '1'}, {'text': '2'}, {'text': '3'}, {'text': '-'} ]
            keyboard_list.append(row_list)
            row_list = [ {'text': '0'}, {'text': '.'}, {'text': '='}, {'text': '+'} ]
            keyboard_list.append(row_list)
        keyboard_kwargs = {
            'keyboard': keyboard_list,
            'one_time_keyboard': not persist_buttons,
            'resize_keyboard': True
        }
        json_data = json.dumps(keyboard_kwargs)
        return json_data
 a helper method to compile keypad buttons to telegram api format

        :param keypad_type: string with type of keypad to emulate
        :param persist_buttons: boolean to keep buttons around after exiting
        :return: string in json serial format
        
a helper method to compile keypad buttons to telegram api format
a helper method to compile keypad buttons to telegram api format
def _compile_keypad(self, keypad_type, persist_buttons):
        import json
        keyboard_list = []
        if keypad_type == 'phone':
            row_list = [ {'text': '1'}, {'text': '2'}, {'text': '3'} ]
            keyboard_list.append(row_list)
            row_list = [ {'text': '4'}, {'text': '5'}, {'text': '6'} ]
            keyboard_list.append(row_list)
            row_list = [ {'text': '7'}, {'text': '8'}, {'text': '9'} ]
            keyboard_list.append(row_list)
            row_list = [ {'text': '*'}, {'text': '0'}, {'text': '#'} ]
            keyboard_list.append(row_list)
        elif keypad_type == 'calculator':
            row_list = [ {'text': '7'}, {'text': '8'}, {'text': '9'}, {'text': '/'} ]
            keyboard_list.append(row_list)
            row_list = [ {'text': '4'}, {'text': '5'}, {'text': '6'}, {'text': '*'} ]
            keyboard_list.append(row_list)
            row_list = [ {'text': '1'}, {'text': '2'}, {'text': '3'}, {'text': '-'} ]
            keyboard_list.append(row_list)
            row_list = [ {'text': '0'}, {'text': '.'}, {'text': '='}, {'text': '+'} ]
            keyboard_list.append(row_list)
        keyboard_kwargs = {
            'keyboard': keyboard_list,
            'one_time_keyboard': not persist_buttons,
            'resize_keyboard': True
        }
        json_data = json.dumps(keyboard_kwargs)
        return json_data
def _compile_keypad ( self , keypad_type , persist_buttons ) : import json keyboard_list = [ ] if keypad_type == 'phone' : row_list = [ { 'text' : '1' } , { 'text' : '2' } , { 'text' : '3' } ] keyboard_list . append ( row_list ) row_list = [ { 'text' : '4' } , { 'text' : '5' } , { 'text' : '6' } ] keyboard_list . append ( row_list ) row_list = [ { 'text' : '7' } , { 'text' : '8' } , { 'text' : '9' } ] keyboard_list . append ( row_list ) row_list = [ { 'text' : '*' } , { 'text' : '0' } , { 'text' : '#' } ] keyboard_list . append ( row_list ) elif keypad_type == 'calculator' : row_list = [ { 'text' : '7' } , { 'text' : '8' } , { 'text' : '9' } , { 'text' : '/' } ] keyboard_list . append ( row_list ) row_list = [ { 'text' : '4' } , { 'text' : '5' } , { 'text' : '6' } , { 'text' : '*' } ] keyboard_list . append ( row_list ) row_list = [ { 'text' : '1' } , { 'text' : '2' } , { 'text' : '3' } , { 'text' : '-' } ] keyboard_list . append ( row_list ) row_list = [ { 'text' : '0' } , { 'text' : '.' } , { 'text' : '=' } , { 'text' : '+' } ] keyboard_list . append ( row_list ) keyboard_kwargs = { 'keyboard' : keyboard_list , 'one_time_keyboard' : not persist_buttons , 'resize_keyboard' : True } json_data = json . dumps ( keyboard_kwargs ) return json_data
a helper method to compile keypad buttons to telegram api format
a helper method to compile keypad buttons to telegram api format
''' a helper method to compile keypad buttons to telegram api format

        :param keypad_type: string with type of keypad to emulate
        :param persist_buttons: boolean to keep buttons around after exiting
        :return: string in json serial format
        '''
string in json serial format
string in json serial format
self
keypad_type
string with type of keypad to emulate
string with type of keypad to emulate
persist_buttons
boolean to keep buttons around after exiting
boolean to keep buttons around after exiting