def sorted_tree_items(entries, name_order):
 key_func = ((name_order and key_entry_name_order) or key_entry)
 for (name, entry) in sorted(entries.items(), key=key_func):
  (mode, hexsha) = entry
  mode = int(mode)
  if (not isinstance(hexsha, bytes)):
   raise TypeError(('Expected bytes for SHA, got %r' % hexsha))
  (yield TreeEntry(name, mode, hexsha))

def sorted_tree_items ( entries , name_order ) : key_func = ( ( name_order and key_entry_name_order ) or key_entry ) for ( name , entry ) in sorted ( entries . items ( ) , key = key_func ) : ( mode , hexsha ) = entry mode = int ( mode ) if ( not isinstance ( hexsha , bytes ) ) : raise TypeError ( ( 'Expected bytes for SHA, got %r' % hexsha ) ) ( yield TreeEntry ( name , mode , hexsha ) )
iterate over a tree entries dictionary .