summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-01-11 19:53:01 +0100
committerJulian Andres Klode <jak@debian.org>2009-01-11 19:53:01 +0100
commitc94a512af6836c4d8f3835a5a6b3719ad7245249 (patch)
treeb7e26af9a794cdc8a81fcbd42aa34c36ad645e92 /doc
parentb237760c6d7009f9833b86e6dbfc3cbf6d059977 (diff)
parent75676866d4bf394b3ba1ddef06e0c93f6da03242 (diff)
downloadpython-apt-c94a512af6836c4d8f3835a5a6b3719ad7245249.tar.gz
* Merge Ben Finney's do not use has_key() (Closes: #481878)
A little bit adjusted to not remove the has_key() methods, and to use has_key() where needed [the low-level part does not have the needed functionality for 'key in mapping'].
Diffstat (limited to 'doc')
-rw-r--r--doc/examples/all_deps.py4
-rwxr-xr-xdoc/examples/configisc.py2
-rwxr-xr-xdoc/examples/records.py2
3 files changed, 4 insertions, 4 deletions
diff --git a/doc/examples/all_deps.py b/doc/examples/all_deps.py
index e8c9eaaf..0a2f3157 100644
--- a/doc/examples/all_deps.py
+++ b/doc/examples/all_deps.py
@@ -10,10 +10,10 @@ def dependencies(cache, pkg, deps, key="Depends"):
if candver == None:
return deps
dependslist = candver.DependsList
- if dependslist.has_key(key):
+ if key in dependslist:
for depVerList in dependslist[key]:
for dep in depVerList:
- if cache.has_key(dep.TargetPkg.Name):
+ if dep.TargetPkg.Name in cache:
if pkg.name != dep.TargetPkg.Name and \
not dep.TargetPkg.Name in deps:
deps.add(dep.TargetPkg.Name)
diff --git a/doc/examples/configisc.py b/doc/examples/configisc.py
index 1d5965f5..de8ec6be 100755
--- a/doc/examples/configisc.py
+++ b/doc/examples/configisc.py
@@ -27,7 +27,7 @@ apt_pkg.ReadConfigFileISC(Cnf, ConfigFile[0])
# print "%s \"%s\";" % (I, Cnf[I])
# bind8 config file..
-if Cnf.has_key("Zone"):
+if Cnf.Exists("Zone"):
print "Zones: ", Cnf.SubTree("zone").List()
for I in Cnf.List("zone"):
SubCnf = Cnf.SubTree(I)
diff --git a/doc/examples/records.py b/doc/examples/records.py
index a7a87727..a0fc8dc4 100755
--- a/doc/examples/records.py
+++ b/doc/examples/records.py
@@ -7,7 +7,7 @@ cache = apt.Cache()
for pkg in cache:
if not pkg.candidateRecord:
continue
- if pkg.candidateRecord.has_key("Task"):
+ if "Task" in pkg.candidateRecord:
print "Pkg %s is part of '%s'" % (
pkg.name, pkg.candidateRecord["Task"].split())
#print pkg.candidateRecord