diff options
| author | Julian Andres Klode <jak@debian.org> | 2009-04-13 18:27:43 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2009-04-13 18:27:43 +0200 |
| commit | 506cb021d62e643fba38ddb4b84572a86cb3a3ba (patch) | |
| tree | 364b053d1560897d5b24dfd8950df341f0f63288 /apt | |
| parent | 6c3e74bdf3a8bd6aced0a2ddb38c1cc7b22ec655 (diff) | |
| download | python-apt-506cb021d62e643fba38ddb4b84572a86cb3a3ba.tar.gz | |
* python/tag.cc: Support 'key in mapping' for TagSections
Support the replacement of mapping.has_key() for sections, and
update the usage in apt/package.py and apt/debfile accordingly.
This is implemented by extending the TagSecType with sequence
methods, but only settings the contains method there.
The TagSecGetAttr() function has been removed and replaced by
the use of the tp_methods slot.
Diffstat (limited to 'apt')
| -rw-r--r-- | apt/debfile.py | 10 | ||||
| -rw-r--r-- | apt/package.py | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/apt/debfile.py b/apt/debfile.py index 0406a250..8d4f534c 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -463,18 +463,18 @@ class DscSrcPackage(DebPackage): try: while tagfile.Step() == 1: for tag in depends_tags: - if not sec.has_key(tag): + if not tag in sec: continue self._depends.extend(apt_pkg.ParseSrcDepends(sec[tag])) for tag in conflicts_tags: - if not sec.has_key(tag): + if not tag in sec: continue self._conflicts.extend(apt_pkg.ParseSrcDepends(sec[tag])) - if sec.has_key('Source'): + if 'Source' in sec: self.pkgname = sec['Source'] - if sec.has_key('Binary'): + if 'Binary' in sec: self.binaries = sec['Binary'].split(', ') - if sec.has_key('Version'): + if 'Version' in sec: self._sections['Version'] = sec['Version'] finally: del sec diff --git a/apt/package.py b/apt/package.py index ec88a456..e308da4b 100644 --- a/apt/package.py +++ b/apt/package.py @@ -157,7 +157,7 @@ class Record(object): return self._rec[key] def __contains__(self, key): - return self._rec.has_key(key) + return key in self._rec def __iter__(self): return iter(self._rec.keys()) @@ -176,7 +176,7 @@ class Record(object): def has_key(self, key): """deprecated form of 'key in x'.""" - return self._rec.has_key(key) + return key in self._rec class Version(object): |
