if key not in self.__known_keys:
raise InvalidRestriction(key, match, "Key isn't valid")
- for cpv in self.keys():
+ for cpv in self.iterkeys():
cont = True
vals = self[cpv]
for key, match in restricts.iteritems():
else:
noise=verbose_instance
- dead_nodes = {}
- dead_nodes = dict.fromkeys(trg_cache.keys())
+ dead_nodes = set(trg_cache.iterkeys())
count=0
if not trg_cache.autocommits:
for x in valid_nodes_iterable:
# print "processing x=",x
count+=1
- if dead_nodes.has_key(x):
- del dead_nodes[x]
+ dead_nodes.discard(x)
try: entry = src_cache[x]
except KeyError, e:
noise.missing_entry(x)
except cache_errors.CacheError, ce:
noise.exception(ce)
del ce
- dead_nodes.clear()
noise.finish()
def perform_all(x, calc_prelink=0):
mydict = {}
- for k in hashfunc_map.keys():
+ for k in hashfunc_map:
mydict[k] = perform_checksum(x, hashfunc_map[k], calc_prelink)[0]
return mydict
got = " ".join(got)
return False, ("Insufficient data for checksum verification", got, expected)
- for x in mydict.keys():
+ for x in mydict:
if x == "size":
continue
- elif x in hashfunc_map.keys():
+ elif x in hashfunc_map:
myhash = perform_checksum(filename, x, calc_prelink=calc_prelink)[0]
if mydict[x] != myhash:
if strict:
if basedir and basedir[-1]!="/":
basedir=basedir+"/"
mylist=[]
- for myfile in entries["files"].keys():
+ for myfile in entries["files"]:
if "cvs" in entries["files"][myfile]["status"]:
if "0" == entries["files"][myfile]["revision"]:
mylist.append(basedir+myfile)
if recursive:
- for mydir in entries["dirs"].keys():
+ for mydir in entries["dirs"]:
mylist+=findnew(entries["dirs"][mydir],recursive,basedir+mydir)
return mylist
if basedir and basedir[-1]!="/":
basedir=basedir+"/"
mylist=[]
- for myfile in entries["files"].keys():
+ for myfile in entries["files"]:
if "cvs" in entries["files"][myfile]["status"]:
if "current" not in entries["files"][myfile]["status"]:
if "exists" in entries["files"][myfile]["status"]:
if entries["files"][myfile]["revision"]!="0":
mylist.append(basedir+myfile)
if recursive:
- for mydir in entries["dirs"].keys():
+ for mydir in entries["dirs"]:
mylist+=findchanged(entries["dirs"][mydir],recursive,basedir+mydir)
return mylist
if basedir and basedir[-1]!="/":
basedir=basedir+"/"
mylist=[]
- for myfile in entries["files"].keys():
+ for myfile in entries["files"]:
if "cvs" in entries["files"][myfile]["status"]:
if "exists" not in entries["files"][myfile]["status"]:
if "removed" not in entries["files"][myfile]["status"]:
mylist.append(basedir+myfile)
if recursive:
- for mydir in entries["dirs"].keys():
+ for mydir in entries["dirs"]:
mylist+=findmissing(entries["dirs"][mydir],recursive,basedir+mydir)
return mylist
mylist=[]
#ignore what cvs ignores.
- for myfile in entries["files"].keys():
+ for myfile in entries["files"]:
if "cvs" not in entries["files"][myfile]["status"]:
mylist.append(basedir+myfile)
if recursive:
- for mydir in entries["dirs"].keys():
+ for mydir in entries["dirs"]:
mylist+=findunadded(entries["dirs"][mydir],recursive,basedir+mydir)
return mylist
if basedir and basedir[-1]!="/":
basedir=basedir+"/"
mylist=[]
- for myfile in entries["files"].keys():
+ for myfile in entries["files"]:
if "removed" in entries["files"][myfile]["status"]:
mylist.append(basedir+myfile)
if recursive:
- for mydir in entries["dirs"].keys():
+ for mydir in entries["dirs"]:
mylist+=findremoved(entries["dirs"][mydir],recursive,basedir+mydir)
return mylist
# since it will provide no benefit due to the need to read CATEGORY
# from xpak.
if update_pkgindex and os.access(self.pkgdir, os.W_OK):
- cpv_all = self._pkg_paths.keys()
- stale = set(metadata).difference(cpv_all)
+ stale = [cpv for cpv in metadata if cpv not in self._pkg_paths]
for cpv in stale:
del metadata[cpv]
from portage.util import atomic_ofstream
if not hasattr(self, "auxdb"):
# unhandled exception thrown from constructor
return
- for x in self.auxdb.keys():
+ for x in self.auxdb:
self.auxdb[x].sync()
self.auxdb.clear()
repository ID's
TreeMap = {id: path}
"""
- return [k for k in self.treemap.keys() if k]
+ return [k for k in self.treemap if k]
def findname2(self, mycpv, mytree=None):
"""
returnme = []
for x in mylist:
if x == "INHERITED":
- returnme.append(' '.join(mydata.get("_eclasses_", {}).keys()))
+ returnme.append(' '.join(mydata.get("_eclasses_", [])))
else:
returnme.append(mydata.get(x,""))
def hasEntries(self):
""" Check if this registry contains any records. """
- return (len(self._data.keys()) > 0)
+ return len(self._data) > 0
def getPreservedLibs(self):
""" Return a mapping of packages->preserved objects.
@rtype Dict cpv->list-of-paths
"""
rValue = {}
- for cps in self._data.keys():
+ for cps in self._data:
rValue[self._data[cps][0]] = self._data[cps][2]
return rValue
else:
obj_dict[lib].append(mysplit[0])
mapfile = open(self._filename, "w")
- for lib in obj_dict.keys():
+ for lib in obj_dict:
mapfile.write(lib+" "+",".join(obj_dict[lib])+"\n")
mapfile.close()
# get list of libraries from old package instance
old_contents = self._installed_instance.getcontents().keys()
- old_libs = set([os.path.basename(x) for x in old_contents]).intersection(libmap.keys())
+ old_libs = set([os.path.basename(x) for x in old_contents]).intersection(libmap)
# get list of libraries from new package instance
- mylibs = set([os.path.basename(x) for x in mycontents]).intersection(libmap.keys())
+ mylibs = set([os.path.basename(x) for x in mycontents]).intersection(libmap)
# check which libs are present in the old, but not the new package instance
preserve_libs = old_libs.difference(mylibs)
def cp_all(self):
returnme=[]
- for x in self.cpdict.keys():
+ for x in self.cpdict:
returnme.extend(self.cpdict[x])
return returnme
"""Performs a function on each value of each key in a dictlist.
Returns a new dictlist."""
new_dl = {}
- for key in myDict.keys():
+ for key in myDict:
new_dl[key] = []
new_dl[key] = map(func,myDict[key])
return new_dl
for mydict in original_dicts:
if mydict is None:
continue
- for y in mydict.keys():
+ for y in mydict:
if not y in final_dict:
final_dict[y] = []
for x in mydict.values():
myfile.write(x+"\n")
else:
- for x in mydict.keys():
+ for x in mydict:
myfile.write("%s %s\n" % (x, " ".join(mydict[x])))
myfile.close()
except IOError: