Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
65d09d4e
Commit
65d09d4e
authored
Mar 21, 2007
by
Collin Winter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run 2to3 over Doc/tools/.
parent
89df2456
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
66 additions
and
64 deletions
+66
-64
Doc/tools/buildindex.py
Doc/tools/buildindex.py
+11
-2
Doc/tools/custlib.py
Doc/tools/custlib.py
+8
-8
Doc/tools/getversioninfo
Doc/tools/getversioninfo
+1
-1
Doc/tools/keywords.py
Doc/tools/keywords.py
+2
-2
Doc/tools/listmodules.py
Doc/tools/listmodules.py
+2
-3
Doc/tools/mkackshtml
Doc/tools/mkackshtml
+1
-1
Doc/tools/mkhowto
Doc/tools/mkhowto
+6
-6
Doc/tools/mkmodindex
Doc/tools/mkmodindex
+3
-3
Doc/tools/prechm.py
Doc/tools/prechm.py
+10
-10
Doc/tools/refcounts.py
Doc/tools/refcounts.py
+4
-5
Doc/tools/sgmlconv/docfixer.py
Doc/tools/sgmlconv/docfixer.py
+6
-8
Doc/tools/sgmlconv/esis2sgml.py
Doc/tools/sgmlconv/esis2sgml.py
+3
-5
Doc/tools/sgmlconv/esistools.py
Doc/tools/sgmlconv/esistools.py
+4
-4
Doc/tools/sgmlconv/latex2esis.py
Doc/tools/sgmlconv/latex2esis.py
+3
-3
Doc/tools/undoc_symbols.py
Doc/tools/undoc_symbols.py
+2
-3
No files found.
Doc/tools/buildindex.py
View file @
65d09d4e
...
@@ -37,6 +37,15 @@ class Node:
...
@@ -37,6 +37,15 @@ class Node:
# build up the text
# build up the text
self.text = split_entry_text(str)
self.text = split_entry_text(str)
self.key = split_entry_key(str)
self.key = split_entry_key(str)
def __eq__(self, other):
return cmp(self, other) == 0
def __lt__(self, other):
return cmp(self, other) == -1
def __gt__(self, other):
return cmp(self, other) == 1
def __cmp__(self, other):
def __cmp__(self, other):
"""Comparison operator includes sequence number, for use with
"""Comparison operator includes sequence number, for use with
...
@@ -380,8 +389,8 @@ def main():
...
@@ -380,8 +389,8 @@ def main():
sys
.
stderr
.
write
(
"
\
n
%s: %d index nodes"
%
(
program
,
num_nodes
))
sys
.
stderr
.
write
(
"
\
n
%s: %d index nodes"
%
(
program
,
num_nodes
))
else
:
else
:
open
(
ofn
,
"w"
).
write
(
html
)
open
(
ofn
,
"w"
).
write
(
html
)
print
print
()
print
"%s: %d index nodes"
%
(
program
,
num_nodes
)
print
(
"%s: %d index nodes"
%
(
program
,
num_nodes
)
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
Doc/tools/custlib.py
View file @
65d09d4e
...
@@ -31,7 +31,7 @@ for dir in sys.path:
...
@@ -31,7 +31,7 @@ for dir in sys.path:
modules
[
base
.
lower
()]
=
base
modules
[
base
.
lower
()]
=
base
# Minor oddity: the types module is documented in libtypes2.tex
# Minor oddity: the types module is documented in libtypes2.tex
if
modules
.
has_key
(
'types'
)
:
if
'types'
in
modules
:
del
modules
[
'types'
]
del
modules
[
'types'
]
modules
[
'types2'
]
=
None
modules
[
'types2'
]
=
None
...
@@ -44,8 +44,8 @@ for file in filelist:
...
@@ -44,8 +44,8 @@ for file in filelist:
modname
=
file
[
3
:
-
4
]
modname
=
file
[
3
:
-
4
]
docs
[
modname
]
=
modname
docs
[
modname
]
=
modname
mlist
=
modules
.
keys
(
)
mlist
=
list
(
modules
.
keys
()
)
mlist
=
filter
(
lambda
x
,
docs
=
docs
:
docs
.
has_key
(
x
)
,
mlist
)
mlist
=
filter
(
lambda
x
,
docs
=
docs
:
x
in
docs
,
mlist
)
mlist
.
sort
()
mlist
.
sort
()
mlist
=
map
(
lambda
x
,
docs
=
docs
:
docs
[
x
],
mlist
)
mlist
=
map
(
lambda
x
,
docs
=
docs
:
docs
[
x
],
mlist
)
...
@@ -55,7 +55,7 @@ modules = mlist
...
@@ -55,7 +55,7 @@ modules = mlist
# Write the boilerplate
# Write the boilerplate
# XXX should be fancied up.
# XXX should be fancied up.
print
"""
\
docume
n
tstyle[twoside,11pt,myformat]{report}
print
(
"""
\
docume
n
tstyle[twoside,11pt,myformat]{report}
\
\
title{Python Library Reference}
\
\
title{Python Library Reference}
\
\
input{boilerplate}
\
\
input{boilerplate}
\
\
makeindex % tell
\
\
index to actually write the .idx file
\
\
makeindex % tell
\
\
index to actually write the .idx file
...
@@ -68,11 +68,11 @@ print """\documentstyle[twoside,11pt,myformat]{report}
...
@@ -68,11 +68,11 @@ print """\documentstyle[twoside,11pt,myformat]{report}
\
\
end{abstract}
\
\
end{abstract}
\
\
pagebreak
\
\
pagebreak
{
\
\
parskip = 0mm
\
\
tableofcontents}
{
\
\
parskip = 0mm
\
\
tableofcontents}
\
\
pagebreak
\
\
pagenumbering{arabic}"""
\
\
pagebreak
\
\
pagenumbering{arabic}"""
)
for
modname
in
mlist
:
for
modname
in
mlist
:
print
"
\
\
input{lib%s}"
%
(
modname
,
)
print
(
"
\
\
input{lib%s}"
%
(
modname
,)
)
# Write the end
# Write the end
print
"""
\
\
input{custlib.ind} % Index
print
(
"""
\
\
input{custlib.ind} % Index
\
\
end{document}"""
\
\
end{document}"""
)
Doc/tools/getversioninfo
View file @
65d09d4e
...
@@ -68,4 +68,4 @@ write_file(patchlevel_tex,
...
@@ -68,4 +68,4 @@ write_file(patchlevel_tex,
"
\
\
setshortversion{%s}
\
n
"
"
\
\
setshortversion{%s}
\
n
"
%
(
release
,
releaseinfo
,
shortversion
))
%
(
release
,
releaseinfo
,
shortversion
))
print
release
+
releaseinfo
print
(
release
+
releaseinfo
)
Doc/tools/keywords.py
View file @
65d09d4e
...
@@ -21,5 +21,5 @@ ncols = 5
...
@@ -21,5 +21,5 @@ ncols = 5
nrows
=
(
len
(
l
)
+
ncols
-
1
)
/
ncols
nrows
=
(
len
(
l
)
+
ncols
-
1
)
/
ncols
for
i
in
range
(
nrows
):
for
i
in
range
(
nrows
):
for
j
in
range
(
i
,
len
(
l
),
nrows
):
for
j
in
range
(
i
,
len
(
l
),
nrows
):
print
l
[
j
].
ljust
(
10
),
print
(
l
[
j
].
ljust
(
10
),
end
=
' '
)
print
print
()
Doc/tools/listmodules.py
View file @
65d09d4e
...
@@ -40,8 +40,7 @@ def main():
...
@@ -40,8 +40,7 @@ def main():
for
p
in
path
:
for
p
in
path
:
modules
.
update
(
getmodules
(
p
))
modules
.
update
(
getmodules
(
p
))
keys
=
modules
.
keys
()
keys
=
sorted
(
modules
.
keys
())
keys
.
sort
()
# filter out known test packages
# filter out known test packages
def
cb
(
m
):
def
cb
(
m
):
...
@@ -79,7 +78,7 @@ def main():
...
@@ -79,7 +78,7 @@ def main():
if
out
is
not
sys
.
stdout
:
if
out
is
not
sys
.
stdout
:
out
.
close
()
out
.
close
()
print
out
.
name
,
"ok (%d modules)"
%
len
(
modules
)
print
(
out
.
name
,
"ok (%d modules)"
%
len
(
modules
)
)
def
getmodules
(
p
):
def
getmodules
(
p
):
# get modules in a given directory
# get modules in a given directory
...
...
Doc/tools/mkackshtml
View file @
65d09d4e
...
@@ -26,7 +26,7 @@ def main():
...
@@ -26,7 +26,7 @@ def main():
options
.
variables
[
"title"
]
=
"Acknowledgements"
options
.
variables
[
"title"
]
=
"Acknowledgements"
options
.
parse
(
sys
.
argv
[
1
:])
options
.
parse
(
sys
.
argv
[
1
:])
names
=
collect
(
sys
.
stdin
)
names
=
collect
(
sys
.
stdin
)
percol
=
(
len
(
names
)
+
options
.
columns
-
1
)
/
options
.
columns
percol
=
(
len
(
names
)
+
options
.
columns
-
1
)
/
/
options
.
columns
colnums
=
[]
colnums
=
[]
for
i
in
range
(
options
.
columns
):
for
i
in
range
(
options
.
columns
):
colnums
.
append
(
percol
*
i
)
colnums
.
append
(
percol
*
i
)
...
...
Doc/tools/mkhowto
View file @
65d09d4e
...
@@ -65,11 +65,11 @@ PYTHON_BINARY = "python"
...
@@ -65,11 +65,11 @@ PYTHON_BINARY = "python"
def
usage
(
options
,
file
):
def
usage
(
options
,
file
):
print
>>
file
,
__doc__
%
options
print
(
__doc__
%
options
,
file
=
file
)
def
error
(
options
,
message
,
err
=
2
):
def
error
(
options
,
message
,
err
=
2
):
print
>>
sys
.
stderr
,
message
print
(
message
,
file
=
sys
.
stderr
)
print
>>
sys
.
stderr
print
(
file
=
sys
.
stderr
)
usage
(
options
,
sys
.
stderr
)
usage
(
options
,
sys
.
stderr
)
sys
.
exit
(
2
)
sys
.
exit
(
2
)
...
@@ -132,7 +132,7 @@ class Options:
...
@@ -132,7 +132,7 @@ class Options:
try
:
try
:
return
getattr
(
self
,
key
)
return
getattr
(
self
,
key
)
except
AttributeError
:
except
AttributeError
:
raise
KeyError
,
key
raise
KeyError
(
key
)
def
parse
(
self
,
args
):
def
parse
(
self
,
args
):
opts
,
args
=
getopt
.
getopt
(
args
,
"Hi:a:s:lDkqr:"
,
opts
,
args
=
getopt
.
getopt
(
args
,
"Hi:a:s:lDkqr:"
,
...
@@ -289,7 +289,7 @@ class Job:
...
@@ -289,7 +289,7 @@ class Job:
if
not
imgs
:
if
not
imgs
:
self
.
warning
(
self
.
warning
(
"Could not locate support images of type %s."
"Could not locate support images of type %s."
%
`self.options.image_type`
)
%
repr
(
self
.
options
.
image_type
)
)
for
fn
in
imgs
:
for
fn
in
imgs
:
new_fn
=
os
.
path
.
join
(
self
.
builddir
,
os
.
path
.
basename
(
fn
))
new_fn
=
os
.
path
.
join
(
self
.
builddir
,
os
.
path
.
basename
(
fn
))
shutil
.
copyfile
(
fn
,
new_fn
)
shutil
.
copyfile
(
fn
,
new_fn
)
...
@@ -534,7 +534,7 @@ class Job:
...
@@ -534,7 +534,7 @@ class Job:
def
message
(
self
,
msg
):
def
message
(
self
,
msg
):
msg
=
"+++ "
+
msg
msg
=
"+++ "
+
msg
if
not
self
.
options
.
quiet
:
if
not
self
.
options
.
quiet
:
print
msg
print
(
msg
)
self
.
log
(
msg
+
"
\
n
"
)
self
.
log
(
msg
+
"
\
n
"
)
def
warning
(
self
,
msg
):
def
warning
(
self
,
msg
):
...
...
Doc/tools/mkmodindex
View file @
65d09d4e
...
@@ -49,7 +49,7 @@ class IndexOptions(support.Options):
...
@@ -49,7 +49,7 @@ class IndexOptions(support.Options):
def
usage
(
self
):
def
usage
(
self
):
program
=
os
.
path
.
basename
(
sys
.
argv
[
0
])
program
=
os
.
path
.
basename
(
sys
.
argv
[
0
])
print
__doc__
%
{
"program"
:
program
}
print
(
__doc__
%
{
"program"
:
program
})
links
=
[
links
=
[
(
'author'
,
'acks.html'
,
'Acknowledgements'
),
(
'author'
,
'acks.html'
,
'Acknowledgements'
),
...
@@ -143,8 +143,8 @@ def main():
...
@@ -143,8 +143,8 @@ def main():
if
options
.
outputfile
==
"-"
:
if
options
.
outputfile
==
"-"
:
sys
.
stderr
.
write
(
"%s: %d index nodes
\
n
"
%
(
program
,
num_nodes
))
sys
.
stderr
.
write
(
"%s: %d index nodes
\
n
"
%
(
program
,
num_nodes
))
else
:
else
:
print
print
()
print
"%s: %d index nodes"
%
(
program
,
num_nodes
)
print
(
"%s: %d index nodes"
%
(
program
,
num_nodes
)
)
PLAT_DISCUSS
=
"""
PLAT_DISCUSS
=
"""
...
...
Doc/tools/prechm.py
View file @
65d09d4e
...
@@ -413,7 +413,7 @@ def content(path, contentpage, output):
...
@@ -413,7 +413,7 @@ def content(path, contentpage, output):
def
do_index
(
library
,
output
):
def
do_index
(
library
,
output
):
output
.
write
(
'<UL>
\
n
'
)
output
.
write
(
'<UL>
\
n
'
)
for
book
in
library
:
for
book
in
library
:
print
'
\
t
'
,
book
.
title
,
'-'
,
book
.
indexpage
print
(
'
\
t
'
,
book
.
title
,
'-'
,
book
.
indexpage
)
if
book
.
indexpage
:
if
book
.
indexpage
:
index
(
book
.
directory
,
book
.
indexpage
,
output
)
index
(
book
.
directory
,
book
.
indexpage
,
output
)
output
.
write
(
'</UL>
\
n
'
)
output
.
write
(
'</UL>
\
n
'
)
...
@@ -421,7 +421,7 @@ def do_index(library, output):
...
@@ -421,7 +421,7 @@ def do_index(library, output):
def
do_content
(
library
,
version
,
output
):
def
do_content
(
library
,
version
,
output
):
output
.
write
(
contents_header
)
output
.
write
(
contents_header
)
for
book
in
library
:
for
book
in
library
:
print
'
\
t
'
,
book
.
title
,
'-'
,
book
.
firstpage
print
(
'
\
t
'
,
book
.
title
,
'-'
,
book
.
firstpage
)
path
=
book
.
directory
+
"/"
+
book
.
firstpage
path
=
book
.
directory
+
"/"
+
book
.
firstpage
output
.
write
(
'<LI>'
)
output
.
write
(
'<LI>'
)
output
.
write
(
object_sitemap
%
(
book
.
title
,
path
))
output
.
write
(
object_sitemap
%
(
book
.
title
,
path
))
...
@@ -449,12 +449,12 @@ def openfile(file):
...
@@ -449,12 +449,12 @@ def openfile(file):
try
:
try
:
p
=
open
(
file
,
"w"
)
p
=
open
(
file
,
"w"
)
except
IOError
as
msg
:
except
IOError
as
msg
:
print
file
,
":"
,
msg
print
(
file
,
":"
,
msg
)
sys
.
exit
(
1
)
sys
.
exit
(
1
)
return
p
return
p
def
usage
():
def
usage
():
print
usage_mode
print
(
usage_mode
)
sys
.
exit
(
0
)
sys
.
exit
(
0
)
def
do_it
(
args
=
None
):
def
do_it
(
args
=
None
):
...
@@ -467,7 +467,7 @@ def do_it(args = None):
...
@@ -467,7 +467,7 @@ def do_it(args = None):
try
:
try
:
optlist
,
args
=
getopt
.
getopt
(
args
,
'ckpv:'
)
optlist
,
args
=
getopt
.
getopt
(
args
,
'ckpv:'
)
except
getopt
.
error
as
msg
:
except
getopt
.
error
as
msg
:
print
msg
print
(
msg
)
usage
()
usage
()
if
not
args
or
len
(
args
)
>
1
:
if
not
args
or
len
(
args
)
>
1
:
...
@@ -487,15 +487,15 @@ def do_it(args = None):
...
@@ -487,15 +487,15 @@ def do_it(args = None):
if
not
((
'-p'
,
''
)
in
optlist
):
if
not
((
'-p'
,
''
)
in
optlist
):
fname
=
arch
+
'.stp'
fname
=
arch
+
'.stp'
f
=
openfile
(
fname
)
f
=
openfile
(
fname
)
print
"Building stoplist"
,
fname
,
"..."
print
(
"Building stoplist"
,
fname
,
"..."
)
words
=
stop_list
.
split
()
words
=
stop_list
.
split
()
words
.
sort
()
words
.
sort
()
for
word
in
words
:
for
word
in
words
:
print
>>
f
,
word
print
(
word
,
file
=
f
)
f
.
close
()
f
.
close
()
f
=
openfile
(
arch
+
'.hhp'
)
f
=
openfile
(
arch
+
'.hhp'
)
print
"Building Project..."
print
(
"Building Project..."
)
do_project
(
library
,
f
,
arch
,
version
)
do_project
(
library
,
f
,
arch
,
version
)
if
version
==
'2.0.0'
:
if
version
==
'2.0.0'
:
for
image
in
os
.
listdir
(
'icons'
):
for
image
in
os
.
listdir
(
'icons'
):
...
@@ -505,13 +505,13 @@ def do_it(args = None):
...
@@ -505,13 +505,13 @@ def do_it(args = None):
if
not
((
'-c'
,
''
)
in
optlist
):
if
not
((
'-c'
,
''
)
in
optlist
):
f
=
openfile
(
arch
+
'.hhc'
)
f
=
openfile
(
arch
+
'.hhc'
)
print
"Building Table of Content..."
print
(
"Building Table of Content..."
)
do_content
(
library
,
version
,
f
)
do_content
(
library
,
version
,
f
)
f
.
close
()
f
.
close
()
if
not
((
'-k'
,
''
)
in
optlist
):
if
not
((
'-k'
,
''
)
in
optlist
):
f
=
openfile
(
arch
+
'.hhk'
)
f
=
openfile
(
arch
+
'.hhk'
)
print
"Building Index..."
print
(
"Building Index..."
)
do_index
(
library
,
f
)
do_index
(
library
,
f
)
f
.
close
()
f
.
close
()
...
...
Doc/tools/refcounts.py
View file @
65d09d4e
...
@@ -69,24 +69,23 @@ class Entry:
...
@@ -69,24 +69,23 @@ class Entry:
def
dump
(
d
):
def
dump
(
d
):
"""Dump the data in the 'canonical' format, with functions in
"""Dump the data in the 'canonical' format, with functions in
sorted order."""
sorted order."""
items
=
d
.
items
()
items
=
sorted
(
d
.
items
())
items
.
sort
()
first
=
1
first
=
1
for
k
,
entry
in
items
:
for
k
,
entry
in
items
:
if
first
:
if
first
:
first
=
0
first
=
0
else
:
else
:
print
print
()
s
=
entry
.
name
+
":%s:%s:%s:"
s
=
entry
.
name
+
":%s:%s:%s:"
if
entry
.
result_refs
is
None
:
if
entry
.
result_refs
is
None
:
r
=
""
r
=
""
else
:
else
:
r
=
entry
.
result_refs
r
=
entry
.
result_refs
print
s
%
(
entry
.
result_type
,
""
,
r
)
print
(
s
%
(
entry
.
result_type
,
""
,
r
)
)
for
t
,
n
,
r
in
entry
.
args
:
for
t
,
n
,
r
in
entry
.
args
:
if
r
is
None
:
if
r
is
None
:
r
=
""
r
=
""
print
s
%
(
t
,
n
,
r
)
print
(
s
%
(
t
,
n
,
r
)
)
def
main
():
def
main
():
...
...
Doc/tools/sgmlconv/docfixer.py
View file @
65d09d4e
...
@@ -210,8 +210,7 @@ def rewrite_descriptor(doc, descriptor):
...
@@ -210,8 +210,7 @@ def rewrite_descriptor(doc, descriptor):
# 2a.
# 2a.
if
descriptor
.
hasAttribute
(
"var"
):
if
descriptor
.
hasAttribute
(
"var"
):
if
descname
!=
"opcodedesc"
:
if
descname
!=
"opcodedesc"
:
raise
RuntimeError
,
\
raise
RuntimeError
(
"got 'var' attribute on descriptor other than opcodedesc"
)
"got 'var' attribute on descriptor other than opcodedesc"
variable
=
descriptor
.
getAttribute
(
"var"
)
variable
=
descriptor
.
getAttribute
(
"var"
)
if
variable
:
if
variable
:
args
=
doc
.
createElement
(
"args"
)
args
=
doc
.
createElement
(
"args"
)
...
@@ -241,7 +240,7 @@ def rewrite_descriptor(doc, descriptor):
...
@@ -241,7 +240,7 @@ def rewrite_descriptor(doc, descriptor):
try
:
try
:
sig
=
methodline_to_signature
(
doc
,
children
[
pos
])
sig
=
methodline_to_signature
(
doc
,
children
[
pos
])
except
KeyError
:
except
KeyError
:
print
oldchild
.
toxml
(
)
print
(
oldchild
.
toxml
()
)
raise
raise
newchildren
.
append
(
sig
)
newchildren
.
append
(
sig
)
else
:
else
:
...
@@ -347,7 +346,7 @@ def fixup_trailing_whitespace(doc, fragment, wsmap):
...
@@ -347,7 +346,7 @@ def fixup_trailing_whitespace(doc, fragment, wsmap):
while
queue
:
while
queue
:
node
=
queue
[
0
]
node
=
queue
[
0
]
del
queue
[
0
]
del
queue
[
0
]
if
wsmap
.
has_key
(
node
.
nodeName
)
:
if
node
.
nodeName
in
wsmap
:
fixups
.
append
(
node
)
fixups
.
append
(
node
)
for
child
in
node
.
childNodes
:
for
child
in
node
.
childNodes
:
if
child
.
nodeType
==
ELEMENT
:
if
child
.
nodeType
==
ELEMENT
:
...
@@ -962,8 +961,7 @@ def write_esis(doc, ofp, knownempty):
...
@@ -962,8 +961,7 @@ def write_esis(doc, ofp, knownempty):
gi
=
node
.
tagName
gi
=
node
.
tagName
if
knownempty
(
gi
):
if
knownempty
(
gi
):
if
node
.
hasChildNodes
():
if
node
.
hasChildNodes
():
raise
ValueError
,
\
raise
ValueError
(
"declared-empty node <%s> has children"
%
gi
)
"declared-empty node <%s> has children"
%
gi
ofp
.
write
(
"e
\
n
"
)
ofp
.
write
(
"e
\
n
"
)
for
k
,
value
in
node
.
attributes
.
items
():
for
k
,
value
in
node
.
attributes
.
items
():
if
_token_rx
.
match
(
value
):
if
_token_rx
.
match
(
value
):
...
@@ -979,7 +977,7 @@ def write_esis(doc, ofp, knownempty):
...
@@ -979,7 +977,7 @@ def write_esis(doc, ofp, knownempty):
elif
nodeType
==
ENTITY_REFERENCE
:
elif
nodeType
==
ENTITY_REFERENCE
:
ofp
.
write
(
"&%s
\
n
"
%
node
.
nodeName
)
ofp
.
write
(
"&%s
\
n
"
%
node
.
nodeName
)
else
:
else
:
raise
RuntimeError
,
"unsupported node type: %s"
%
nodeType
raise
RuntimeError
(
"unsupported node type: %s"
%
nodeType
)
def
convert
(
ifp
,
ofp
):
def
convert
(
ifp
,
ofp
):
...
@@ -1033,7 +1031,7 @@ def convert(ifp, ofp):
...
@@ -1033,7 +1031,7 @@ def convert(ifp, ofp):
for
gi
in
events
.
parser
.
get_empties
():
for
gi
in
events
.
parser
.
get_empties
():
d
[
gi
]
=
gi
d
[
gi
]
=
gi
for
key
in
(
"author"
,
"pep"
,
"rfc"
):
for
key
in
(
"author"
,
"pep"
,
"rfc"
):
if
d
.
has_key
(
key
)
:
if
key
in
d
:
del
d
[
key
]
del
d
[
key
]
knownempty
=
d
.
has_key
knownempty
=
d
.
has_key
#
#
...
...
Doc/tools/sgmlconv/esis2sgml.py
View file @
65d09d4e
...
@@ -44,8 +44,7 @@ def null_map_gi(sgmlgi, map):
...
@@ -44,8 +44,7 @@ def null_map_gi(sgmlgi, map):
def
format_attrs
(
attrs
,
xml
=
0
):
def
format_attrs
(
attrs
,
xml
=
0
):
attrs
=
attrs
.
items
()
attrs
=
sorted
(
attrs
.
items
())
attrs
.
sort
()
parts
=
[]
parts
=
[]
append
=
parts
.
append
append
=
parts
.
append
for
name
,
value
in
attrs
:
for
name
,
value
in
attrs
:
...
@@ -149,7 +148,7 @@ def convert(ifp, ofp, xml=0, autoclose=(), verbatims=()):
...
@@ -149,7 +148,7 @@ def convert(ifp, ofp, xml=0, autoclose=(), verbatims=()):
ofp
.
write
(
"&%s;"
%
data
)
ofp
.
write
(
"&%s;"
%
data
)
knownempty
=
0
knownempty
=
0
else
:
else
:
raise
RuntimeError
,
"unrecognized ESIS event type: '%s'"
%
type
raise
RuntimeError
(
"unrecognized ESIS event type: '%s'"
%
type
)
if
LIST_EMPTIES
:
if
LIST_EMPTIES
:
dump_empty_element_names
(
knownempties
)
dump_empty_element_names
(
knownempties
)
...
@@ -170,8 +169,7 @@ def dump_empty_element_names(knownempties):
...
@@ -170,8 +169,7 @@ def dump_empty_element_names(knownempties):
if
gi
:
if
gi
:
d
[
gi
]
=
gi
d
[
gi
]
=
gi
fp
=
open
(
EMPTIES_FILENAME
,
"w"
)
fp
=
open
(
EMPTIES_FILENAME
,
"w"
)
gilist
=
d
.
keys
()
gilist
=
sorted
(
d
.
keys
())
gilist
.
sort
()
fp
.
write
(
"
\
n
"
.
join
(
gilist
))
fp
.
write
(
"
\
n
"
.
join
(
gilist
))
fp
.
write
(
"
\
n
"
)
fp
.
write
(
"
\
n
"
)
fp
.
close
()
fp
.
close
()
...
...
Doc/tools/sgmlconv/esistools.py
View file @
65d09d4e
...
@@ -29,7 +29,7 @@ def decode(s):
...
@@ -29,7 +29,7 @@ def decode(s):
n
,
s
=
s
.
split
(
";"
,
1
)
n
,
s
=
s
.
split
(
";"
,
1
)
r
=
r
+
unichr
(
int
(
n
))
r
=
r
+
unichr
(
int
(
n
))
else
:
else
:
raise
ValueError
,
"can't handle %r"
%
s
raise
ValueError
(
"can't handle %r"
%
s
)
return
r
return
r
...
@@ -80,7 +80,7 @@ class ESISReader(xml.sax.xmlreader.XMLReader):
...
@@ -80,7 +80,7 @@ class ESISReader(xml.sax.xmlreader.XMLReader):
self
.
setErrorHandler
(
errorHandler
)
self
.
setErrorHandler
(
errorHandler
)
def
get_empties
(
self
):
def
get_empties
(
self
):
return
self
.
_empties
.
keys
(
)
return
list
(
self
.
_empties
.
keys
()
)
#
#
# XMLReader interface
# XMLReader interface
...
@@ -270,7 +270,7 @@ class Attributes(xml.sax.xmlreader.AttributesImpl):
...
@@ -270,7 +270,7 @@ class Attributes(xml.sax.xmlreader.AttributesImpl):
return
self
.
_attrs
[
name
][
0
]
return
self
.
_attrs
[
name
][
0
]
def
get
(
self
,
name
,
default
=
None
):
def
get
(
self
,
name
,
default
=
None
):
if
self
.
_attrs
.
has_key
(
name
)
:
if
name
in
self
.
_attrs
:
return
self
.
_attrs
[
name
][
0
]
return
self
.
_attrs
[
name
][
0
]
return
default
return
default
...
@@ -282,7 +282,7 @@ class Attributes(xml.sax.xmlreader.AttributesImpl):
...
@@ -282,7 +282,7 @@ class Attributes(xml.sax.xmlreader.AttributesImpl):
def
values
(
self
):
def
values
(
self
):
L
=
[]
L
=
[]
for
value
,
type
in
self
.
_attrs
.
values
(
):
for
value
,
type
in
list
(
self
.
_attrs
.
values
()
):
L
.
append
(
value
)
L
.
append
(
value
)
return
L
return
L
...
...
Doc/tools/sgmlconv/latex2esis.py
View file @
65d09d4e
...
@@ -472,7 +472,7 @@ class TableHandler(xml.sax.handler.ContentHandler):
...
@@ -472,7 +472,7 @@ class TableHandler(xml.sax.handler.ContentHandler):
name = attrs["
name
"]
name = attrs["
name
"]
self.__current = TableEntry(name, environment=1)
self.__current = TableEntry(name, environment=1)
self.__current.verbatim = attrs.get("
verbatim
") == "
yes
"
self.__current.verbatim = attrs.get("
verbatim
") == "
yes
"
if
attrs.has_key("
outputname
")
:
if
"
outputname
" in attrs
:
self.__current.outputname = attrs.get("
outputname
")
self.__current.outputname = attrs.get("
outputname
")
self.__current.endcloses = attrs.get("
endcloses
", "").split()
self.__current.endcloses = attrs.get("
endcloses
", "").split()
def end_environment(self):
def end_environment(self):
...
@@ -482,11 +482,11 @@ class TableHandler(xml.sax.handler.ContentHandler):
...
@@ -482,11 +482,11 @@ class TableHandler(xml.sax.handler.ContentHandler):
name = attrs["
name
"]
name = attrs["
name
"]
self.__current = TableEntry(name)
self.__current = TableEntry(name)
self.__current.closes = attrs.get("
closes
", "").split()
self.__current.closes = attrs.get("
closes
", "").split()
if
attrs.has_key("
outputname
")
:
if
"
outputname
" in attrs
:
self.__current.outputname = attrs.get("
outputname
")
self.__current.outputname = attrs.get("
outputname
")
def end_macro(self):
def end_macro(self):
name = self.__current.name
name = self.__current.name
if
self.__table.has_key(name)
:
if
name in self.__table
:
raise ValueError("
name
%
r
already
in
use
" % (name,))
raise ValueError("
name
%
r
already
in
use
" % (name,))
self.__table[name] = self.__current
self.__table[name] = self.__current
self.__current = None
self.__current = None
...
...
Doc/tools/undoc_symbols.py
View file @
65d09d4e
...
@@ -80,11 +80,10 @@ def print_undoc_symbols(prefix, docdir, incdir):
...
@@ -80,11 +80,10 @@ def print_undoc_symbols(prefix, docdir, incdir):
fp
=
os
.
popen
(
"ctags -IPyAPI_FUNC -IPy_GCC_ATTRIBUTE --c-types=%s -f - %s"
fp
=
os
.
popen
(
"ctags -IPyAPI_FUNC -IPy_GCC_ATTRIBUTE --c-types=%s -f - %s"
%
(
TAG_KINDS
,
incfiles
))
%
(
TAG_KINDS
,
incfiles
))
dict
=
findnames
(
fp
,
prefix
)
dict
=
findnames
(
fp
,
prefix
)
names
=
dict
.
keys
()
names
=
sorted
(
dict
.
keys
())
names
.
sort
()
for
name
in
names
:
for
name
in
names
:
if
not
re
.
search
(
"%s
\
\
W"
%
name
,
docs
):
if
not
re
.
search
(
"%s
\
\
W"
%
name
,
docs
):
print
dict
[
name
],
name
print
(
dict
[
name
],
name
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
srcdir
=
os
.
path
.
dirname
(
sys
.
argv
[
0
])
srcdir
=
os
.
path
.
dirname
(
sys
.
argv
[
0
])
...
...
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