(self, command: str, command_vars: list)
return Variable(f'self.{func_name}', created_func)
Generates a command attached to a python function that allows special variables.
Generates a command attached to a python function that allows special variables.
Generates a command attached to a python function that allows special variables .
def generate_mod_command_func(self, command: str, command_vars: list):
        '''
        Generates a command attached to a python function that allows special variables.
        '''
        new_command = command.replace('?',  '{}')
        modified_vars = [command_var_format(item) for item in command_vars]
        final_str = ', '.join(modified_vars)
        func_name = 'method_handler{}'.format(self.counter)
        replace_func = """.format({})""".format(final_str)
        created_func = ExistingCode.COMMAND_HANDLER_TEMPLATE.value.format(
            func_name, new_command, replace_func)

        self.counter += 1

        return Variable(f'self.{func_name}', created_func)
def generate_mod_command_func ( self , command : str , command_vars : list ) : new_command = command . replace ( '?' , '{}' ) modified_vars = [ command_var_format ( item ) for item in command_vars ] final_str = ', ' . join ( modified_vars ) func_name = 'method_handler{}' . format ( self . counter ) replace_func = """.format({})""" . format ( final_str ) created_func = ExistingCode . COMMAND_HANDLER_TEMPLATE . value . format ( func_name , new_command , replace_func ) self . counter += 1 return Variable ( f'self.{func_name}' , created_func )