#NEWLINE# def _load_commands( self , extension ) : #NEWLINE# #INDENT# ' Load the command objects for the given extension.\n\n        Parameters\n        ----------\n        extension : Extension\n            The extension object of interest.\n\n        Returns\n        -------\n        result : list\n            The list of Command objects declared by the extension.\n\n        ' #NEWLINE# workbench = self . workbench #NEWLINE# commands = extension . get_children ( Command ) #NEWLINE# if ( extension . factory is not None ) : #NEWLINE# #INDENT# for item in extension . factory ( workbench ) : #NEWLINE# #INDENT# if ( not isinstance ( item , Command ) ) : #NEWLINE# #INDENT# msg = "extension '%s' created non-Command of type '%s'" #NEWLINE# args = ( extension . qualified_id , type ( item ) . __name__ ) #NEWLINE# raise TypeError ( ( msg % args ) ) #NEWLINE# #UNINDENT# commands . append ( item ) #NEWLINE# #UNINDENT# #UNINDENT# return commands