#NEWLINE# def cli_commands( obj , namef , clizer ) : #NEWLINE# #INDENT# cmds = util . OrderedDict ( ) #NEWLINE# cmd_by_name = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# try : #NEWLINE# #INDENT# names = util . dict_from_names ( obj ) . items ( ) #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# raise ValueError ( 'Cannot guess name for anonymous objects (lists, dicts, etc)' ) #NEWLINE# #UNINDENT# for ( key , val ) in names : #NEWLINE# #INDENT# if ( not key ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# names = tuple ( ( namef ( name ) for name in util . maybe_iter ( key ) ) ) #NEWLINE# cli = clizer . get_cli ( val ) #NEWLINE# cmds [ names ] = cli #NEWLINE# for name in names : #NEWLINE# #INDENT# cmd_by_name [ name ] = key #NEWLINE# #UNINDENT# #UNINDENT# return ( cmds , cmd_by_name )