[Zope-Checkins] CVS: Zope/lib/python/StructuredText - ClassicDocumentClass.py:1.27 DocumentClass.py:1.52 ST.py:1.19 ts_regex.py:1.7

Fred L. Drake, Jr. fred@zope.com
Thu, 27 Feb 2003 11:57:32 -0500


Update of /cvs-repository/Zope/lib/python/StructuredText
In directory cvs.zope.org:/tmp/cvs-serv3705

Modified Files:
	ClassicDocumentClass.py DocumentClass.py ST.py ts_regex.py 
Log Message:
Remove uses of apply().  These will generate PendingDeprecationWarnings in
Python 2.3.

=== Zope/lib/python/StructuredText/ClassicDocumentClass.py 1.26 => 1.27 ===
--- Zope/lib/python/StructuredText/ClassicDocumentClass.py:1.26	Wed Sep 18 11:12:47 2002
+++ Zope/lib/python/StructuredText/ClassicDocumentClass.py	Thu Feb 27 11:57:31 2003
@@ -23,9 +23,7 @@
     def __init__(self, subs, **kw):
         t=[]; a=t.append
         for s in subs: a(s.getNodeValue())
-        apply(ST.StructuredTextParagraph.__init__,
-              (self, '\n\n'.join(t), ()),
-              kw)
+        ST.StructuredTextParagraph.__init__(self, '\n\n'.join(t), (), **kw)
 
     def getColorizableTexts(self): return ()
     def setColorizableTexts(self, src): pass # never color examples
@@ -46,7 +44,7 @@
     """Represents a section of a document with a title and a body"""
 
     def __init__(self, title, src, subs, **kw):
-        apply(ST.StructuredTextParagraph.__init__, (self, src, subs), kw)
+        ST.StructuredTextParagraph.__init__(self, src, subs, **kw)
         self._title=title
 
     def getColorizableTexts(self): return self._title, self._src
@@ -62,9 +60,8 @@
 class StructuredTextSection(ST.StructuredTextParagraph):
     """Represents a section of a document with a title and a body"""
     def __init__(self, src, subs=None, **kw):
-        apply(ST.StructuredTextParagraph.__init__,
-              (self, StructuredTextSectionTitle(src), subs),
-              kw)
+        ST.StructuredTextParagraph.__init__(
+            self, StructuredTextSectionTitle(src), subs, **kw)
 
     def getColorizableTexts(self):
         return self._src.getColorizableTexts()
@@ -82,7 +79,7 @@
     """
 
     def __init__(self, rows, src, subs, **kw):
-        apply(ST.StructuredTextDocument.__init__,(self,subs),kw)
+        ST.StructuredTextDocument.__init__(self, subs, **kw)
         self._rows = []
         for row in rows:
             if row:
@@ -138,7 +135,7 @@
         EX
         [('this is column one',1), ('this is column two',1)]
         """
-        apply(ST.StructuredTextDocument.__init__,(self,[]),kw)
+        ST.StructuredTextDocument.__init__(self, [], **kw)
         self._columns = []
         for column in row:
             self._columns.append(StructuredTextColumn(column[0],column[1],kw))
@@ -158,7 +155,7 @@
     """
 
     def __init__(self,text,span,kw):
-        apply(ST.StructuredTextParagraph.__init__,(self,text,[]),kw)
+        ST.StructuredTextParagraph.__init__(self, text, [], **kw)
         self._span = span
 
     def getSpan(self):


=== Zope/lib/python/StructuredText/DocumentClass.py 1.51 => 1.52 ===
--- Zope/lib/python/StructuredText/DocumentClass.py:1.51	Sat Oct 19 02:36:29 2002
+++ Zope/lib/python/StructuredText/DocumentClass.py	Thu Feb 27 11:57:31 2003
@@ -34,9 +34,7 @@
         a=t.append
         for s in subs:
             flatten(s, a)
-        apply(ST.StructuredTextParagraph.__init__,
-              (self, '\n\n'.join(t), ()),
-              kw)
+        ST.StructuredTextParagraph.__init__(self, '\n\n'.join(t), (), **kw)
 
     def getColorizableTexts(self): return ()
     def setColorizableTexts(self, src): pass # never color examples
@@ -57,7 +55,7 @@
     """Represents a section of a document with a title and a body"""
 
     def __init__(self, title, src, subs, **kw):
-        apply(ST.StructuredTextParagraph.__init__, (self, src, subs), kw)
+        ST.StructuredTextParagraph.__init__(self, src, subs, **kw)
         self._title=title
 
     def getColorizableTexts(self): return self._title, self._src
@@ -73,9 +71,8 @@
 class StructuredTextSection(ST.StructuredTextParagraph):
     """Represents a section of a document with a title and a body"""
     def __init__(self, src, subs=None, **kw):
-        apply(ST.StructuredTextParagraph.__init__,
-              (self, StructuredTextSectionTitle(src), subs),
-              kw)
+        ST.StructuredTextParagraph.__init__(
+            self, StructuredTextSectionTitle(src), subs, **kw)
 
     def getColorizableTexts(self):
         return self._src.getColorizableTexts()
@@ -93,7 +90,7 @@
     """
 
     def __init__(self, rows, src, subs, **kw):
