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
ff41c48a
Commit
ff41c48a
authored
Apr 06, 2003
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SF patch #701494: more apply removals
parent
50c61d5a
Changes
23
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
2460 additions
and
2472 deletions
+2460
-2472
Lib/compiler/transformer.py
Lib/compiler/transformer.py
+1
-1
Lib/curses/wrapper.py
Lib/curses/wrapper.py
+1
-1
Lib/lib-tk/Canvas.py
Lib/lib-tk/Canvas.py
+10
-10
Lib/lib-tk/Dialog.py
Lib/lib-tk/Dialog.py
+5
-5
Lib/lib-tk/ScrolledText.py
Lib/lib-tk/ScrolledText.py
+2
-2
Lib/lib-tk/Tix.py
Lib/lib-tk/Tix.py
+39
-53
Lib/lib-tk/Tkinter.py
Lib/lib-tk/Tkinter.py
+274
-275
Lib/lib-tk/tkColorChooser.py
Lib/lib-tk/tkColorChooser.py
+1
-1
Lib/lib-tk/tkCommonDialog.py
Lib/lib-tk/tkCommonDialog.py
+1
-1
Lib/lib-tk/tkFont.py
Lib/lib-tk/tkFont.py
+4
-4
Lib/lib-tk/tkMessageBox.py
Lib/lib-tk/tkMessageBox.py
+8
-8
Lib/lib-tk/tkSimpleDialog.py
Lib/lib-tk/tkSimpleDialog.py
+3
-3
Lib/lib-tk/turtle.py
Lib/lib-tk/turtle.py
+2
-2
Lib/plat-mac/Carbon/MediaDescr.py
Lib/plat-mac/Carbon/MediaDescr.py
+72
-72
Lib/plat-mac/EasyDialogs.py
Lib/plat-mac/EasyDialogs.py
+741
-741
Lib/plat-mac/FrameWork.py
Lib/plat-mac/FrameWork.py
+1009
-1009
Lib/plat-mac/MiniAEFrame.py
Lib/plat-mac/MiniAEFrame.py
+166
-166
Lib/plat-mac/argvemulator.py
Lib/plat-mac/argvemulator.py
+99
-99
Lib/plat-mac/icopen.py
Lib/plat-mac/icopen.py
+14
-14
Lib/test/reperf.py
Lib/test/reperf.py
+1
-1
Lib/test/test_curses.py
Lib/test/test_curses.py
+1
-1
Lib/xml/dom/minidom.py
Lib/xml/dom/minidom.py
+2
-2
Python/bltinmodule.c
Python/bltinmodule.c
+4
-1
No files found.
Lib/compiler/transformer.py
View file @
ff41c48a
...
@@ -72,7 +72,7 @@ def Node(*args):
...
@@ -72,7 +72,7 @@ def Node(*args):
kind
=
args
[
0
]
kind
=
args
[
0
]
if
nodes
.
has_key
(
kind
):
if
nodes
.
has_key
(
kind
):
try
:
try
:
return
apply
(
nodes
[
kind
],
args
[
1
:])
return
nodes
[
kind
](
*
args
[
1
:])
except
TypeError
:
except
TypeError
:
print
nodes
[
kind
],
len
(
args
),
args
print
nodes
[
kind
],
len
(
args
),
args
raise
raise
...
...
Lib/curses/wrapper.py
View file @
ff41c48a
...
@@ -41,7 +41,7 @@ def wrapper(func, *rest):
...
@@ -41,7 +41,7 @@ def wrapper(func, *rest):
except
:
except
:
pass
pass
res
=
apply
(
func
,
(
stdscr
,)
+
rest
)
res
=
func
(
stdscr
,
*
rest
)
except
:
except
:
# In the event of an error, restore the terminal
# In the event of an error, restore the terminal
# to a sane state.
# to a sane state.
...
...
Lib/lib-tk/Canvas.py
View file @
ff41c48a
...
@@ -55,7 +55,7 @@ class CanvasItem:
...
@@ -55,7 +55,7 @@ class CanvasItem:
def
coords
(
self
,
pts
=
()):
def
coords
(
self
,
pts
=
()):
flat
=
()
flat
=
()
for
x
,
y
in
pts
:
flat
=
flat
+
(
x
,
y
)
for
x
,
y
in
pts
:
flat
=
flat
+
(
x
,
y
)
return
apply
(
self
.
canvas
.
coords
,
(
self
.
id
,)
+
flat
)
return
self
.
canvas
.
coords
(
self
.
id
,
*
flat
)
def
dchars
(
self
,
first
,
last
=
None
):
def
dchars
(
self
,
first
,
last
=
None
):
self
.
canvas
.
dchars
(
self
.
id
,
first
,
last
)
self
.
canvas
.
dchars
(
self
.
id
,
first
,
last
)
def
dtag
(
self
,
ttd
):
def
dtag
(
self
,
ttd
):
...
@@ -84,40 +84,40 @@ class CanvasItem:
...
@@ -84,40 +84,40 @@ class CanvasItem:
class
Arc
(
CanvasItem
):
class
Arc
(
CanvasItem
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'arc'
)
+
args
,
kw
)
CanvasItem
.
__init__
(
self
,
canvas
,
'arc'
,
*
args
,
**
kw
)
class
Bitmap
(
CanvasItem
):
class
Bitmap
(
CanvasItem
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'bitmap'
)
+
args
,
kw
)
CanvasItem
.
__init__
(
self
,
canvas
,
'bitmap'
,
*
args
,
**
kw
)
class
ImageItem
(
CanvasItem
):
class
ImageItem
(
CanvasItem
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'image'
)
+
args
,
kw
)
CanvasItem
.
__init__
(
self
,
canvas
,
'image'
,
*
args
,
**
kw
)
class
Line
(
CanvasItem
):
class
Line
(
CanvasItem
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'line'
)
+
args
,
kw
)
CanvasItem
.
__init__
(
self
,
canvas
,
'line'
,
*
args
,
**
kw
)
class
Oval
(
CanvasItem
):
class
Oval
(
CanvasItem
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'oval'
)
+
args
,
kw
)
CanvasItem
.
__init__
(
self
,
canvas
,
'oval'
,
*
args
,
**
kw
)
class
Polygon
(
CanvasItem
):
class
Polygon
(
CanvasItem
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'polygon'
)
+
args
,
kw
)
CanvasItem
.
__init__
(
self
,
canvas
,
'polygon'
,
*
args
,
**
kw
)
class
Rectangle
(
CanvasItem
):
class
Rectangle
(
CanvasItem
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'rectangle'
)
+
args
,
kw
)
CanvasItem
.
__init__
(
self
,
canvas
,
'rectangle'
,
*
args
,
**
kw
)
# XXX "Text" is taken by the Text widget...
# XXX "Text" is taken by the Text widget...
class
CanvasText
(
CanvasItem
):
class
CanvasText
(
CanvasItem
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'text'
)
+
args
,
kw
)
CanvasItem
.
__init__
(
self
,
canvas
,
'text'
,
*
args
,
**
kw
)
class
Window
(
CanvasItem
):
class
Window
(
CanvasItem
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
def
__init__
(
self
,
canvas
,
*
args
,
**
kw
):
apply
(
CanvasItem
.
__init__
,
(
self
,
canvas
,
'window'
)
+
args
,
kw
)
CanvasItem
.
__init__
(
self
,
canvas
,
'window'
,
*
args
,
**
kw
)
class
Group
:
class
Group
:
def
__init__
(
self
,
canvas
,
tag
=
None
):
def
__init__
(
self
,
canvas
,
tag
=
None
):
...
...
Lib/lib-tk/Dialog.py
View file @
ff41c48a
...
@@ -15,11 +15,11 @@ class Dialog(Widget):
...
@@ -15,11 +15,11 @@ class Dialog(Widget):
self
.
widgetName
=
'__dialog__'
self
.
widgetName
=
'__dialog__'
Widget
.
_setup
(
self
,
master
,
cnf
)
Widget
.
_setup
(
self
,
master
,
cnf
)
self
.
num
=
self
.
tk
.
getint
(
self
.
num
=
self
.
tk
.
getint
(
apply
(
self
.
tk
.
call
,
self
.
tk
.
call
(
(
'tk_dialog'
,
self
.
_w
,
'tk_dialog'
,
self
.
_w
,
cnf
[
'title'
],
cnf
[
'text'
],
cnf
[
'title'
],
cnf
[
'text'
],
cnf
[
'bitmap'
],
cnf
[
'default'
])
cnf
[
'bitmap'
],
cnf
[
'default'
],
+
cnf
[
'strings'
]))
*
cnf
[
'strings'
]))
try
:
Widget
.
destroy
(
self
)
try
:
Widget
.
destroy
(
self
)
except
TclError
:
pass
except
TclError
:
pass
def
destroy
(
self
):
pass
def
destroy
(
self
):
pass
...
...
Lib/lib-tk/ScrolledText.py
View file @
ff41c48a
...
@@ -24,11 +24,11 @@ class ScrolledText(Text):
...
@@ -24,11 +24,11 @@ class ScrolledText(Text):
if
type
(
k
)
==
ClassType
or
k
==
'name'
:
if
type
(
k
)
==
ClassType
or
k
==
'name'
:
fcnf
[
k
]
=
cnf
[
k
]
fcnf
[
k
]
=
cnf
[
k
]
del
cnf
[
k
]
del
cnf
[
k
]
self
.
frame
=
apply
(
Frame
,
(
master
,),
fcnf
)
self
.
frame
=
Frame
(
master
,
**
fcnf
)
self
.
vbar
=
Scrollbar
(
self
.
frame
,
name
=
'vbar'
)
self
.
vbar
=
Scrollbar
(
self
.
frame
,
name
=
'vbar'
)
self
.
vbar
.
pack
(
side
=
RIGHT
,
fill
=
Y
)
self
.
vbar
.
pack
(
side
=
RIGHT
,
fill
=
Y
)
cnf
[
'name'
]
=
'text'
cnf
[
'name'
]
=
'text'
apply
(
Text
.
__init__
,
(
self
,
self
.
frame
),
cnf
)
Text
.
__init__
(
self
,
self
.
frame
,
**
cnf
)
self
.
pack
(
side
=
LEFT
,
fill
=
BOTH
,
expand
=
1
)
self
.
pack
(
side
=
LEFT
,
fill
=
BOTH
,
expand
=
1
)
self
[
'yscrollcommand'
]
=
self
.
vbar
.
set
self
[
'yscrollcommand'
]
=
self
.
vbar
.
set
self
.
vbar
[
'command'
]
=
self
.
yview
self
.
vbar
[
'command'
]
=
self
.
yview
...
...
Lib/lib-tk/Tix.py
View file @
ff41c48a
This diff is collapsed.
Click to expand it.
Lib/lib-tk/Tkinter.py
View file @
ff41c48a
This diff is collapsed.
Click to expand it.
Lib/lib-tk/tkColorChooser.py
View file @
ff41c48a
...
@@ -63,7 +63,7 @@ def askcolor(color = None, **options):
...
@@ -63,7 +63,7 @@ def askcolor(color = None, **options):
options
=
options
.
copy
()
options
=
options
.
copy
()
options
[
"initialcolor"
]
=
color
options
[
"initialcolor"
]
=
color
return
apply
(
Chooser
,
(),
options
).
show
()
return
Chooser
(
**
options
).
show
()
# --------------------------------------------------------------------
# --------------------------------------------------------------------
...
...
Lib/lib-tk/tkCommonDialog.py
View file @
ff41c48a
...
@@ -49,7 +49,7 @@ class Dialog:
...
@@ -49,7 +49,7 @@ class Dialog:
try
:
try
:
s
=
apply
(
w
.
tk
.
call
,
(
self
.
command
,)
+
w
.
_options
(
self
.
options
))
s
=
w
.
tk
.
call
(
self
.
command
,
*
w
.
_options
(
self
.
options
))
s
=
self
.
_fixresult
(
w
,
s
)
s
=
self
.
_fixresult
(
w
,
s
)
...
...
Lib/lib-tk/tkFont.py
View file @
ff41c48a
...
@@ -73,7 +73,7 @@ class Font:
...
@@ -73,7 +73,7 @@ class Font:
if
not
name
:
if
not
name
:
name
=
"font"
+
str
(
id
(
self
))
name
=
"font"
+
str
(
id
(
self
))
self
.
name
=
name
self
.
name
=
name
apply
(
root
.
tk
.
call
,
(
"font"
,
"create"
,
name
)
+
font
)
root
.
tk
.
call
(
"font"
,
"create"
,
name
,
*
font
)
# backlinks!
# backlinks!
self
.
_root
=
root
self
.
_root
=
root
self
.
_split
=
root
.
tk
.
splitlist
self
.
_split
=
root
.
tk
.
splitlist
...
@@ -90,7 +90,7 @@ class Font:
...
@@ -90,7 +90,7 @@ class Font:
def
copy
(
self
):
def
copy
(
self
):
"Return a distinct copy of the current font"
"Return a distinct copy of the current font"
return
apply
(
Font
,
(
self
.
_root
,),
self
.
actual
())
return
Font
(
self
.
_root
,
**
self
.
actual
())
def
actual
(
self
,
option
=
None
):
def
actual
(
self
,
option
=
None
):
"Return actual font attributes"
"Return actual font attributes"
...
@@ -108,8 +108,8 @@ class Font:
...
@@ -108,8 +108,8 @@ class Font:
def
config
(
self
,
**
options
):
def
config
(
self
,
**
options
):
"Modify font attributes"
"Modify font attributes"
if
options
:
if
options
:
apply
(
self
.
_call
,
(
"font"
,
"config"
,
self
.
name
)
+
self
.
_call
(
"font"
,
"config"
,
self
.
name
,
self
.
_set
(
options
))
*
self
.
_set
(
options
))
else
:
else
:
return
self
.
_mkdict
(
return
self
.
_mkdict
(
self
.
_split
(
self
.
_call
(
"font"
,
"config"
,
self
.
name
))
self
.
_split
(
self
.
_call
(
"font"
,
"config"
,
self
.
name
))
...
...
Lib/lib-tk/tkMessageBox.py
View file @
ff41c48a
...
@@ -72,37 +72,37 @@ def _show(title=None, message=None, icon=None, type=None, **options):
...
@@ -72,37 +72,37 @@ def _show(title=None, message=None, icon=None, type=None, **options):
if
type
:
options
[
"type"
]
=
type
if
type
:
options
[
"type"
]
=
type
if
title
:
options
[
"title"
]
=
title
if
title
:
options
[
"title"
]
=
title
if
message
:
options
[
"message"
]
=
message
if
message
:
options
[
"message"
]
=
message
return
apply
(
Message
,
(),
options
).
show
()
return
Message
(
**
options
).
show
()
def
showinfo
(
title
=
None
,
message
=
None
,
**
options
):
def
showinfo
(
title
=
None
,
message
=
None
,
**
options
):
"Show an info message"
"Show an info message"
return
apply
(
_show
,
(
title
,
message
,
INFO
,
OK
),
options
)
return
_show
(
title
,
message
,
INFO
,
OK
,
**
options
)
def
showwarning
(
title
=
None
,
message
=
None
,
**
options
):
def
showwarning
(
title
=
None
,
message
=
None
,
**
options
):
"Show a warning message"
"Show a warning message"
return
apply
(
_show
,
(
title
,
message
,
WARNING
,
OK
),
options
)
return
_show
(
title
,
message
,
WARNING
,
OK
,
**
options
)
def
showerror
(
title
=
None
,
message
=
None
,
**
options
):
def
showerror
(
title
=
None
,
message
=
None
,
**
options
):
"Show an error message"
"Show an error message"
return
apply
(
_show
,
(
title
,
message
,
ERROR
,
OK
),
options
)
return
_show
(
title
,
message
,
ERROR
,
OK
,
**
options
)
def
askquestion
(
title
=
None
,
message
=
None
,
**
options
):
def
askquestion
(
title
=
None
,
message
=
None
,
**
options
):
"Ask a question"
"Ask a question"
return
apply
(
_show
,
(
title
,
message
,
QUESTION
,
YESNO
),
options
)
return
_show
(
title
,
message
,
QUESTION
,
YESNO
,
**
options
)
def
askokcancel
(
title
=
None
,
message
=
None
,
**
options
):
def
askokcancel
(
title
=
None
,
message
=
None
,
**
options
):
"Ask if operation should proceed; return true if the answer is ok"
"Ask if operation should proceed; return true if the answer is ok"
s
=
apply
(
_show
,
(
title
,
message
,
QUESTION
,
OKCANCEL
),
options
)
s
=
_show
(
title
,
message
,
QUESTION
,
OKCANCEL
,
**
options
)
return
s
==
OK
return
s
==
OK
def
askyesno
(
title
=
None
,
message
=
None
,
**
options
):
def
askyesno
(
title
=
None
,
message
=
None
,
**
options
):
"Ask a question; return true if the answer is yes"
"Ask a question; return true if the answer is yes"
s
=
apply
(
_show
,
(
title
,
message
,
QUESTION
,
YESNO
),
options
)
s
=
_show
(
title
,
message
,
QUESTION
,
YESNO
,
**
options
)
return
s
==
YES
return
s
==
YES
def
askretrycancel
(
title
=
None
,
message
=
None
,
**
options
):
def
askretrycancel
(
title
=
None
,
message
=
None
,
**
options
):
"Ask if operation should be retried; return true if the answer is yes"
"Ask if operation should be retried; return true if the answer is yes"
s
=
apply
(
_show
,
(
title
,
message
,
WARNING
,
RETRYCANCEL
),
options
)
s
=
_show
(
title
,
message
,
WARNING
,
RETRYCANCEL
,
**
options
)
return
s
==
RETRY
return
s
==
RETRY
...
...
Lib/lib-tk/tkSimpleDialog.py
View file @
ff41c48a
...
@@ -249,7 +249,7 @@ def askinteger(title, prompt, **kw):
...
@@ -249,7 +249,7 @@ def askinteger(title, prompt, **kw):
Return value is an integer
Return value is an integer
'''
'''
d
=
apply
(
_QueryInteger
,
(
title
,
prompt
),
kw
)
d
=
_QueryInteger
(
title
,
prompt
,
**
kw
)
return
d
.
result
return
d
.
result
class
_QueryFloat
(
_QueryDialog
):
class
_QueryFloat
(
_QueryDialog
):
...
@@ -268,7 +268,7 @@ def askfloat(title, prompt, **kw):
...
@@ -268,7 +268,7 @@ def askfloat(title, prompt, **kw):
Return value is a float
Return value is a float
'''
'''
d
=
apply
(
_QueryFloat
,
(
title
,
prompt
),
kw
)
d
=
_QueryFloat
(
title
,
prompt
,
**
kw
)
return
d
.
result
return
d
.
result
class
_QueryString
(
_QueryDialog
):
class
_QueryString
(
_QueryDialog
):
...
@@ -300,7 +300,7 @@ def askstring(title, prompt, **kw):
...
@@ -300,7 +300,7 @@ def askstring(title, prompt, **kw):
Return value is a string
Return value is a string
'''
'''
d
=
apply
(
_QueryString
,
(
title
,
prompt
),
kw
)
d
=
_QueryString
(
title
,
prompt
,
**
kw
)
return
d
.
result
return
d
.
result
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
Lib/lib-tk/turtle.py
View file @
ff41c48a
...
@@ -354,11 +354,11 @@ def right(angle): _getpen().right(angle)
...
@@ -354,11 +354,11 @@ def right(angle): _getpen().right(angle)
def
up
():
_getpen
().
up
()
def
up
():
_getpen
().
up
()
def
down
():
_getpen
().
down
()
def
down
():
_getpen
().
down
()
def
width
(
width
):
_getpen
().
width
(
width
)
def
width
(
width
):
_getpen
().
width
(
width
)
def
color
(
*
args
):
apply
(
_getpen
().
color
,
args
)
def
color
(
*
args
):
_getpen
().
color
(
*
args
)
def
write
(
arg
,
move
=
0
):
_getpen
().
write
(
arg
,
move
)
def
write
(
arg
,
move
=
0
):
_getpen
().
write
(
arg
,
move
)
def
fill
(
flag
):
_getpen
().
fill
(
flag
)
def
fill
(
flag
):
_getpen
().
fill
(
flag
)
def
circle
(
radius
,
extent
=
None
):
_getpen
().
circle
(
radius
,
extent
)
def
circle
(
radius
,
extent
=
None
):
_getpen
().
circle
(
radius
,
extent
)
def
goto
(
*
args
):
apply
(
_getpen
().
goto
,
args
)
def
goto
(
*
args
):
_getpen
().
goto
(
*
args
)
def
heading
():
return
_getpen
().
heading
()
def
heading
():
return
_getpen
().
heading
()
def
setheading
(
angle
):
_getpen
().
setheading
(
angle
)
def
setheading
(
angle
):
_getpen
().
setheading
(
angle
)
def
position
():
return
_getpen
().
position
()
def
position
():
return
_getpen
().
position
()
...
...
Lib/plat-mac/Carbon/MediaDescr.py
View file @
ff41c48a
...
@@ -4,94 +4,94 @@ import struct
...
@@ -4,94 +4,94 @@ import struct
Error
=
'MediaDescr.Error'
Error
=
'MediaDescr.Error'
class
_MediaDescriptionCodec
:
class
_MediaDescriptionCodec
:
def
__init__
(
self
,
trunc
,
size
,
names
,
fmt
):
def
__init__
(
self
,
trunc
,
size
,
names
,
fmt
):
self
.
trunc
=
trunc
self
.
trunc
=
trunc
self
.
size
=
size
self
.
size
=
size
self
.
names
=
names
self
.
names
=
names
self
.
fmt
=
fmt
self
.
fmt
=
fmt
def
decode
(
self
,
data
):
def
decode
(
self
,
data
):
if
self
.
trunc
:
if
self
.
trunc
:
data
=
data
[:
self
.
size
]
data
=
data
[:
self
.
size
]
values
=
struct
.
unpack
(
self
.
fmt
,
data
)
values
=
struct
.
unpack
(
self
.
fmt
,
data
)
if
len
(
values
)
!=
len
(
self
.
names
):
if
len
(
values
)
!=
len
(
self
.
names
):
raise
Error
,
(
'Format length does not match number of names'
,
descr
)
raise
Error
,
(
'Format length does not match number of names'
,
descr
)
rv
=
{}
rv
=
{}
for
i
in
range
(
len
(
values
)):
for
i
in
range
(
len
(
values
)):
name
=
self
.
names
[
i
]
name
=
self
.
names
[
i
]
value
=
values
[
i
]
value
=
values
[
i
]
if
type
(
name
)
==
type
(()):
if
type
(
name
)
==
type
(()):
name
,
cod
,
dec
=
name
name
,
cod
,
dec
=
name
value
=
dec
(
value
)
value
=
dec
(
value
)
rv
[
name
]
=
value
rv
[
name
]
=
value
return
rv
return
rv
def
encode
(
dict
):
def
encode
(
dict
):
list
=
[
self
.
fmt
]
list
=
[
self
.
fmt
]
for
name
in
self
.
names
:
for
name
in
self
.
names
:
if
type
(
name
)
==
type
(()):
if
type
(
name
)
==
type
(()):
name
,
cod
,
dec
=
name
name
,
cod
,
dec
=
name
else
:
else
:
cod
=
dec
=
None
cod
=
dec
=
None
value
=
dict
[
name
]
value
=
dict
[
name
]
if
cod
:
if
cod
:
value
=
cod
(
value
)
value
=
cod
(
value
)
list
.
append
(
value
)
list
.
append
(
value
)
rv
=
apply
(
struct
.
pack
,
tuple
(
list
)
)
rv
=
struct
.
pack
(
*
list
)
return
rv
return
rv
# Helper functions
# Helper functions
def
_tofixed
(
float
):
def
_tofixed
(
float
):
hi
=
int
(
float
)
hi
=
int
(
float
)
lo
=
int
(
float
*
0x10000
)
&
0xffff
lo
=
int
(
float
*
0x10000
)
&
0xffff
return
(
hi
<<
16
)
|
lo
return
(
hi
<<
16
)
|
lo
def
_fromfixed
(
fixed
):
def
_fromfixed
(
fixed
):
hi
=
(
fixed
>>
16
)
&
0xffff
hi
=
(
fixed
>>
16
)
&
0xffff
lo
=
(
fixed
&
0xffff
)
lo
=
(
fixed
&
0xffff
)
return
hi
+
(
lo
/
float
(
0x10000
))
return
hi
+
(
lo
/
float
(
0x10000
))
def
_tostr31
(
str
):
def
_tostr31
(
str
):
return
chr
(
len
(
str
))
+
str
+
'
\
0
'
*
(
31
-
len
(
str
))
return
chr
(
len
(
str
))
+
str
+
'
\
0
'
*
(
31
-
len
(
str
))
def
_fromstr31
(
str31
):
def
_fromstr31
(
str31
):
return
str31
[
1
:
1
+
ord
(
str31
[
0
])]
return
str31
[
1
:
1
+
ord
(
str31
[
0
])]
SampleDescription
=
_MediaDescriptionCodec
(
SampleDescription
=
_MediaDescriptionCodec
(
1
,
# May be longer, truncate
1
,
# May be longer, truncate
16
,
# size
16
,
# size
(
'descSize'
,
'dataFormat'
,
'resvd1'
,
'resvd2'
,
'dataRefIndex'
),
# Attributes
(
'descSize'
,
'dataFormat'
,
'resvd1'
,
'resvd2'
,
'dataRefIndex'
),
# Attributes
"l4slhh"
# Format
"l4slhh"
# Format
)
)
SoundDescription
=
_MediaDescriptionCodec
(
SoundDescription
=
_MediaDescriptionCodec
(
1
,
1
,
36
,
36
,
(
'descSize'
,
'dataFormat'
,
'resvd1'
,
'resvd2'
,
'dataRefIndex'
,
(
'descSize'
,
'dataFormat'
,
'resvd1'
,
'resvd2'
,
'dataRefIndex'
,
'version'
,
'revlevel'
,
'vendor'
,
'numChannels'
,
'sampleSize'
,
'version'
,
'revlevel'
,
'vendor'
,
'numChannels'
,
'sampleSize'
,
'compressionID'
,
'packetSize'
,
(
'sampleRate'
,
_tofixed
,
_fromfixed
)),
'compressionID'
,
'packetSize'
,
(
'sampleRate'
,
_tofixed
,
_fromfixed
)),
"l4slhhhh4shhhhl"
# Format
"l4slhhhh4shhhhl"
# Format
)
)
SoundDescriptionV1
=
_MediaDescriptionCodec
(
SoundDescriptionV1
=
_MediaDescriptionCodec
(
1
,
1
,
52
,
52
,
(
'descSize'
,
'dataFormat'
,
'resvd1'
,
'resvd2'
,
'dataRefIndex'
,
(
'descSize'
,
'dataFormat'
,
'resvd1'
,
'resvd2'
,
'dataRefIndex'
,
'version'
,
'revlevel'
,
'vendor'
,
'numChannels'
,
'sampleSize'
,
'version'
,
'revlevel'
,
'vendor'
,
'numChannels'
,
'sampleSize'
,
'compressionID'
,
'packetSize'
,
(
'sampleRate'
,
_tofixed
,
_fromfixed
),
'samplesPerPacket'
,
'compressionID'
,
'packetSize'
,
(
'sampleRate'
,
_tofixed
,
_fromfixed
),
'samplesPerPacket'
,
'bytesPerPacket'
,
'bytesPerFrame'
,
'bytesPerSample'
),
'bytesPerPacket'
,
'bytesPerFrame'
,
'bytesPerSample'
),
"l4slhhhh4shhhhlllll"
# Format
"l4slhhhh4shhhhlllll"
# Format
)
)
ImageDescription
=
_MediaDescriptionCodec
(
ImageDescription
=
_MediaDescriptionCodec
(
1
,
# May be longer, truncate
1
,
# May be longer, truncate
86
,
# size
86
,
# size
(
'idSize'
,
'cType'
,
'resvd1'
,
'resvd2'
,
'dataRefIndex'
,
'version'
,
(
'idSize'
,
'cType'
,
'resvd1'
,
'resvd2'
,
'dataRefIndex'
,
'version'
,
'revisionLevel'
,
'vendor'
,
'temporalQuality'
,
'spatialQuality'
,
'revisionLevel'
,
'vendor'
,
'temporalQuality'
,
'spatialQuality'
,
'width'
,
'height'
,
(
'hRes'
,
_tofixed
,
_fromfixed
),
(
'vRes'
,
_tofixed
,
_fromfixed
),
'width'
,
'height'
,
(
'hRes'
,
_tofixed
,
_fromfixed
),
(
'vRes'
,
_tofixed
,
_fromfixed
),
'dataSize'
,
'frameCount'
,
(
'name'
,
_tostr31
,
_fromstr31
),
'dataSize'
,
'frameCount'
,
(
'name'
,
_tostr31
,
_fromstr31
),
'depth'
,
'clutID'
),
'depth'
,
'clutID'
),
'l4slhhhh4sllhhlllh32shh'
,
'l4slhhhh4sllhhlllh32shh'
,
)
)
# XXXX Others, like TextDescription and such, remain to be done.
# XXXX Others, like TextDescription and such, remain to be done.
Lib/plat-mac/EasyDialogs.py
View file @
ff41c48a
This diff is collapsed.
Click to expand it.
Lib/plat-mac/FrameWork.py
View file @
ff41c48a
This diff is collapsed.
Click to expand it.
Lib/plat-mac/MiniAEFrame.py
View file @
ff41c48a
This diff is collapsed.
Click to expand it.
Lib/plat-mac/argvemulator.py
View file @
ff41c48a
...
@@ -11,104 +11,104 @@ from Carbon.Events import *
...
@@ -11,104 +11,104 @@ from Carbon.Events import *
import
aetools
import
aetools
class
ArgvCollector
:
class
ArgvCollector
:
"""A minimal FrameWork.Application-like class"""
"""A minimal FrameWork.Application-like class"""
def
__init__
(
self
):
def
__init__
(
self
):
self
.
quitting
=
0
self
.
quitting
=
0
self
.
ae_handlers
=
{}
self
.
ae_handlers
=
{}
# Remove the funny -psn_xxx_xxx argument
# Remove the funny -psn_xxx_xxx argument
if
len
(
sys
.
argv
)
>
1
and
sys
.
argv
[
1
][:
4
]
==
'-psn'
:
if
len
(
sys
.
argv
)
>
1
and
sys
.
argv
[
1
][:
4
]
==
'-psn'
:
del
sys
.
argv
[
1
]
del
sys
.
argv
[
1
]
self
.
installaehandler
(
'aevt'
,
'oapp'
,
self
.
open_app
)
self
.
installaehandler
(
'aevt'
,
'oapp'
,
self
.
open_app
)
self
.
installaehandler
(
'aevt'
,
'odoc'
,
self
.
open_file
)
self
.
installaehandler
(
'aevt'
,
'odoc'
,
self
.
open_file
)
def
installaehandler
(
self
,
classe
,
type
,
callback
):
def
installaehandler
(
self
,
classe
,
type
,
callback
):
AE
.
AEInstallEventHandler
(
classe
,
type
,
self
.
callback_wrapper
)
AE
.
AEInstallEventHandler
(
classe
,
type
,
self
.
callback_wrapper
)
self
.
ae_handlers
[(
classe
,
type
)]
=
callback
self
.
ae_handlers
[(
classe
,
type
)]
=
callback
def
close
(
self
):
def
close
(
self
):
for
classe
,
type
in
self
.
ae_handlers
.
keys
():
for
classe
,
type
in
self
.
ae_handlers
.
keys
():
AE
.
AERemoveEventHandler
(
classe
,
type
)
AE
.
AERemoveEventHandler
(
classe
,
type
)
def
mainloop
(
self
,
mask
=
highLevelEventMask
,
timeout
=
1
*
60
):
def
mainloop
(
self
,
mask
=
highLevelEventMask
,
timeout
=
1
*
60
):
stoptime
=
Evt
.
TickCount
()
+
timeout
stoptime
=
Evt
.
TickCount
()
+
timeout
while
not
self
.
quitting
and
Evt
.
TickCount
()
<
stoptime
:
while
not
self
.
quitting
and
Evt
.
TickCount
()
<
stoptime
:
self
.
dooneevent
(
mask
,
timeout
)
self
.
dooneevent
(
mask
,
timeout
)
self
.
close
()
self
.
close
()
def
_quit
(
self
):
def
_quit
(
self
):
self
.
quitting
=
1
self
.
quitting
=
1
def
dooneevent
(
self
,
mask
=
highLevelEventMask
,
timeout
=
1
*
60
):
def
dooneevent
(
self
,
mask
=
highLevelEventMask
,
timeout
=
1
*
60
):
got
,
event
=
Evt
.
WaitNextEvent
(
mask
,
timeout
)
got
,
event
=
Evt
.
WaitNextEvent
(
mask
,
timeout
)
if
got
:
if
got
:
self
.
lowlevelhandler
(
event
)
self
.
lowlevelhandler
(
event
)
def
lowlevelhandler
(
self
,
event
):
def
lowlevelhandler
(
self
,
event
):
what
,
message
,
when
,
where
,
modifiers
=
event
what
,
message
,
when
,
where
,
modifiers
=
event
h
,
v
=
where
h
,
v
=
where
if
what
==
kHighLevelEvent
:
if
what
==
kHighLevelEvent
:
try
:
try
:
AE
.
AEProcessAppleEvent
(
event
)
AE
.
AEProcessAppleEvent
(
event
)
except
AE
.
Error
,
err
:
except
AE
.
Error
,
err
:
msg
=
"High Level Event: %s %s"
%
\
msg
=
"High Level Event: %s %s"
%
\
(
`hex(message)`
,
`hex(h | (v<<16))`
)
(
`hex(message)`
,
`hex(h | (v<<16))`
)
print
'AE error: '
,
err
print
'AE error: '
,
err
print
'in'
,
msg
print
'in'
,
msg
traceback
.
print_exc
()
traceback
.
print_exc
()
return
return
else
:
else
:
print
"Unhandled event:"
,
event
print
"Unhandled event:"
,
event
def
callback_wrapper
(
self
,
_request
,
_reply
):
def
callback_wrapper
(
self
,
_request
,
_reply
):
_parameters
,
_attributes
=
aetools
.
unpackevent
(
_request
)
_parameters
,
_attributes
=
aetools
.
unpackevent
(
_request
)
_class
=
_attributes
[
'evcl'
].
type
_class
=
_attributes
[
'evcl'
].
type
_type
=
_attributes
[
'evid'
].
type
_type
=
_attributes
[
'evid'
].
type
if
self
.
ae_handlers
.
has_key
((
_class
,
_type
)):
if
self
.
ae_handlers
.
has_key
((
_class
,
_type
)):
_function
=
self
.
ae_handlers
[(
_class
,
_type
)]
_function
=
self
.
ae_handlers
[(
_class
,
_type
)]
elif
self
.
ae_handlers
.
has_key
((
_class
,
'****'
)):
elif
self
.
ae_handlers
.
has_key
((
_class
,
'****'
)):
_function
=
self
.
ae_handlers
[(
_class
,
'****'
)]
_function
=
self
.
ae_handlers
[(
_class
,
'****'
)]
elif
self
.
ae_handlers
.
has_key
((
'****'
,
'****'
)):
elif
self
.
ae_handlers
.
has_key
((
'****'
,
'****'
)):
_function
=
self
.
ae_handlers
[(
'****'
,
'****'
)]
_function
=
self
.
ae_handlers
[(
'****'
,
'****'
)]
else
:
else
:
raise
'Cannot happen: AE callback without handler'
,
(
_class
,
_type
)
raise
'Cannot happen: AE callback without handler'
,
(
_class
,
_type
)
# XXXX Do key-to-name mapping here
# XXXX Do key-to-name mapping here
_parameters
[
'_attributes'
]
=
_attributes
_parameters
[
'_attributes'
]
=
_attributes
_parameters
[
'_class'
]
=
_class
_parameters
[
'_class'
]
=
_class
_parameters
[
'_type'
]
=
_type
_parameters
[
'_type'
]
=
_type
if
_parameters
.
has_key
(
'----'
):
if
_parameters
.
has_key
(
'----'
):
_object
=
_parameters
[
'----'
]
_object
=
_parameters
[
'----'
]
del
_parameters
[
'----'
]
del
_parameters
[
'----'
]
# The try/except that used to be here can mask programmer errors.
# The try/except that used to be here can mask programmer errors.
# Let the program crash, the programmer can always add a **args
# Let the program crash, the programmer can always add a **args
# to the formal parameter list.
# to the formal parameter list.
rv
=
apply
(
_function
,
(
_object
,),
_parameters
)
rv
=
_function
(
_object
,
**
_parameters
)
else
:
else
:
#Same try/except comment as above
#Same try/except comment as above
rv
=
apply
(
_function
,
(),
_parameters
)
rv
=
_function
(
**
_parameters
)
if
rv
==
None
:
if
rv
==
None
:
aetools
.
packevent
(
_reply
,
{})
aetools
.
packevent
(
_reply
,
{})
else
:
else
:
aetools
.
packevent
(
_reply
,
{
'----'
:
rv
})
aetools
.
packevent
(
_reply
,
{
'----'
:
rv
})
def
open_app
(
self
,
**
args
):
def
open_app
(
self
,
**
args
):
self
.
_quit
()
self
.
_quit
()
def
open_file
(
self
,
_object
=
None
,
**
args
):
def
open_file
(
self
,
_object
=
None
,
**
args
):
for
alias
in
_object
:
for
alias
in
_object
:
fsr
=
alias
.
FSResolveAlias
(
None
)[
0
]
fsr
=
alias
.
FSResolveAlias
(
None
)[
0
]
pathname
=
fsr
.
as_pathname
()
pathname
=
fsr
.
as_pathname
()
sys
.
argv
.
append
(
pathname
)
sys
.
argv
.
append
(
pathname
)
self
.
_quit
()
self
.
_quit
()
def
other
(
self
,
_object
=
None
,
_class
=
None
,
_type
=
None
,
**
args
):
def
other
(
self
,
_object
=
None
,
_class
=
None
,
_type
=
None
,
**
args
):
print
'Ignore AppleEvent'
,
(
_class
,
_type
),
'for'
,
_object
,
'Other args:'
,
args
print
'Ignore AppleEvent'
,
(
_class
,
_type
),
'for'
,
_object
,
'Other args:'
,
args
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
ArgvCollector
().
mainloop
()
ArgvCollector
().
mainloop
()
print
"sys.argv="
,
sys
.
argv
print
"sys.argv="
,
sys
.
argv
Lib/plat-mac/icopen.py
View file @
ff41c48a
...
@@ -29,7 +29,7 @@ INSTALLATION
...
@@ -29,7 +29,7 @@ INSTALLATION
Put this file in your Python path, and create a file named {Python}:sitecustomize.py
Put this file in your Python path, and create a file named {Python}:sitecustomize.py
that contains:
that contains:
import icopen
import icopen
(If {Python}:sitecustomizer.py already exists, just add the 'import' line to it.)
(If {Python}:sitecustomizer.py already exists, just add the 'import' line to it.)
...
@@ -42,18 +42,18 @@ import __builtin__
...
@@ -42,18 +42,18 @@ import __builtin__
_builtin_open
=
globals
().
get
(
'_builtin_open'
,
__builtin__
.
open
)
_builtin_open
=
globals
().
get
(
'_builtin_open'
,
__builtin__
.
open
)
def
_open_with_typer
(
*
args
):
def
_open_with_typer
(
*
args
):
file
=
apply
(
_builtin_open
,
args
)
file
=
_builtin_open
(
*
args
)
filename
=
args
[
0
]
filename
=
args
[
0
]
mode
=
'r'
mode
=
'r'
if
args
[
1
:]:
if
args
[
1
:]:
mode
=
args
[
1
]
mode
=
args
[
1
]
if
mode
[
0
]
==
'w'
:
if
mode
[
0
]
==
'w'
:
from
ic
import
error
,
settypecreator
from
ic
import
error
,
settypecreator
try
:
try
:
settypecreator
(
filename
)
settypecreator
(
filename
)
except
error
:
except
error
:
pass
pass
return
file
return
file
__builtin__
.
open
=
_open_with_typer
__builtin__
.
open
=
_open_with_typer
...
@@ -63,4 +63,4 @@ _open_with_typer('test.py', 'w')
...
@@ -63,4 +63,4 @@ _open_with_typer('test.py', 'w')
_open_with_typer('test.txt', 'w')
_open_with_typer('test.txt', 'w')
_open_with_typer('test.html', 'w')
_open_with_typer('test.html', 'w')
_open_with_typer('test.foo', 'w')
_open_with_typer('test.foo', 'w')
"""
"""
\ No newline at end of file
Lib/test/reperf.py
View file @
ff41c48a
...
@@ -12,7 +12,7 @@ def timefunc(n, func, *args, **kw):
...
@@ -12,7 +12,7 @@ def timefunc(n, func, *args, **kw):
t0
=
time
.
clock
()
t0
=
time
.
clock
()
try
:
try
:
for
i
in
range
(
n
):
for
i
in
range
(
n
):
result
=
apply
(
func
,
args
,
kw
)
result
=
func
(
*
args
,
**
kw
)
return
result
return
result
finally
:
finally
:
t1
=
time
.
clock
()
t1
=
time
.
clock
()
...
...
Lib/test/test_curses.py
View file @
ff41c48a
...
@@ -26,7 +26,7 @@ def window_funcs(stdscr):
...
@@ -26,7 +26,7 @@ def window_funcs(stdscr):
for
meth
in
[
stdscr
.
addch
,
stdscr
.
addstr
]:
for
meth
in
[
stdscr
.
addch
,
stdscr
.
addstr
]:
for
args
in
[(
'a'
),
(
'a'
,
curses
.
A_BOLD
),
for
args
in
[(
'a'
),
(
'a'
,
curses
.
A_BOLD
),
(
4
,
4
,
'a'
),
(
5
,
5
,
'a'
,
curses
.
A_BOLD
)]:
(
4
,
4
,
'a'
),
(
5
,
5
,
'a'
,
curses
.
A_BOLD
)]:
apply
(
meth
,
args
)
meth
(
*
args
)
for
meth
in
[
stdscr
.
box
,
stdscr
.
clear
,
stdscr
.
clrtobot
,
for
meth
in
[
stdscr
.
box
,
stdscr
.
clear
,
stdscr
.
clrtobot
,
stdscr
.
clrtoeol
,
stdscr
.
cursyncup
,
stdscr
.
delch
,
stdscr
.
clrtoeol
,
stdscr
.
cursyncup
,
stdscr
.
delch
,
...
...
Lib/xml/dom/minidom.py
View file @
ff41c48a
...
@@ -1902,7 +1902,7 @@ def _get_StringIO():
...
@@ -1902,7 +1902,7 @@ def _get_StringIO():
return
StringIO
()
return
StringIO
()
def
_do_pulldom_parse
(
func
,
args
,
kwargs
):
def
_do_pulldom_parse
(
func
,
args
,
kwargs
):
events
=
apply
(
func
,
args
,
kwargs
)
events
=
func
(
*
args
,
**
kwargs
)
toktype
,
rootNode
=
events
.
getEvent
()
toktype
,
rootNode
=
events
.
getEvent
()
events
.
expandNode
(
rootNode
)
events
.
expandNode
(
rootNode
)
events
.
clear
()
events
.
clear
()
...
@@ -1915,7 +1915,7 @@ def parse(file, parser=None, bufsize=None):
...
@@ -1915,7 +1915,7 @@ def parse(file, parser=None, bufsize=None):
return
expatbuilder
.
parse
(
file
)
return
expatbuilder
.
parse
(
file
)
else
:
else
:
from
xml.dom
import
pulldom
from
xml.dom
import
pulldom
return
_do_pulldom_parse
(
pulldom
.
parse
,
(
file
,),
return
_do_pulldom_parse
(
pulldom
.
parse
,
(
file
,),
{
'parser'
:
parser
,
'bufsize'
:
bufsize
})
{
'parser'
:
parser
,
'bufsize'
:
bufsize
})
def
parseString
(
string
,
parser
=
None
):
def
parseString
(
string
,
parser
=
None
):
...
...
Python/bltinmodule.c
View file @
ff41c48a
...
@@ -112,7 +112,10 @@ PyDoc_STRVAR(apply_doc,
...
@@ -112,7 +112,10 @@ PyDoc_STRVAR(apply_doc,
\n
\
\n
\
Call a callable object with positional arguments taken from the tuple args,
\n
\
Call a callable object with positional arguments taken from the tuple args,
\n
\
and keyword arguments taken from the optional dictionary kwargs.
\n
\
and keyword arguments taken from the optional dictionary kwargs.
\n
\
Note that classes are callable, as are instances with a __call__() method."
);
Note that classes are callable, as are instances with a __call__() method.
\n
\
\n
\
Deprecated since release 2.3. Instead, use the extended call syntax:
\n
\
function(*args, **keywords)."
);
static
PyObject
*
static
PyObject
*
...
...
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