diff options
| author | Ben Finney <ben+debian@benfinney.id.au> | 2008-08-08 10:27:33 +1000 |
|---|---|---|
| committer | Ben Finney <ben+debian@benfinney.id.au> | 2008-08-08 10:27:33 +1000 |
| commit | 75676866d4bf394b3ba1ddef06e0c93f6da03242 (patch) | |
| tree | 7c28bf07c3500001e632d3859ef3b3853bc5fe4f /doc/examples | |
| parent | 7b14352c54b7acbf2a68240fa960e188c6e8742a (diff) | |
| download | python-apt-75676866d4bf394b3ba1ddef06e0c93f6da03242.tar.gz | |
'mapping.has_key' is deprecated, use current Python 'key in mapping' idiom.
Diffstat (limited to 'doc/examples')
| -rw-r--r-- | doc/examples/all_deps.py | 4 | ||||
| -rwxr-xr-x | doc/examples/configisc.py | 2 | ||||
| -rwxr-xr-x | doc/examples/records.py | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/doc/examples/all_deps.py b/doc/examples/all_deps.py index 2feeb125..2ed0207f 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 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..dc3c2f33 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 "Zone" in Cnf: 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 |
