summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBrian May <brian@linuxpenguins.xyz>2018-08-20 17:02:59 +1000
committerBrian May <brian@linuxpenguins.xyz>2018-08-20 17:03:53 +1000
commit85592e7c4627fd355fee2a7d322360f51d7c08c0 (patch)
treeca3ce3f8db23d27966c756f9f8544cb0b92a696a /lib
parentb92c7cf1a42bd1588e7788a63bae735b65b27513 (diff)
Replace "x.has_key(y)" with "y in x" syntax
Diffstat (limited to 'lib')
-rw-r--r--lib/python/bugs.py4
-rw-r--r--lib/python/debian_support.py2
-rw-r--r--lib/python/dist_config.py2
-rw-r--r--lib/python/nvd.py6
-rw-r--r--lib/python/sectracker/repo.py2
-rw-r--r--lib/python/security_db.py6
-rw-r--r--lib/python/web_support.py10
7 files changed, 16 insertions, 16 deletions
diff --git a/lib/python/bugs.py b/lib/python/bugs.py
index 93bef74604..700a9c0272 100644
--- a/lib/python/bugs.py
+++ b/lib/python/bugs.py
@@ -31,7 +31,7 @@ def listUrgencies():
Urgency.urgencies = urgencies
return urgencies
def internUrgency(name, urgencies=listUrgencies()):
- if urgencies.has_key(name):
+ if name in urgencies:
return urgencies[name]
else:
return None
@@ -282,7 +282,7 @@ class Bug(BugBase):
notes = {}
for n in self.notes:
key = (n.package, n.release)
- if notes.has_key(key):
+ if key in notes:
notes[key].merge(n)
else:
notes[key] = n
diff --git a/lib/python/debian_support.py b/lib/python/debian_support.py
index 26ce3507cf..ebe20f8184 100644
--- a/lib/python/debian_support.py
+++ b/lib/python/debian_support.py
@@ -201,7 +201,7 @@ def listReleases():
Release.releases = releases
return releases
def internRelease(name, releases=listReleases()):
- if releases.has_key(name):
+ if name in releases:
return releases[name]
else:
return None
diff --git a/lib/python/dist_config.py b/lib/python/dist_config.py
index 2a3e8c6977..a5b7185dc0 100644
--- a/lib/python/dist_config.py
+++ b/lib/python/dist_config.py
@@ -80,7 +80,7 @@ def add_release(name, architectures,
overview_part=('', 'security', 'proposed-updates')):
import debian_support
name = debian_support.internRelease(name)
- if releases.has_key(name):
+ if name in releases:
raise ValueError("duplicate release", name)
releases[name] = {'architectures' : architectures,
'purpose' : {'debsecan' : debsecan_part,
diff --git a/lib/python/nvd.py b/lib/python/nvd.py
index 8110fc73ab..1e0771e13d 100644
--- a/lib/python/nvd.py
+++ b/lib/python/nvd.py
@@ -68,11 +68,11 @@ class _Parser(xml.sax.handler.ContentHandler):
def TAG_int(self, name, attrs):
self.loss_int = 1
def TAG_sec_prot(self, name, attrs):
- if attrs.has_key('user'):
+ if 'user' in attrs:
self.loss_sec_prot_user = 1
- if attrs.has_key('admin'):
+ if 'admin' in attrs:
self.loss_sec_prot_admin = 1
- if attrs.has_key('other'):
+ if 'other' in attrs:
self.loss_sec_prot_other = 1
def endElement(self, name):
diff --git a/lib/python/sectracker/repo.py b/lib/python/sectracker/repo.py
index a108de8c3b..7e6d454f51 100644
--- a/lib/python/sectracker/repo.py
+++ b/lib/python/sectracker/repo.py
@@ -272,7 +272,7 @@ class Config(object):
raise ValueError(
"distributions[%r][%r] (%r) not a valid repository"
% (d, m, mem))
- if dobj.has_key("release"):
+ if "release" in dobj:
rel = dobj["release"]
if rel in self.releases:
raise ValueError(
diff --git a/lib/python/security_db.py b/lib/python/security_db.py
index 84f62f0d65..3c75fa7f5e 100644
--- a/lib/python/security_db.py
+++ b/lib/python/security_db.py
@@ -819,7 +819,7 @@ class DB:
% (arch, name))
key = (name, release, subrelease, archive, version,
source, source_version)
- if packages.has_key(key):
+ if key in packages:
packages[key][arch] = 1
else:
packages[key] = {arch : 1}
@@ -2038,7 +2038,7 @@ class DB:
# a VERSION, or None.
if cache is not None:
sp = (release, pkg)
- if cache.has_key(sp):
+ if sp in cache:
d = cache[sp]
if d.__class__ == dict:
return d.get(purpose, None)
@@ -2060,7 +2060,7 @@ class DB:
for (purpose, permitted) in purposes.items():
if part not in permitted:
continue
- if results.has_key(purpose):
+ if purpose in results:
oldver = results[purpose]
if ver <= oldver:
continue
diff --git a/lib/python/web_support.py b/lib/python/web_support.py
index dc54c5b07a..c320ff033c 100644
--- a/lib/python/web_support.py
+++ b/lib/python/web_support.py
@@ -547,7 +547,7 @@ class PathRouter:
for x in range(len(p)):
element = p[x]
if element:
- if m.has_key(element):
+ if element in m:
m = m[element]
else:
if element == '*':
@@ -587,18 +587,18 @@ class PathRouter:
try:
m = m[element]
except KeyError:
- if x + 1 == l and m.has_key('*'):
+ if x + 1 == l and '*' in m:
# Use '*' only if the remaining path is empty.
return (m['*'], tuple(p[x:]))
- if m.has_key('**'):
+ if '**' in m:
return (m['**'], tuple(p[x:]))
raise InvalidPath()
try:
result = m['']
except KeyError:
- if m.has_key('*'):
+ if '*' in m:
result = m['*']
- elif m.has_key('**'):
+ elif '**' in m:
result = m['**']
else:
raise InvalidPath()

© 2014-2024 Faster IT GmbH | imprint | privacy policy