trepan/bwprocessor/main.py
def _populate_commands(self):
        """ Create an instance of each of the debugger
        commands. Commands are found by importing files in the
        directory 'command'. Some files are excluded via an array set
        in __init__.  For each of the remaining files, we import them
        and scan for class names inside those files and for each class
        name, we will create an instance of that class. The set of
        DebuggerCommand class instances form set of possible debugger
        commands."""
        cmd_instances = []
        from trepan.bwprocessor import command as Mcommand
        eval_cmd_template = 'command_mod.%s(self)'
        for mod_name in Mcommand.__modules__:
            import_name = "command." + mod_name
            try:
                command_mod = getattr(__import__(import_name), mod_name)
            except:
                print('Error importing %s: %s' % (mod_name, sys.exc_info()[0]))
                continue

            classnames = [ tup[0] for tup in
                           inspect.getmembers(command_mod, inspect.isclass)
                           if ('DebuggerCommand' != tup[0] and
                               tup[0].endswith('Command')) ]
            for classname in classnames:
                eval_cmd = eval_cmd_template % classname
                try:
                    instance = eval(eval_cmd)
                    cmd_instances.append(instance)
                except:
                    print('Error loading %s from %s: %s' %
                          (classname, mod_name, sys.exc_info()[0]))
                    pass
                pass
            pass
        return cmd_instances
def _populate_commands(self):
        """ Create an instance of each of the debugger
        commands. Commands are found by importing files in the
        directory 'command'. Some files are excluded via an array set
        in __init__.  For each of the remaining files, we import them
        and scan for class names inside those files and for each class
        name, we will create an instance of that class. The set of
        DebuggerCommand class instances form set of possible debugger
        commands."""
        cmd_instances = []
        from trepan.bwprocessor import command as Mcommand
        eval_cmd_template = 'command_mod.%s(self)'
        for mod_name in Mcommand.__modules__:
            import_name = "command." + mod_name
            try:
                command_mod = getattr(__import__(import_name), mod_name)
            except:
                print('Error importing %s: %s' % (mod_name, sys.exc_info()[0]))
                continue

            classnames = [ tup[0] for tup in
                           inspect.getmembers(command_mod, inspect.isclass)
                           if ('DebuggerCommand' != tup[0] and
                               tup[0].endswith('Command')) ]
            for classname in classnames:
                eval_cmd = eval_cmd_template % classname
                try:
                    instance = eval(eval_cmd)
                    cmd_instances.append(instance)
                except:
                    print('Error loading %s from %s: %s' %
                          (classname, mod_name, sys.exc_info()[0]))
                    pass
                pass
            pass
        return cmd_instances
def _populate_commands ( self ) : cmd_instances = [ ] from trepan . bwprocessor import command as Mcommand eval_cmd_template = 'command_mod.%s(self)' for mod_name in Mcommand . __modules__ : import_name = "command." + mod_name try : command_mod = getattr ( __import__ ( import_name ) , mod_name ) except : print ( 'Error importing %s: %s' % ( mod_name , sys . exc_info ( ) [ 0 ] ) ) continue classnames = [ tup [ 0 ] for tup in inspect . getmembers ( command_mod , inspect . isclass ) if ( 'DebuggerCommand' != tup [ 0 ] and tup [ 0 ] . endswith ( 'Command' ) ) ] for classname in classnames : eval_cmd = eval_cmd_template % classname try : instance = eval ( eval_cmd ) cmd_instances . append ( instance ) except : print ( 'Error loading %s from %s: %s' % ( classname , mod_name , sys . exc_info ( ) [ 0 ] ) ) pass pass pass return cmd_instances
Create an instance of each of the debugger
        commands. Commands are found by importing files in the
        directory 'command'. Some files are excluded via an array set
        in __init__.  For each of the remaining files, we import them
        and scan for class names inside those files and for each class
        name, we will create an instance of that class. The set of
        DebuggerCommand class instances form set of possible debugger
        commands.
Create an instance of each of the debugger commands . Commands are found by importing files in the directory command . Some files are excluded via an array set in __init__ . For each of the remaining files we import them and scan for class names inside those files and for each class name we will create an instance of that class . The set of DebuggerCommand class instances form set of possible debugger commands .