@@ -175,7 +175,14 @@ def __repr__(self):
175175 for k , v in sorted (self .items ()):
176176 if not first :
177177 outstr .append (', ' )
178- outstr .append ('%s=%r' % (k , v ))
178+ if isinstance (v , dict ):
179+ pairs = []
180+ for key , value in sorted (v .items ()):
181+ pairs .append ("'%s': %s" % (key , value ))
182+ v = '{' + ', ' .join (pairs ) + '}'
183+ outstr .append ('%s=%s' % (k , v ))
184+ else :
185+ outstr .append ('%s=%r' % (k , v ))
179186 first = False
180187 outstr .append (')' )
181188 return '' .join (outstr )
@@ -537,8 +544,8 @@ def get_hashval(self, hash_method=None):
537544
538545 """
539546
540- dict_withhash = {}
541- dict_nofilename = {}
547+ dict_withhash = []
548+ dict_nofilename = []
542549 for name , val in sorted (self .get ().items ()):
543550 if isdefined (val ):
544551 trait = self .trait (name )
@@ -548,24 +555,24 @@ def get_hashval(self, hash_method=None):
548555 False )
549556 and not has_metadata (trait .trait_type ,
550557 "name_source" ))
551- dict_nofilename [ name ] = \
558+ dict_nofilename . append (( name ,
552559 self ._get_sorteddict (val , hash_method = hash_method ,
553- hash_files = hash_files )
554- dict_withhash [ name ] = \
560+ hash_files = hash_files )))
561+ dict_withhash . append (( name ,
555562 self ._get_sorteddict (val , True , hash_method = hash_method ,
556- hash_files = hash_files )
557- return ( dict_withhash , md5 (str (dict_nofilename )).hexdigest () )
563+ hash_files = hash_files )))
564+ return dict_withhash , md5 (str (dict_nofilename )).hexdigest ()
558565
559566 def _get_sorteddict (self , object , dictwithhash = False , hash_method = None ,
560567 hash_files = True ):
561568 if isinstance (object , dict ):
562- out = {}
569+ out = []
563570 for key , val in sorted (object .items ()):
564571 if isdefined (val ):
565- out [ key ] = \
572+ out . append (( key ,
566573 self ._get_sorteddict (val , dictwithhash ,
567574 hash_method = hash_method ,
568- hash_files = hash_files )
575+ hash_files = hash_files )))
569576 elif isinstance (object , (list , tuple )):
570577 out = []
571578 for val in object :
@@ -1340,7 +1347,7 @@ class must be instantiated with a command argument
13401347 'environ': {'DISPLAY': ':1'}, 'args': '-al'}
13411348
13421349 >>> cli.inputs.get_hashval()
1343- ({ 'args': '-al'} , 'a2f45e04a34630c5f33a75ea2a533cdd ')
1350+ ([( 'args', '-al')] , '11c37f97649cd61627f4afe5136af8c0 ')
13441351
13451352 """
13461353
0 commit comments