def dead_items(vfs_top, paths):
 dead_branches = {}
 dead_saves = {}
 for path in paths:
  try:
   n = vfs_top.lresolve(path)
  except vfs.NodeError as e:
   add_error(('unable to resolve %s: %s' % (path, e)))
  else:
   if isinstance(n, vfs.BranchList):
    branchname = n.name
    dead_branches[branchname] = n
    dead_saves.pop(branchname, None)
   elif (isinstance(n, vfs.FakeSymlink) and isinstance(n.parent, vfs.BranchList)):
    if (n.name == 'latest'):
     add_error("error: cannot delete 'latest' symlink")
    else:
     branchname = n.parent.name
     if (branchname not in dead_branches):
      dead_saves.setdefault(branchname, []).append(n)
   else:
    add_error(("don't know how to remove %r yet" % n.fullname()))
 if saved_errors:
  return (None, None)
 return (dead_branches, dead_saves)

def dead_items ( vfs_top , paths ) : dead_branches = { } dead_saves = { } for path in paths : try : n = vfs_top . lresolve ( path ) except vfs . NodeError as e : add_error ( ( 'unable to resolve %s: %s' % ( path , e ) ) ) else : if isinstance ( n , vfs . BranchList ) : branchname = n . name dead_branches [ branchname ] = n dead_saves . pop ( branchname , None ) elif ( isinstance ( n , vfs . FakeSymlink ) and isinstance ( n . parent , vfs . BranchList ) ) : if ( n . name == 'latest' ) : add_error ( "error: cannot delete 'latest' symlink" ) else : branchname = n . parent . name if ( branchname not in dead_branches ) : dead_saves . setdefault ( branchname , [ ] ) . append ( n ) else : add_error ( ( "don't know how to remove %r yet" % n . fullname ( ) ) ) if saved_errors : return ( None , None ) return ( dead_branches , dead_saves )
return an optimized set of removals .