def _iter_unit_summary(namespace):
 from . import core
 units = []
 has_prefixes = set()
 for (key, val) in six.iteritems(namespace):
  if (not isinstance(val, core.UnitBase)):
   continue
  if (key != val.name):
   continue
  if isinstance(val, core.PrefixUnit):
   has_prefixes.add(val._represents.bases[0].name)
  else:
   units.append(val)
 units.sort(key=(lambda x: x.name.lower()))
 for unit in units:
  doc = _get_first_sentence(unit.__doc__).strip()
  represents = u''
  if isinstance(unit, core.Unit):
   represents = u':math:`{0}`'.format(unit._represents.to_string(u'latex')[1:(-1)])
  aliases = u', '.join((u'``{0}``'.format(x) for x in unit.aliases))
  (yield (unit, doc, represents, aliases, (unit.name in has_prefixes)))

def _iter_unit_summary ( namespace ) : from . import core units = [ ] has_prefixes = set ( ) for ( key , val ) in six . iteritems ( namespace ) : if ( not isinstance ( val , core . UnitBase ) ) : continue if ( key != val . name ) : continue if isinstance ( val , core . PrefixUnit ) : has_prefixes . add ( val . _represents . bases [ 0 ] . name ) else : units . append ( val ) units . sort ( key = ( lambda x : x . name . lower ( ) ) ) for unit in units : doc = _get_first_sentence ( unit . __doc__ ) . strip ( ) represents = u'' if isinstance ( unit , core . Unit ) : represents = u':math:`{0}`' . format ( unit . _represents . to_string ( u'latex' ) [ 1 : ( - 1 ) ] ) aliases = u', ' . join ( ( u'``{0}``' . format ( x ) for x in unit . aliases ) ) ( yield ( unit , doc , represents , aliases , ( unit . name in has_prefixes ) ) )
generates the tuple used to format the unit summary docs in generate_unit_summary .