-        apply(ST.StructuredTextParagraph.__init__,(self,subs),kw)
+        ST.StructuredTextParagraph.__init__(self, subs, **kw)
         self._rows = []
         for row in rows:
             if row:
@@ -164,7 +161,7 @@
         [('this is column one',1), ('this is column two',1)]
         """
 
-        apply(ST.StructuredTextParagraph.__init__,(self,[]),kw)
+        ST.StructuredTextParagraph.__init__(self, [], **kw)
 
         self._columns = []
         for column in row:
@@ -197,7 +194,7 @@
     """
 
     def __init__(self,text,span,align,valign,typ,kw):
-        apply(ST.StructuredTextParagraph.__init__,(self,text,[]),kw)
+        ST.StructuredTextParagraph.__init__(self, text, [], **kw)
         self._span = span
         self._align = align
         self._valign = valign
@@ -427,8 +424,8 @@
                 atts = getattr(paragraph, '_attributes', [])
                 for att in atts: kw[att] = getattr(paragraph, att)
                 subs = self.color_paragraphs(paragraph.getSubparagraphs())
-                new_paragraphs=apply(ST.StructuredTextParagraph,
-                   (paragraph.getColorizableTexts()[0], subs), kw),
+                new_paragraphs=ST.StructuredTextParagraph(
+                   paragraph. getColorizableTexts()[0], subs, **kw),
 
             # color the inline StructuredText types
             # for each StructuredTextParagraph
@@ -782,7 +779,7 @@
             kw = {}
             atts = getattr(paragraph, '_attributes', [])
             for att in atts: kw[att] = getattr(paragraph, att)
-            return apply(ST.StructuredTextParagraph, (top[:-1], [subs]), kw)
+            return ST.StructuredTextParagraph(top[:-1], [subs], **kw)
 
         if top.find('\n') >= 0: return None
         return StructuredTextSection(top, subs, indent=paragraph.indent)


=== Zope/lib/python/StructuredText/ST.py 1.18 => 1.19 ===
--- Zope/lib/python/StructuredText/ST.py:1.18	Sat Oct 19 02:36:29 2002
+++ Zope/lib/python/StructuredText/ST.py	Thu Feb 27 11:57:31 2003
@@ -266,9 +266,7 @@
     _attributes=()
 
     def __init__(self, subs=None, **kw):
-        apply(StructuredTextParagraph.__init__,
-                (self, '', subs),
-                kw)
+        StructuredTextParagraph.__init__(self, '', subs, **kw)
 
     def getChildren(self):
         return self._subs


=== Zope/lib/python/StructuredText/ts_regex.py 1.6 => 1.7 ===
--- Zope/lib/python/StructuredText/ts_regex.py:1.6	Wed Nov 20 15:50:41 2002
+++ Zope/lib/python/StructuredText/ts_regex.py	Thu Feb 27 11:57:31 2003
@@ -34,7 +34,7 @@
 
         def __call__(self, *args, **kw):
             self._a()
-            try: return apply(self._f, args, kw)
+            try: return self._f(*args, **kw)
             finally: self._r()
 
     split=SafeFunction(split)
@@ -51,7 +51,7 @@
     groupindex=None
 
     def __init__(self, *args):
-        self._r=r=apply(regex.compile,args)
+        self._r=r=regex(*compile, **args)
         self._init(r)
 
     def _init(self, r):
@@ -84,7 +84,7 @@
             r=self._r
             l=r.search(str, pos)
             if l < 0: return None
-            return l, apply(r.group, group)
+            return l, r.group(*group)
         finally: self.__r()
 
     def match_group(self, str, group, pos=0):
@@ -99,7 +99,7 @@
             r=self._r
             l=r.match(str, pos)
             if l < 0: return None
-            return l, apply(r.group, group)
+            return l, r.group(*group)
         finally: self.__r()
 
     def search_regs(self, str, pos=0):
@@ -133,6 +133,6 @@
 class symcomp(compile):
 
     def __init__(self, *args):
-        self._r=r=apply(regex.symcomp,args)
+        self._r=r=regex.symcomp(*args)
         self._init(r)
         self.groupindex=r.groupindex