[Zope-Checkins] CVS: Zope/lib/python/StructuredText - DocumentClass.py:1.51 ST.py:1.18 STDOM.py:1.10 StructuredText.py:1.50
Andreas Jung
andreas@digicool.com
Sat, 19 Oct 2002 02:36:30 -0400
Update of /cvs-repository/Zope/lib/python/StructuredText
In directory cvs.zope.org:/tmp/cvs-serv17668/StructuredText
Modified Files:
DocumentClass.py ST.py STDOM.py StructuredText.py
Log Message:
fixed several problems identified by pychecker
=== Zope/lib/python/StructuredText/DocumentClass.py 1.50 => 1.51 ===
--- Zope/lib/python/StructuredText/DocumentClass.py:1.50 Wed Sep 18 11:12:47 2002
+++ Zope/lib/python/StructuredText/DocumentClass.py Sat Oct 19 02:36:29 2002
@@ -149,8 +149,8 @@
def _getColorizableTexts(self):
return self.getColorizableTexts()
- def _setColorizableTexts(self):
- return self.setColorizableTexts()
+ def _setColorizableTexts(self, texts):
+ return self.setColorizableTexts(texts)
# StructuredTextRow holds StructuredTextColumns
class StructuredTextRow(ST.StructuredTextParagraph):
@@ -238,9 +238,9 @@
self._attributes=kw.keys()
for k, v in kw.items(): setattr(self, k, v)
- def getChildren(self, type=type, lt=type([])):
+ def getChildren(self):
v=self._value
- if type(v) is not lt: v=[v]
+ if not isinstance(v, ListType): v=[v]
return v
def getColorizableTexts(self): return self._value,
@@ -934,6 +934,8 @@
start,end = r.span()
text = s[start:end]
return (StructuredTextSGML(text),start,end)
+ else:
+ return None
def doc_xref(self, s,
=== Zope/lib/python/StructuredText/ST.py 1.17 => 1.18 ===
--- Zope/lib/python/StructuredText/ST.py:1.17 Wed Aug 14 17:58:22 2002
+++ Zope/lib/python/StructuredText/ST.py Sat Oct 19 02:36:29 2002
@@ -12,6 +12,7 @@
##############################################################################
import re, STDOM
+from types import ListType
#####################################################################
# Updated functions #
@@ -187,9 +188,9 @@
self._attributes=kw.keys()
for k, v in kw.items(): setattr(self, k, v)
- def getChildren(self, type=type, lt=type([])):
+ def getChildren(self):
src=self._src
- if type(src) is not lt: src=[src]
+ if not isinstance(src, ListType): src=[src]
return src+self._subs
def getAttribute(self, name):
@@ -198,6 +199,8 @@
def getAttributeNode(self, name):
if hasattr(self, name):
return STDOM.Attr(name, getattr(self, name))
+ else:
+ return None
def getAttributes(self):
d={}
@@ -231,8 +234,8 @@
create aliases for all above functions in the pythony way.
"""
- def _get_Children(self, type=type, lt=type([])):
- return self.getChildren(type,lt)
+ def _get_Children(self):
+ return self.getChildren()
def _get_Attribute(self, name):
return self.getAttribute(name)
=== Zope/lib/python/StructuredText/STDOM.py 1.9 => 1.10 ===
--- Zope/lib/python/StructuredText/STDOM.py:1.9 Tue Oct 1 10:09:48 2002
+++ Zope/lib/python/StructuredText/STDOM.py Sat Oct 19 02:36:29 2002
@@ -121,7 +121,7 @@
"""
children = self.getChildren()
if not children: return None
- n=chidren[-1]
+ n=children[-1]
if type(n) in sts: n=TextNode(n)
return n.__of__(self)
@@ -168,11 +168,7 @@
i=i+1
return None
- def getPreviousSibling(self,
- type=type,
- sts=StringTypes,
- getattr=getattr):
-
+ def getPreviousSibling(self):
"""
The node immediately preceding this node. If
there is no such node, this returns None.
@@ -192,13 +188,13 @@
try: n=children[index]
except IndexError: return None
else:
- if type(n) in sts:
+ if type(n) in StringTypes:
n=TextNode(n)
n._DOMIndex=index
return n.__of__(self)
- def getNextSibling(self, type=type, sts=StringTypes):
+ def getNextSibling(self):
"""
The node immediately preceding this node. If
there is no such node, this returns None.
@@ -218,7 +214,7 @@
except IndexError:
return None
else:
- if type(n) in sts:
+ if type(n) in StringTypes:
n=TextNode(n)
n._DOMIndex=index
return n.__of__(self)
@@ -239,15 +235,11 @@
def _get_DOMIndex(self, children, getattr=getattr):
return self._getDOMIndex(children,getattr)
- def _get_PreviousSibling(self,
- type=type,
- sts=StringTypes,
- getattr=getattr):
-
- return self.getPreviousSibling(type,sts,getattr,None)
+ def _get_PreviousSibling(self):
+ return self.getPreviousSibling()
- def _get_NextSibling(self, type=type, sts=StringTypes):
- return self.getNextSibling(type,sts)
+ def _get_NextSibling(self):
+ return self.getNextSibling()
def _get_OwnerDocument(self):
return self.getOwnerDocument()
@@ -340,14 +332,10 @@
def _get_Children(self):
return self.getChildren()
- def _get_PreviousSibling(self,
- type=type,
- sts=StringTypes,
- getattr=getattr):
+ def _get_PreviousSibling(self):
+ return self.getPreviousSibling()
- return self.getPreviousSibling(type,sts,getattr,None)
-
- def _get_NextSibling(self, type=type, sts=StringTypes):
+ def _get_NextSibling(self):
return self.getNextSibling()
def _get_Attributes(self):
@@ -406,10 +394,10 @@
"""A code representing the type of the node."""
return ELEMENT_NODE
- def getNodeValue(self, type=type, sts=StringTypes):
+ def getNodeValue(self):
r=[]
for c in self.getChildren():
- if type(c) not in sts:
+ if type(c) not in StringTypes:
c=c.getNodeValue()
r.append(c)
return ''.join(r)
@@ -479,8 +467,8 @@
def _get_NodeType(self):
return self.getNodeType()
- def _get_NodeValue(self, type=type, sts=StringTypes):
- return self.getNodeValue(type,sts)
+ def _get_NodeValue(self):
+ return self.getNodeValue()
def _get_ParentNode(self):
return self.getParentNode()
=== Zope/lib/python/StructuredText/StructuredText.py 1.49 => 1.50 ===
--- Zope/lib/python/StructuredText/StructuredText.py:1.49 Wed Aug 14 17:58:22 2002
+++ Zope/lib/python/StructuredText/StructuredText.py Sat Oct 19 02:36:29 2002
@@ -15,7 +15,7 @@
use of StructuredTextNG """
-import HTMLClass, DocumentClass, ClassicDocumentClass
+import HTMLClass, DocumentClass
import DocumentWithImages, HTMLWithImages
from ST import Basic