Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
d4dee996
Commit
d4dee996
authored
Feb 27, 2003
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove uses of apply(). These will generate PendingDeprecationWarnings in
Python 2.3.
parent
5ac86b5e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
31 deletions
+23
-31
lib/python/StructuredText/ClassicDocumentClass.py
lib/python/StructuredText/ClassicDocumentClass.py
+7
-10
lib/python/StructuredText/DocumentClass.py
lib/python/StructuredText/DocumentClass.py
+10
-13
lib/python/StructuredText/ST.py
lib/python/StructuredText/ST.py
+1
-3
lib/python/StructuredText/ts_regex.py
lib/python/StructuredText/ts_regex.py
+5
-5
No files found.
lib/python/StructuredText/ClassicDocumentClass.py
View file @
d4dee996
...
...
@@ -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
):
...
...
lib/python/StructuredText/DocumentClass.py
View file @
d4dee996
...
...
@@ -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)
...
...
lib/python/StructuredText/ST.py
View file @
d4dee996
...
...
@@ -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
...
...
lib/python/StructuredText/ts_regex.py
View file @
d4dee996
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment