@@ -298,34 +298,30 @@ def _show_collect_results(self):
298298
299299 # ---------------- New helpers for verbose group printing ---------------- #
300300
301- def _normalize_array (self , maybe ):
302- """Normalize possibly-stringified arrays into a python list."""
303- if maybe is None :
304- return []
305- if isinstance (maybe , list ):
306- return maybe
307- if isinstance (maybe , (str , bytes )):
308- try :
309- parsed = json .loads (maybe )
310- return parsed if isinstance (parsed , list ) else []
311- except Exception :
312- return []
313- return []
314-
315301 def _print_verbose_group (self , label , items ):
316302 """Print one verbose group (Created/Updated/etc) in a readable format."""
317- arr = self ._normalize_array (items )
318- if not arr :
303+ if not items :
319304 return
320- Color .echo ('' )
321- Color .echo (' [high]{label}:[end] [warn]{n}[end]' .format (
322- label = label , n = len (arr )
323- ))
324- for item in arr :
325- string = item .get ('string' , '' )
326- occurrences = item .get ('occurrences' , [])
327- Color .echo (' └─ {}' .format (json .dumps (string )))
328- Color .echo (' └─ occurrences: {}' .format (json .dumps (occurrences )))
305+
306+ file_list = '\n ' .join (
307+ [
308+ u'[pink]{}.[end] {}' .format ((cnt + 1 ), string_repr (x ))
309+ for cnt , x in enumerate (
310+ items .values ()
311+ )
312+ ]
313+ )
314+ print (file_list )
315+ Color .echo (file_list )
316+ # Color.echo('')
317+ # Color.echo(' [high]{label}:[end] [warn]{n}[end]'.format(
318+ # label=label, n=len(arr)
319+ # ))
320+ # for item in arr:
321+ # string = item.get('string', '')
322+ # occurrences = item.get('occurrences', [])
323+ # Color.echo(' └─ {}'.format(json.dumps(string)))
324+ # Color.echo(' └─ occurrences: {}'.format(json.dumps(occurrences)))
329325
330326 # ------------------------------------------------------------------------ #
331327
0 commit comments