@@ -62,10 +62,7 @@ def toprettyxml(self, indent="\t", newl="\n", encoding=None):
62
62
return writer .stream .getvalue ()
63
63
64
64
def hasChildNodes (self ):
65
- if self .childNodes :
66
- return True
67
- else :
68
- return False
65
+ return bool (self .childNodes )
69
66
70
67
def _get_childNodes (self ):
71
68
return self .childNodes
@@ -930,6 +927,7 @@ class Childless:
930
927
"""Mixin that makes childless-ness easy to implement and avoids
931
928
the complexity of the Node methods that deal with children.
932
929
"""
930
+ __slots__ = ()
933
931
934
932
attributes = None
935
933
childNodes = EmptyNodeList ()
@@ -1067,6 +1065,8 @@ def replaceData(self, offset, count, arg):
1067
1065
1068
1066
1069
1067
class Text (CharacterData ):
1068
+ __slots__ = ()
1069
+
1070
1070
nodeType = Node .TEXT_NODE
1071
1071
nodeName = "#text"
1072
1072
attributes = None
@@ -1188,6 +1188,8 @@ def writexml(self, writer, indent="", addindent="", newl=""):
1188
1188
1189
1189
1190
1190
class CDATASection (Text ):
1191
+ __slots__ = ()
1192
+
1191
1193
nodeType = Node .CDATA_SECTION_NODE
1192
1194
nodeName = "#cdata-section"
1193
1195
@@ -1266,8 +1268,7 @@ def __setstate__(self, state):
1266
1268
class Identified :
1267
1269
"""Mix-in class that supports the publicId and systemId attributes."""
1268
1270
1269
- # XXX this does not work, this is an old-style class
1270
- # __slots__ = 'publicId', 'systemId'
1271
+ __slots__ = 'publicId' , 'systemId'
1271
1272
1272
1273
def _identified_mixin_init (self , publicId , systemId ):
1273
1274
self .publicId = publicId
0 commit comments