summaryrefslogtreecommitdiffstats
path: root/Lib/xmllib.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2002-06-01 14:18:47 (GMT)
committerRaymond Hettinger <python@rcn.com>2002-06-01 14:18:47 (GMT)
commit54f0222547b1e92cd018ef132307a6f793dc9505 (patch)
tree667480d89feb3f9c7ca44e4ffa7bf39e725c120d /Lib/xmllib.py
parent9d5e4aa4149edb92f6d28c9390d776ae4a1d719a (diff)
downloadcpython-54f0222547b1e92cd018ef132307a6f793dc9505.zip
cpython-54f0222547b1e92cd018ef132307a6f793dc9505.tar.gz
cpython-54f0222547b1e92cd018ef132307a6f793dc9505.tar.bz2
SF 563203. Replaced 'has_key()' with 'in'.
Diffstat (limited to 'Lib/xmllib.py')
-rw-r--r--Lib/xmllib.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/Lib/xmllib.py b/Lib/xmllib.py
index 445ab13..c261a26 100644
--- a/Lib/xmllib.py
+++ b/Lib/xmllib.py
@@ -102,15 +102,15 @@ class XMLParser:
# Interface -- initialize and reset this instance
def __init__(self, **kw):
self.__fixed = 0
- if kw.has_key('accept_unquoted_attributes'):
+ if 'accept_unquoted_attributes' in kw:
self.__accept_unquoted_attributes = kw['accept_unquoted_attributes']
- if kw.has_key('accept_missing_endtag_name'):
+ if 'accept_missing_endtag_name' in kw:
self.__accept_missing_endtag_name = kw['accept_missing_endtag_name']
- if kw.has_key('map_case'):
+ if 'map_case' in kw:
self.__map_case = kw['map_case']
- if kw.has_key('accept_utf8'):
+ if 'accept_utf8' in kw:
self.__accept_utf8 = kw['accept_utf8']
- if kw.has_key('translate_attribute_references'):
+ if 'translate_attribute_references' in kw:
self.__translate_attribute_references = kw['translate_attribute_references']
self.reset()
@@ -206,7 +206,7 @@ class XMLParser:
self.syntax_error("`;' missing after char reference")
i = i-1
elif all:
- if self.entitydefs.has_key(str):
+ if str in self.entitydefs:
str = self.entitydefs[str]
rescan = 1
elif data[i - 1] != ';':
@@ -375,7 +375,7 @@ class XMLParser:
name = res.group('name')
if self.__map_case:
name = name.lower()
- if self.entitydefs.has_key(name):
+ if name in self.entitydefs:
self.rawdata = rawdata = rawdata[:res.start(0)] + self.entitydefs[name] + rawdata[i:]
n = len(rawdata)
i = res.start(0)
@@ -533,15 +533,15 @@ class XMLParser:
if namespace:
self.syntax_error('namespace declaration inside namespace declaration')
for attrname in attrdict.keys():
- if not self.__xml_namespace_attributes.has_key(attrname):
+ if not attrname in self.__xml_namespace_attributes:
self.syntax_error("unknown attribute `%s' in xml:namespace tag" % attrname)
- if not attrdict.has_key('ns') or not attrdict.has_key('prefix'):
+ if not 'ns' in attrdict or not 'prefix' in attrdict:
self.syntax_error('xml:namespace without required attributes')
prefix = attrdict.get('prefix')
if ncname.match(prefix) is None:
self.syntax_error('xml:namespace illegal prefix value')
return end.end(0)
- if self.__namespaces.has_key(prefix):
+ if prefix in self.__namespaces:
self.syntax_error('xml:namespace prefix not unique')
self.__namespaces[prefix] = attrdict['ns']
else:
@@ -581,7 +581,7 @@ class XMLParser:
continue
if '<' in attrvalue:
self.syntax_error("`<' illegal in attribute value")
- if attrdict.has_key(attrname):
+ if attrname in attrdict:
self.syntax_error("attribute `%s' specified twice" % attrname)
attrvalue = attrvalue.translate(attrtrans)
attrdict[attrname] = self.translate_references(attrvalue)
@@ -619,7 +619,7 @@ class XMLParser:
prefix = ''
ns = None
for t, d, nst in self.stack:
- if d.has_key(prefix):
+ if prefix in d:
ns = d[prefix]
if ns is None and prefix != '':
ns = self.__namespaces.get(prefix)
@@ -645,7 +645,7 @@ class XMLParser:
aprefix = ''
ans = None
for t, d, nst in self.stack:
- if d.has_key(aprefix):
+ if aprefix in d:
ans = d[aprefix]
if ans is None and aprefix != '':
ans = self.__namespaces.get(aprefix)
@@ -661,10 +661,10 @@ class XMLParser:
attributes = self.attributes.get(nstag)
if attributes is not None:
for key in attrdict.keys():
- if not attributes.has_key(key):
+ if not key in attributes:
self.syntax_error("unknown attribute `%s' in tag `%s'" % (attrnamemap[key], tagname))
for key, val in attributes.items():
- if val is not None and not attrdict.has_key(key):
+ if val is not None and not key in attrdict:
attrdict[key] = val
method = self.elements.get(nstag, (None, None))[0]
self.finish_starttag(nstag, attrdict, method)