summaryrefslogtreecommitdiff
path: root/aptsources/distro.py
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 /aptsources/distro.py
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 'aptsources/distro.py')
-rw-r--r--aptsources/distro.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/aptsources/distro.py b/aptsources/distro.py
index 4d6b7acf..a8f1d0fd 100644
--- a/aptsources/distro.py
+++ b/aptsources/distro.py
@@ -187,7 +187,7 @@ class Distribution:
if mirror_template:
self.nearest_server = mirror_template % country_code
- if self.countries.has_key(country_code):
+ if country_code in self.countries:
self.country = self.countries[country_code]
self.country_code = country_code
@@ -199,7 +199,7 @@ class Distribution:
l = server.find(".archive.ubuntu.com")
if i != -1 and l != -1:
country = server[i+len("://"):l]
- if self.countries.has_key(country):
+ if country in self.countries:
# TRANSLATORS: %s is a country
return _("Server for %s") % \
gettext.dgettext("iso_3166",
@@ -292,7 +292,7 @@ class Distribution:
"""
# if we don't that distro, just reutnr (can happen for e.g.
# dapper-update only in deb-src
- if not comps_per_dist.has_key(source.dist):
+ if source.dist not in comps_per_dist:
return
# if we have seen this component already for this distro,
# return (nothing to do
@@ -311,12 +311,12 @@ class Distribution:
comps_per_sdist = {}
for s in sources:
if s.type == self.binary_type:
- if not comps_per_dist.has_key(s.dist):
+ if s.dist not in comps_per_dist:
comps_per_dist[s.dist] = set()
map(comps_per_dist[s.dist].add, s.comps)
for s in self.source_code_sources:
if s.type == self.source_type:
- if not comps_per_sdist.has_key(s.dist):
+ if s.dist not in comps_per_sdist:
comps_per_sdist[s.dist] = set()
map(comps_per_sdist[s.dist].add, s.comps)
@@ -412,7 +412,7 @@ class DebianDistribution(Distribution):
l = server.find(".debian.org")
if i != -1 and l != -1:
country = server[i+len("://ftp."):l]
- if self.countries.has_key(country):
+ if country in self.countries:
# TRANSLATORS: %s is a country
return _("Server for %s") % gettext.dgettext(
"iso_3166", self.countries[country].rstrip()).rstrip()