@core_helper
def sorted_extras(package_extras, auto_clean=False, subs=None, exclude=None):
 if (not exclude):
  exclude = config.get('package_hide_extras', [])
 output = []
 for extra in sorted(package_extras, key=(lambda x: x['key'])):
  if (extra.get('state') == 'deleted'):
   continue
  (k, v) = (extra['key'], extra['value'])
  if (k in exclude):
   continue
  if (subs and (k in subs)):
   k = subs[k]
  elif auto_clean:
   k = k.replace('_', ' ').replace('-', ' ').title()
  if isinstance(v, (list, tuple)):
   v = ', '.join(map(unicode, v))
  output.append((k, v))
 return output

@ core_helper def sorted_extras ( package_extras , auto_clean = False , subs = None , exclude = None ) : if ( not exclude ) : exclude = config . get ( 'package_hide_extras' , [ ] ) output = [ ] for extra in sorted ( package_extras , key = ( lambda x : x [ 'key' ] ) ) : if ( extra . get ( 'state' ) == 'deleted' ) : continue ( k , v ) = ( extra [ 'key' ] , extra [ 'value' ] ) if ( k in exclude ) : continue if ( subs and ( k in subs ) ) : k = subs [ k ] elif auto_clean : k = k . replace ( '_' , ' ' ) . replace ( '-' , ' ' ) . title ( ) if isinstance ( v , ( list , tuple ) ) : v = ', ' . join ( map ( unicode , v ) ) output . append ( ( k , v ) ) return output
used for outputting package extras .