#NEWLINE# def execute( self , arguments ) : #NEWLINE# #INDENT# parent = None #NEWLINE# current = self . command #NEWLINE# self . stack = [ ] #NEWLINE# while True : #NEWLINE# #INDENT# spec = self . specification ( of = current , via = parent ) #NEWLINE# self . stack . append ( spec ) #NEWLINE# arguments = self . expand ( arguments , via = spec ) #NEWLINE# ( args , kwargs , arguments ) = self . arguments ( arguments , via = spec ) #NEWLINE# if ( ( arguments and ( not spec . cls ) ) or ( spec . cls and arguments and ( arguments [ 0 ] [ 0 ] == '-' ) ) ) : #NEWLINE# #INDENT# raise MalformedArguments ( ( 'Unknown argument: ' + arguments [ 0 ] ) ) #NEWLINE# #UNINDENT# if ( len ( args ) < spec . range [ 0 ] ) : #NEWLINE# #INDENT# raise MalformedArguments ( 'Insufficient positional arguments.' ) #NEWLINE# #UNINDENT# if ( not spec . cls ) : #NEWLINE# #INDENT# return spec . callable ( * args , ** kwargs ) #NEWLINE# #UNINDENT# parent = spec . instance = spec . target ( * args , ** args ) #NEWLINE# if ( not arguments ) : #NEWLINE# #INDENT# raise MalformedArguments ( 'Command not specified.' ) #NEWLINE# #UNINDENT# current = getattr ( spec . instance , arguments . pop ( 0 ) )