#NEWLINE# def __add__( self , cmdset_b ) : #NEWLINE# #INDENT# "\n        Merge this cmdset (A) with another cmdset (B) using the + operator,\n\n        C = A + B\n\n        Here, we (by convention) say that 'A is merged onto B to form\n        C'.  The actual merge operation used in the 'addition' depends\n        on which priorities A and B have. The one of the two with the\n        highest priority will apply and give its properties to C. In\n        the case of a tie, A takes priority and replaces the\n        same-named commands in B unless A has the 'duplicate' variable\n        set (which means both sets' commands are kept).\n        " #NEWLINE# if ( not cmdset_b ) : #NEWLINE# #INDENT# return self #NEWLINE# #UNINDENT# sys_commands_a = self . get_system_cmds ( ) #NEWLINE# sys_commands_b = cmdset_b . get_system_cmds ( ) #NEWLINE# if ( self . priority >= cmdset_b . priority ) : #NEWLINE# #INDENT# sys_commands = ( sys_commands_a + [ cmd for cmd in sys_commands_b if ( cmd not in sys_commands_a ) ] ) #NEWLINE# mergetype = self . key_mergetypes . get ( cmdset_b . key , self . mergetype ) #NEWLINE# if ( mergetype == 'Intersect' ) : #NEWLINE# #INDENT# cmdset_c = self . _intersect ( self , cmdset_b ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( sys_commands == 'Replace' ) : #NEWLINE# #INDENT# cmdset_c = self . _replace ( self , cmdset_b ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( mergetype == 'Remove' ) : #NEWLINE# #INDENT# cmdset_c = self . _remove ( self , cmdset_b ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# cmdset_c = self . _union ( self , cmdset_b ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# cmdset_c . no_channels = ( cmdset_b . no_channels if ( self . no_channels is None ) else self . no_channels ) #NEWLINE# cmdset_c . no_exits = ( cmdset_b . no_exits if ( self . no_exits is None ) else self . no_exits ) #NEWLINE# cmdset_c . no_objs = ( cmdset_b . no_objs if ( self . no_objs is None ) else self . no_objs ) #NEWLINE# cmdset_c . duplicates = ( cmdset_b . duplicates if ( self . duplicates is None ) else self . duplicates ) #NEWLINE# if self . key . startswith ( '_' ) : #NEWLINE# #INDENT# cmdset_c . key = cmdset_b . key #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# sys_commands = ( sys_commands_b + [ cmd for cmd in sys_commands_a if ( cmd not in sys_commands_b ) ] ) #NEWLINE# mergetype = cmdset_b . key_mergetypes . get ( self . key , cmdset_b . mergetype ) #NEWLINE# if ( mergetype == 'Intersect' ) : #NEWLINE# #INDENT# cmdset_c = self . _intersect ( cmdset_b , self ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( mergetype == 'Replace' ) : #NEWLINE# #INDENT# cmdset_c = self . _replace ( cmdset_b , self ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( mergetype == 'Remove' ) : #NEWLINE# #INDENT# cmdset_c = self . _remove ( cmdset_b , self ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# cmdset_c = self . _union ( cmdset_b , self ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# cmdset_c . no_channels = cmdset_b . no_channels #NEWLINE# cmdset_c . no_exits = cmdset_b . no_exits #NEWLINE# cmdset_c . no_objs = cmdset_b . no_objs #NEWLINE# cmdset_c . no_channels = ( self . no_channels if ( self . no_channels is None ) else cmdset_b . no_channels ) #NEWLINE# cmdset_c . no_exits = ( self . no_exits if ( self . no_exits is None ) else cmdset_b . no_exits ) #NEWLINE# cmdset_c . no_objs = ( self . no_objs if ( self . no_objs is None ) else cmdset_b . no_objs ) #NEWLINE# cmdset_c . duplicates = ( self . duplicates if ( self . duplicates is None ) else cmdset_b . duplicates ) #NEWLINE# if cmdset_b . key . startswith ( '_' ) : #NEWLINE# #INDENT# cmdset_c . key = self . key #NEWLINE# #UNINDENT# #UNINDENT# cmdset_c . actual_mergetype = mergetype #NEWLINE# cmdset_c . add ( sys_commands ) #NEWLINE# return cmdset_c