[elbe-devel] [PATCH 6/6] docs: avoid deprecated has_key() method

Thomas Weißschuh thomas.weissschuh at linutronix.de
Mon Jul 15 15:15:18 CEST 2024


has_key() is equivalent to __contains__() and is deprecated.
While at it also fix the assignment from maxOccurs to the 'max'
variable.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 docs/ext/xmlschema.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/docs/ext/xmlschema.py b/docs/ext/xmlschema.py
index 320a90ad0502..26d5b13f550e 100644
--- a/docs/ext/xmlschema.py
+++ b/docs/ext/xmlschema.py
@@ -82,11 +82,11 @@ class XmlSchema(SphinxDirective):
 
         retval = ''
 
-        if e.et.attrib.has_key('minOccurs'):
+        if 'minOccurs' in e.et.attrib:
             min = e.et.attrib['minOccurs']
 
-        if e.et.attrib.has_key('maxOccurs'):
-            min = e.et.attrib['maxOccurs']
+        if 'maxOccurs' in e.et.attrib:
+            max = e.et.attrib['maxOccurs']
 
         if min == '0':
             retval += '*optional* '

-- 
2.45.2



More information about the elbe-devel mailing list