@register.filter
def sigsort(l):
 if (not l):
  return
 for x in l:
  if (x.get('type', x.get('_type')) == 'generic'):
   (yield x)
 for x in l:
  if (x.get('type', x.get('_type')) == 'ioc'):
   (yield x)
 first = True
 for x in l:
  if (x.get('type', x.get('_type')) == 'call'):
   if first:
    x['first'] = True
    first = False
   (yield x)

@ register . filter def sigsort ( l ) : if ( not l ) : return for x in l : if ( x . get ( 'type' , x . get ( '_type' ) ) == 'generic' ) : ( yield x ) for x in l : if ( x . get ( 'type' , x . get ( '_type' ) ) == 'ioc' ) : ( yield x ) first = True for x in l : if ( x . get ( 'type' , x . get ( '_type' ) ) == 'call' ) : if first : x [ 'first' ] = True first = False ( yield x )
sort signatures entries .