Commit d4dee996 authored by Fred Drake's avatar Fred Drake

Remove uses of apply(). These will generate PendingDeprecationWarnings in

Python 2.3.
parent 5ac86b5e
......@@ -23,9 +23,7 @@ class StructuredTextExample(ST.StructuredTextParagraph):
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 @@ class StructuredTextDescription(ST.StructuredTextParagraph):
"""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 StructuredTextSectionTitle(ST.StructuredTextParagraph):
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 @@ class StructuredTextTable(ST.StructuredTextDocument):
"""
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 @@ class StructuredTextRow(ST.StructuredTextDocument):
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 @@ class StructuredTextColumn(ST.StructuredTextParagraph):
"""
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):
......
......@@ -34,9 +34,7 @@ class StructuredTextExample(ST.StructuredTextParagraph):
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 @@ class StructuredTextDescription(ST.StructuredTextParagraph):
"""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 StructuredTextSectionTitle(ST.StructuredTextParagraph):
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 @@ class StructuredTextTable(ST.StructuredTextParagraph):
"""
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 @@ class StructuredTextRow(ST.StructuredTextParagraph):
[('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 @@ class StructuredTextColumn(ST.StructuredTextParagraph):
"""
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 @@ class DocumentClass:
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 @@ class DocumentClass:
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)
......
......@@ -266,9 +266,7 @@ class StructuredTextDocument(StructuredTextParagraph):
_attributes=()
def __init__(self, subs=None, **kw):
apply(StructuredTextParagraph.__init__,
(self, '', subs),
kw)
StructuredTextParagraph.__init__(self, '', subs, **kw)
def getChildren(self):
return self._subs
......
......@@ -34,7 +34,7 @@ else:
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 @@ class compile:
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 @@ class compile:
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 @@ class compile:
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 compile:
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment