#NEWLINE# def make_unique( self , caller ) : #NEWLINE# #INDENT# '\n        Remove duplicate command-keys (unsafe)\n\n        Args:\n            caller (object): Commands on this object will\n                get preference in the duplicate removal.\n\n        Notes:\n            This is an unsafe command meant to clean out a cmdset of\n            doublet commands after it has been created. It is useful\n            for commands inheriting cmdsets from the cmdhandler where\n            obj-based cmdsets always are added double. Doublets will\n            be weeded out with preference to commands defined on\n            caller, otherwise just by first-come-first-served.\n\n        ' #NEWLINE# unique = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for cmd in self . commands : #NEWLINE# #INDENT# if ( cmd . key in unique ) : #NEWLINE# #INDENT# ocmd = unique [ cmd . key ] #NEWLINE# if ( ( hasattr ( cmd , 'obj' ) and ( cmd . obj == caller ) ) and ( not ( hasattr ( ocmd , 'obj' ) and ( ocmd . obj == caller ) ) ) ) : #NEWLINE# #INDENT# unique [ cmd . key ] = cmd #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# unique [ cmd . key ] = cmd #NEWLINE# #UNINDENT# #UNINDENT# self . commands = listvalues ( unique )