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 /aptsources | |
| parent | 7b14352c54b7acbf2a68240fa960e188c6e8742a (diff) | |
| download | python-apt-75676866d4bf394b3ba1ddef06e0c93f6da03242.tar.gz | |
'mapping.has_key' is deprecated, use current Python 'key in mapping' idiom.
Diffstat (limited to 'aptsources')
| -rw-r--r-- | aptsources/distinfo.py | 6 | ||||
| -rw-r--r-- | aptsources/distro.py | 12 | ||||
| -rw-r--r-- | aptsources/sourceslist.py | 4 |
3 files changed, 11 insertions, 11 deletions
diff --git a/aptsources/distinfo.py b/aptsources/distinfo.py index a309a548..74a280ae 100644 --- a/aptsources/distinfo.py +++ b/aptsources/distinfo.py @@ -61,7 +61,7 @@ class Template: def is_mirror(self, url): ''' Check if a given url of a repository is a valid mirror ''' proto, hostname, dir = split_url(url) - if self.mirror_set.has_key(hostname): + if hostname in self.mirror_set: return self.mirror_set[hostname].has_repository(proto, dir) else: return False @@ -224,7 +224,7 @@ class DistInfo: template.match_uri = value elif (field == 'MirrorsFile' or field == 'MirrorsFile-%s' % self.arch): - if not map_mirror_sets.has_key(value): + if value not in map_mirror_sets: mirror_set = {} try: mirror_data = filter(match_mirror_line.match, @@ -237,7 +237,7 @@ class DistInfo: location = match_loc.sub(r"\1", line) continue (proto, hostname, dir) = split_url(line) - if mirror_set.has_key(hostname): + if hostname in mirror_set: mirror_set[hostname].add_repository(proto, dir) else: mirror_set[hostname] = Mirror( diff --git a/aptsources/distro.py b/aptsources/distro.py index 0bf8aba9..350feb65 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() diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py index be17cd1f..a0346267 100644 --- a/aptsources/sourceslist.py +++ b/aptsources/sourceslist.py @@ -368,7 +368,7 @@ class SourcesList: open(path, "w").write(header) return for source in self.list: - if not files.has_key(source.file): + if source.file not in files: files[source.file] = open(source.file, "w") files[source.file].write(source.str()) for f in files: @@ -386,7 +386,7 @@ class SourcesList: # source entries if source.template.child == True: key = source.template - if not used_child_templates.has_key(key): + if key not in used_child_templates: used_child_templates[key] = [] temp = used_child_templates[key] temp.append(source) |
