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
d630c04a
Commit
d630c04a
authored
Apr 02, 2010
by
Florent Xicluna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#7092: Fix additional "-3" warnings in the idlelib package, and convert to absolute imports.
parent
f28dd0d1
Changes
37
Hide whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
169 additions
and
149 deletions
+169
-149
Lib/idlelib/AutoComplete.py
Lib/idlelib/AutoComplete.py
+9
-9
Lib/idlelib/AutoCompleteWindow.py
Lib/idlelib/AutoCompleteWindow.py
+6
-6
Lib/idlelib/Bindings.py
Lib/idlelib/Bindings.py
+2
-2
Lib/idlelib/CallTips.py
Lib/idlelib/CallTips.py
+2
-2
Lib/idlelib/ClassBrowser.py
Lib/idlelib/ClassBrowser.py
+4
-4
Lib/idlelib/CodeContext.py
Lib/idlelib/CodeContext.py
+1
-1
Lib/idlelib/ColorDelegator.py
Lib/idlelib/ColorDelegator.py
+3
-3
Lib/idlelib/Debugger.py
Lib/idlelib/Debugger.py
+3
-3
Lib/idlelib/EditorWindow.py
Lib/idlelib/EditorWindow.py
+19
-19
Lib/idlelib/FileList.py
Lib/idlelib/FileList.py
+3
-3
Lib/idlelib/FormatParagraph.py
Lib/idlelib/FormatParagraph.py
+1
-1
Lib/idlelib/GrepDialog.py
Lib/idlelib/GrepDialog.py
+3
-3
Lib/idlelib/HyperParser.py
Lib/idlelib/HyperParser.py
+1
-1
Lib/idlelib/IOBinding.py
Lib/idlelib/IOBinding.py
+1
-1
Lib/idlelib/IdleHistory.py
Lib/idlelib/IdleHistory.py
+1
-1
Lib/idlelib/MultiCall.py
Lib/idlelib/MultiCall.py
+23
-8
Lib/idlelib/ObjectBrowser.py
Lib/idlelib/ObjectBrowser.py
+1
-1
Lib/idlelib/OutputWindow.py
Lib/idlelib/OutputWindow.py
+5
-4
Lib/idlelib/ParenMatch.py
Lib/idlelib/ParenMatch.py
+2
-2
Lib/idlelib/PathBrowser.py
Lib/idlelib/PathBrowser.py
+3
-3
Lib/idlelib/Percolator.py
Lib/idlelib/Percolator.py
+2
-2
Lib/idlelib/PyShell.py
Lib/idlelib/PyShell.py
+22
-22
Lib/idlelib/RemoteDebugger.py
Lib/idlelib/RemoteDebugger.py
+2
-2
Lib/idlelib/RemoteObjectBrowser.py
Lib/idlelib/RemoteObjectBrowser.py
+1
-1
Lib/idlelib/ReplaceDialog.py
Lib/idlelib/ReplaceDialog.py
+3
-2
Lib/idlelib/ScriptBinding.py
Lib/idlelib/ScriptBinding.py
+2
-2
Lib/idlelib/SearchDialog.py
Lib/idlelib/SearchDialog.py
+2
-2
Lib/idlelib/StackViewer.py
Lib/idlelib/StackViewer.py
+2
-2
Lib/idlelib/TreeWidget.py
Lib/idlelib/TreeWidget.py
+4
-4
Lib/idlelib/UndoDelegator.py
Lib/idlelib/UndoDelegator.py
+3
-2
Lib/idlelib/ZoomHeight.py
Lib/idlelib/ZoomHeight.py
+2
-1
Lib/idlelib/aboutDialog.py
Lib/idlelib/aboutDialog.py
+4
-4
Lib/idlelib/configDialog.py
Lib/idlelib/configDialog.py
+7
-7
Lib/idlelib/configHandler.py
Lib/idlelib/configHandler.py
+1
-1
Lib/idlelib/keybindingDialog.py
Lib/idlelib/keybindingDialog.py
+2
-2
Lib/idlelib/macosxSupport.py
Lib/idlelib/macosxSupport.py
+6
-6
Lib/idlelib/run.py
Lib/idlelib/run.py
+11
-10
No files found.
Lib/idlelib/AutoComplete.py
View file @
d630c04a
...
...
@@ -7,12 +7,7 @@ import os
import
sys
import
string
from
configHandler
import
idleConf
import
AutoCompleteWindow
from
HyperParser
import
HyperParser
import
__main__
from
idlelib.configHandler
import
idleConf
# This string includes all chars that may be in a file name (without a path
# separator)
...
...
@@ -23,6 +18,11 @@ ID_CHARS = string.ascii_letters + string.digits + "_"
# These constants represent the two different types of completions
COMPLETE_ATTRIBUTES
,
COMPLETE_FILES
=
range
(
1
,
2
+
1
)
from
idlelib
import
AutoCompleteWindow
from
idlelib.HyperParser
import
HyperParser
import
__main__
SEPS
=
os
.
sep
if
os
.
altsep
:
# e.g. '/' on Windows...
SEPS
+=
os
.
altsep
...
...
@@ -193,7 +193,7 @@ class AutoComplete:
smalll
=
eval
(
"__all__"
,
namespace
)
smalll
.
sort
()
else
:
smalll
=
filter
(
lambda
s
:
s
[:
1
]
!=
'_'
,
bigl
)
smalll
=
[
s
for
s
in
bigl
if
s
[:
1
]
!=
'_'
]
else
:
try
:
entity
=
self
.
get_entity
(
what
)
...
...
@@ -203,7 +203,7 @@ class AutoComplete:
smalll
=
entity
.
__all__
smalll
.
sort
()
else
:
smalll
=
filter
(
lambda
s
:
s
[:
1
]
!=
'_'
,
bigl
)
smalll
=
[
s
for
s
in
bigl
if
s
[:
1
]
!=
'_'
]
except
:
return
[],
[]
...
...
@@ -214,7 +214,7 @@ class AutoComplete:
expandedpath
=
os
.
path
.
expanduser
(
what
)
bigl
=
os
.
listdir
(
expandedpath
)
bigl
.
sort
()
smalll
=
filter
(
lambda
s
:
s
[:
1
]
!=
'.'
,
bigl
)
smalll
=
[
s
for
s
in
bigl
if
s
[:
1
]
!=
'.'
]
except
OSError
:
return
[],
[]
...
...
Lib/idlelib/AutoCompleteWindow.py
View file @
d630c04a
...
...
@@ -2,8 +2,8 @@
An auto-completion window for IDLE, used by the AutoComplete extension
"""
from
Tkinter
import
*
from
MultiCall
import
MC_SHIFT
import
AutoComplete
from
idlelib.
MultiCall
import
MC_SHIFT
from
idlelib.AutoComplete
import
COMPLETE_FILES
,
COMPLETE_ATTRIBUTES
HIDE_VIRTUAL_EVENT_NAME
=
"<<autocompletewindow-hide>>"
HIDE_SEQUENCES
=
(
"<FocusOut>"
,
"<ButtonPress>"
)
...
...
@@ -264,7 +264,7 @@ class AutoCompleteWindow:
if
keysym
!=
"Tab"
:
self
.
lastkey_was_tab
=
False
if
(
len
(
keysym
)
==
1
or
keysym
in
(
"underscore"
,
"BackSpace"
)
or
(
self
.
mode
==
AutoComplete
.
COMPLETE_FILES
and
keysym
in
or
(
self
.
mode
==
COMPLETE_FILES
and
keysym
in
(
"period"
,
"minus"
)))
\
and
not
(
state
&
~
MC_SHIFT
):
# Normal editing of text
...
...
@@ -292,10 +292,10 @@ class AutoCompleteWindow:
self
.
hide_window
()
return
elif
(
self
.
mode
==
AutoComplete
.
COMPLETE_ATTRIBUTES
and
keysym
in
elif
(
self
.
mode
==
COMPLETE_ATTRIBUTES
and
keysym
in
(
"period"
,
"space"
,
"parenleft"
,
"parenright"
,
"bracketleft"
,
"bracketright"
))
or
\
(
self
.
mode
==
AutoComplete
.
COMPLETE_FILES
and
keysym
in
(
self
.
mode
==
COMPLETE_FILES
and
keysym
in
(
"slash"
,
"backslash"
,
"quotedbl"
,
"apostrophe"
))
\
and
not
(
state
&
~
MC_SHIFT
):
# If start is a prefix of the selection, but is not '' when
...
...
@@ -303,7 +303,7 @@ class AutoCompleteWindow:
# selected completion. Anyway, close the list.
cursel
=
int
(
self
.
listbox
.
curselection
()[
0
])
if
self
.
completions
[
cursel
][:
len
(
self
.
start
)]
==
self
.
start
\
and
(
self
.
mode
==
AutoComplete
.
COMPLETE_ATTRIBUTES
or
self
.
start
):
and
(
self
.
mode
==
COMPLETE_ATTRIBUTES
or
self
.
start
):
self
.
_change_start
(
self
.
completions
[
cursel
])
self
.
hide_window
()
return
...
...
Lib/idlelib/Bindings.py
View file @
d630c04a
...
...
@@ -9,8 +9,8 @@ windows.
"""
import
sys
from
configHandler
import
idleConf
import
macosxSupport
from
idlelib.
configHandler
import
idleConf
from
idlelib
import
macosxSupport
menudefs
=
[
# underscore prefixes character to underscore
...
...
Lib/idlelib/CallTips.py
View file @
d630c04a
...
...
@@ -9,8 +9,8 @@ import re
import
sys
import
types
import
CallTipWindow
from
HyperParser
import
HyperParser
from
idlelib
import
CallTipWindow
from
idlelib.
HyperParser
import
HyperParser
import
__main__
...
...
Lib/idlelib/ClassBrowser.py
View file @
d630c04a
...
...
@@ -14,10 +14,10 @@ import os
import
sys
import
pyclbr
import
PyShell
from
WindowList
import
ListedToplevel
from
TreeWidget
import
TreeNode
,
TreeItem
,
ScrolledCanvas
from
configHandler
import
idleConf
from
idlelib
import
PyShell
from
idlelib.
WindowList
import
ListedToplevel
from
idlelib.
TreeWidget
import
TreeNode
,
TreeItem
,
ScrolledCanvas
from
idlelib.
configHandler
import
idleConf
class
ClassBrowser
:
...
...
Lib/idlelib/CodeContext.py
View file @
d630c04a
...
...
@@ -11,9 +11,9 @@ not open blocks are not shown in the context hints pane.
"""
import
Tkinter
from
Tkconstants
import
TOP
,
LEFT
,
X
,
W
,
SUNKEN
from
configHandler
import
idleConf
import
re
from
sys
import
maxint
as
INFINITY
from
idlelib.configHandler
import
idleConf
BLOCKOPENERS
=
set
([
"class"
,
"def"
,
"elif"
,
"else"
,
"except"
,
"finally"
,
"for"
,
"if"
,
"try"
,
"while"
,
"with"
])
...
...
Lib/idlelib/ColorDelegator.py
View file @
d630c04a
...
...
@@ -3,8 +3,8 @@ import re
import
keyword
import
__builtin__
from
Tkinter
import
*
from
Delegator
import
Delegator
from
configHandler
import
idleConf
from
idlelib.
Delegator
import
Delegator
from
idlelib.
configHandler
import
idleConf
DEBUG
=
False
...
...
@@ -248,7 +248,7 @@ class ColorDelegator(Delegator):
self
.
tag_remove
(
tag
,
"1.0"
,
"end"
)
def
main
():
from
Percolator
import
Percolator
from
idlelib.
Percolator
import
Percolator
root
=
Tk
()
root
.
wm_protocol
(
"WM_DELETE_WINDOW"
,
root
.
quit
)
text
=
Text
(
background
=
"white"
)
...
...
Lib/idlelib/Debugger.py
View file @
d630c04a
...
...
@@ -2,9 +2,9 @@ import os
import
bdb
import
types
from
Tkinter
import
*
from
WindowList
import
ListedToplevel
from
ScrolledList
import
ScrolledList
import
macosxSupport
from
idlelib.
WindowList
import
ListedToplevel
from
idlelib.
ScrolledList
import
ScrolledList
from
idlelib
import
macosxSupport
class
Idb
(
bdb
.
Bdb
):
...
...
Lib/idlelib/EditorWindow.py
View file @
d630c04a
...
...
@@ -5,18 +5,18 @@ import imp
from
Tkinter
import
*
import
tkSimpleDialog
import
tkMessageBox
from
MultiCall
import
MultiCallCreator
import
webbrowser
import
idlever
import
WindowList
import
SearchDialog
import
GrepDialog
import
ReplaceDialog
import
PyParse
from
configHandler
import
idleConf
import
aboutDialog
,
textView
,
configDialog
import
macosxSupport
from
idlelib.MultiCall
import
MultiCallCreator
from
idlelib
import
idlever
from
idlelib
import
WindowList
from
idlelib
import
SearchDialog
from
idlelib
import
GrepDialog
from
idlelib
import
ReplaceDialog
from
idlelib
import
PyParse
from
idlelib.configHandler
import
idleConf
from
idlelib
import
aboutDialog
,
textView
,
configDialog
from
idlelib
import
macosxSupport
# The default tab setting for a Text widget, in average-width characters.
TK_TABWIDTH_DEFAULT
=
8
...
...
@@ -51,13 +51,13 @@ def _find_module(fullname, path=None):
return
file
,
filename
,
descr
class
EditorWindow
(
object
):
from
Percolator
import
Percolator
from
ColorDelegator
import
ColorDelegator
from
UndoDelegator
import
UndoDelegator
from
IOBinding
import
IOBinding
,
filesystemencoding
,
encoding
import
Bindings
from
idlelib.
Percolator
import
Percolator
from
idlelib.
ColorDelegator
import
ColorDelegator
from
idlelib.
UndoDelegator
import
UndoDelegator
from
idlelib.
IOBinding
import
IOBinding
,
filesystemencoding
,
encoding
from
idlelib
import
Bindings
from
Tkinter
import
Toplevel
from
MultiStatusBar
import
MultiStatusBar
from
idlelib.
MultiStatusBar
import
MultiStatusBar
help_url
=
None
...
...
@@ -580,11 +580,11 @@ class EditorWindow(object):
return
None
head
,
tail
=
os
.
path
.
split
(
filename
)
base
,
ext
=
os
.
path
.
splitext
(
tail
)
import
ClassBrowser
from
idlelib
import
ClassBrowser
ClassBrowser
.
ClassBrowser
(
self
.
flist
,
base
,
[
head
])
def
open_path_browser
(
self
,
event
=
None
):
import
PathBrowser
from
idlelib
import
PathBrowser
PathBrowser
.
PathBrowser
(
self
.
flist
)
def
gotoline
(
self
,
lineno
):
...
...
Lib/idlelib/FileList.py
View file @
d630c04a
...
...
@@ -5,8 +5,8 @@ import tkMessageBox
class
FileList
:
from
EditorWindow
import
EditorWindow
# class variable, may be overridden
# e.g. by PyShellFileList
# N.B. this import overridden in PyShellFileList.
from
idlelib.EditorWindow
import
EditorWindow
def
__init__
(
self
,
root
):
self
.
root
=
root
...
...
@@ -106,7 +106,7 @@ class FileList:
def
_test
():
from
EditorWindow
import
fixwordbreaks
from
idlelib.
EditorWindow
import
fixwordbreaks
import
sys
root
=
Tk
()
fixwordbreaks
(
root
)
...
...
Lib/idlelib/FormatParagraph.py
View file @
d630c04a
...
...
@@ -15,7 +15,7 @@
# * Fancy comments, like this bulleted list, arent handled :-)
import
re
from
configHandler
import
idleConf
from
idlelib.
configHandler
import
idleConf
class
FormatParagraph
:
...
...
Lib/idlelib/GrepDialog.py
View file @
d630c04a
...
...
@@ -2,8 +2,8 @@ import os
import
fnmatch
import
sys
from
Tkinter
import
*
import
SearchEngine
from
SearchDialogBase
import
SearchDialogBase
from
idlelib
import
SearchEngine
from
idlelib.
SearchDialogBase
import
SearchDialogBase
def
grep
(
text
,
io
=
None
,
flist
=
None
):
root
=
text
.
_root
()
...
...
@@ -63,7 +63,7 @@ class GrepDialog(SearchDialogBase):
if
not
path
:
self
.
top
.
bell
()
return
from
OutputWindow
import
OutputWindow
from
idlelib.
OutputWindow
import
OutputWindow
save
=
sys
.
stdout
try
:
sys
.
stdout
=
OutputWindow
(
self
.
flist
)
...
...
Lib/idlelib/HyperParser.py
View file @
d630c04a
...
...
@@ -10,7 +10,7 @@ structure of code, used by extensions to help the user.
import
string
import
keyword
import
PyParse
from
idlelib
import
PyParse
class
HyperParser
:
...
...
Lib/idlelib/IOBinding.py
View file @
d630c04a
...
...
@@ -16,7 +16,7 @@ import re
from
Tkinter
import
*
from
SimpleDialog
import
SimpleDialog
from
configHandler
import
idleConf
from
idlelib.
configHandler
import
idleConf
try
:
from
codecs
import
BOM_UTF8
...
...
Lib/idlelib/IdleHistory.py
View file @
d630c04a
from
configHandler
import
idleConf
from
idlelib.
configHandler
import
idleConf
class
History
:
...
...
Lib/idlelib/MultiCall.py
View file @
d630c04a
...
...
@@ -33,7 +33,7 @@ import sys
import
string
import
re
import
Tkinter
import
macosxSupport
from
idlelib
import
macosxSupport
# the event type constants, which define the meaning of mc_type
MC_KEYPRESS
=
0
;
MC_KEYRELEASE
=
1
;
MC_BUTTONPRESS
=
2
;
MC_BUTTONRELEASE
=
3
;
...
...
@@ -111,12 +111,27 @@ _state_names = [''.join(m[0]+'-'
for
i
,
m
in
enumerate
(
_modifiers
)
if
(
1
<<
i
)
&
s
)
for
s
in
_states
]
_state_subsets
=
map
(
lambda
i
:
filter
(
lambda
j
:
not
(
j
&
(
~
i
)),
_states
),
_states
)
for
l
in
_state_subsets
:
l
.
sort
(
lambda
a
,
b
,
nummod
=
lambda
x
:
len
(
filter
(
lambda
i
:
(
1
<<
i
)
&
x
,
range
(
len
(
_modifiers
)))):
nummod
(
b
)
-
nummod
(
a
))
def
expand_substates
(
states
):
'''For each item of states return a list containing all combinations of
that item with individual bits reset, sorted by the number of set bits.
'''
def
nbits
(
n
):
"number of bits set in n base 2"
nb
=
0
while
n
:
n
,
rem
=
divmod
(
n
,
2
)
nb
+=
rem
return
nb
statelist
=
[]
for
state
in
states
:
substates
=
list
(
set
(
state
&
x
for
x
in
states
))
substates
.
sort
(
key
=
nbits
,
reverse
=
True
)
statelist
.
append
(
substates
)
return
statelist
_state_subsets
=
expand_substates
(
_states
)
# _state_codes gives for each state, the portable code to be passed as mc_state
_state_codes
=
[]
for
s
in
_states
:
...
...
@@ -297,7 +312,7 @@ def MultiCallCreator(widget):
assert issubclass(widget, Tkinter.Misc)
def __init__(self, *args, **kwargs):
apply(widget.__init__, (self,)+args,
kwargs)
widget.__init__(self, *args, **
kwargs)
# a dictionary which maps a virtual event to a tuple with:
# 0. the function binded
# 1. a list of triplets - the sequences it is binded to
...
...
Lib/idlelib/ObjectBrowser.py
View file @
d630c04a
...
...
@@ -9,7 +9,7 @@
# XXX TO DO:
# - for classes/modules, add "open source" to object browser
from
TreeWidget
import
TreeItem
,
TreeNode
,
ScrolledCanvas
from
idlelib.
TreeWidget
import
TreeItem
,
TreeNode
,
ScrolledCanvas
from
repr
import
Repr
...
...
Lib/idlelib/OutputWindow.py
View file @
d630c04a
from
Tkinter
import
*
from
EditorWindow
import
EditorWindow
from
idlelib.
EditorWindow
import
EditorWindow
import
re
import
tkMessageBox
import
IOBinding
from
idlelib
import
IOBinding
class
OutputWindow
(
EditorWindow
):
...
...
@@ -47,8 +47,9 @@ class OutputWindow(EditorWindow):
self
.
text
.
see
(
mark
)
self
.
text
.
update
()
def
writelines
(
self
,
l
):
map
(
self
.
write
,
l
)
def
writelines
(
self
,
lines
):
for
line
in
lines
:
self
.
write
(
line
)
def
flush
(
self
):
pass
...
...
Lib/idlelib/ParenMatch.py
View file @
d630c04a
...
...
@@ -5,8 +5,8 @@ paren. Paren here is used generically; the matching applies to
parentheses, square brackets, and curly braces.
"""
from
HyperParser
import
HyperParser
from
configHandler
import
idleConf
from
idlelib.
HyperParser
import
HyperParser
from
idlelib.
configHandler
import
idleConf
_openers
=
{
')'
:
'('
,
']'
:
'['
,
'}'
:
'{'
}
CHECK_DELAY
=
100
# miliseconds
...
...
Lib/idlelib/PathBrowser.py
View file @
d630c04a
...
...
@@ -2,8 +2,8 @@ import os
import
sys
import
imp
from
TreeWidget
import
TreeItem
from
ClassBrowser
import
ClassBrowser
,
ModuleBrowserTreeItem
from
idlelib.
TreeWidget
import
TreeItem
from
idlelib.
ClassBrowser
import
ClassBrowser
,
ModuleBrowserTreeItem
class
PathBrowser
(
ClassBrowser
):
...
...
@@ -86,7 +86,7 @@ class DirBrowserTreeItem(TreeItem):
return
sorted
def
main
():
import
PyShell
from
idlelib
import
PyShell
PathBrowser
(
PyShell
.
flist
)
if
sys
.
stdin
is
sys
.
__stdin__
:
mainloop
()
...
...
Lib/idlelib/Percolator.py
View file @
d630c04a
from
WidgetRedirector
import
WidgetRedirector
from
Delegator
import
Delegator
from
idlelib.
WidgetRedirector
import
WidgetRedirector
from
idlelib.
Delegator
import
Delegator
class
Percolator
:
...
...
Lib/idlelib/PyShell.py
View file @
d630c04a
...
...
@@ -11,7 +11,6 @@ import time
import
threading
import
traceback
import
types
import
macosxSupport
import
linecache
from
code
import
InteractiveInterpreter
...
...
@@ -24,17 +23,17 @@ except ImportError:
sys
.
exit
(
1
)
import
tkMessageBox
from
EditorWindow
import
EditorWindow
,
fixwordbreaks
from
FileList
import
FileList
from
ColorDelegator
import
ColorDelegator
from
UndoDelegator
import
UndoDelegator
from
OutputWindow
import
OutputWindow
from
configHandler
import
idleConf
import
idlever
import
rpc
import
Debugger
import
RemoteDebugger
from
idlelib.
EditorWindow
import
EditorWindow
,
fixwordbreaks
from
idlelib.
FileList
import
FileList
from
idlelib.
ColorDelegator
import
ColorDelegator
from
idlelib.
UndoDelegator
import
UndoDelegator
from
idlelib.
OutputWindow
import
OutputWindow
from
idlelib.
configHandler
import
idleConf
from
idlelib
import
idlever
from
idlelib
import
rpc
from
idlelib
import
Debugger
from
idlelib
import
Remote
Debugger
from
idlelib
import
macosxSupport
IDENTCHARS
=
string
.
ascii_letters
+
string
.
digits
+
"_"
HOST
=
'127.0.0.1'
# python execution server on localhost loopback
...
...
@@ -561,13 +560,13 @@ class ModifiedInterpreter(InteractiveInterpreter):
return
def
remote_stack_viewer
(
self
):
import
RemoteObjectBrowser
from
idlelib
import
RemoteObjectBrowser
oid
=
self
.
rpcclt
.
remotequeue
(
"exec"
,
"stackviewer"
,
(
"flist"
,),
{})
if
oid
is
None
:
self
.
tkconsole
.
root
.
bell
()
return
item
=
RemoteObjectBrowser
.
StubObjectTreeItem
(
self
.
rpcclt
,
oid
)
from
TreeWidget
import
ScrolledCanvas
,
TreeNode
from
idlelib.
TreeWidget
import
ScrolledCanvas
,
TreeNode
top
=
Toplevel
(
self
.
tkconsole
.
root
)
theme
=
idleConf
.
GetOption
(
'main'
,
'Theme'
,
'name'
)
background
=
idleConf
.
GetHighlight
(
theme
,
'normal'
)[
'background'
]
...
...
@@ -607,7 +606,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
self
.
save_warnings_filters
=
warnings
.
filters
[:]
warnings
.
filterwarnings
(
action
=
"error"
,
category
=
SyntaxWarning
)
if
isinstance
(
source
,
types
.
UnicodeType
):
import
IOBinding
from
idlelib
import
IOBinding
try
:
source
=
source
.
encode
(
IOBinding
.
encoding
)
except
UnicodeError
:
...
...
@@ -816,7 +815,7 @@ class PyShell(OutputWindow):
# New classes
from
IdleHistory
import
History
from
idlelib.
IdleHistory
import
History
def
__init__
(
self
,
flist
=
None
):
if
use_subprocess
:
...
...
@@ -854,7 +853,7 @@ class PyShell(OutputWindow):
self
.
save_stdout
=
sys
.
stdout
self
.
save_stderr
=
sys
.
stderr
self
.
save_stdin
=
sys
.
stdin
import
IOBinding
from
idlelib
import
IOBinding
self
.
stdout
=
PseudoFile
(
self
,
"stdout"
,
IOBinding
.
encoding
)
self
.
stderr
=
PseudoFile
(
self
,
"stderr"
,
IOBinding
.
encoding
)
self
.
console
=
PseudoFile
(
self
,
"console"
,
IOBinding
.
encoding
)
...
...
@@ -1014,7 +1013,7 @@ class PyShell(OutputWindow):
if
len
(
line
)
==
0
:
# may be EOF if we quit our mainloop with Ctrl-C
line
=
"
\
n
"
if
isinstance
(
line
,
unicode
):
import
IOBinding
from
idlelib
import
IOBinding
try
:
line
=
line
.
encode
(
IOBinding
.
encoding
)
except
UnicodeError
:
...
...
@@ -1192,7 +1191,7 @@ class PyShell(OutputWindow):
"(sys.last_traceback is not defined)",
master=self.text)
return
from StackViewer import StackBrowser
from
idlelib.
StackViewer import StackBrowser
sv = StackBrowser(self.root, self.flist)
def view_restart_mark(self, event=None):
...
...
@@ -1246,8 +1245,9 @@ class PseudoFile(object):
def write(self, s):
self.shell.write(s, self.tags)
def writelines(self, l):
map(self.write, l)
def writelines(self, lines):
for line in lines:
self.write(line)
def flush(self):
pass
...
...
@@ -1375,7 +1375,7 @@ def main():
pathx.append(os.path.dirname(filename))
for dir in pathx:
dir = os.path.abspath(dir)
if
not dir
in sys.path:
if
dir not
in sys.path:
sys.path.insert(0, dir)
else:
dir = os.getcwd()
...
...
Lib/idlelib/RemoteDebugger.py
View file @
d630c04a
...
...
@@ -21,8 +21,8 @@ barrier, in particular frame and traceback objects.
"""
import
types
import
rpc
import
Debugger
from
idlelib
import
rpc
from
idlelib
import
Debugger
debugging
=
0
...
...
Lib/idlelib/RemoteObjectBrowser.py
View file @
d630c04a
import
rpc
from
idlelib
import
rpc
def
remote_object_tree_item
(
item
):
wrapper
=
WrappedObjectTreeItem
(
item
)
...
...
Lib/idlelib/ReplaceDialog.py
View file @
d630c04a
from
Tkinter
import
*
import
SearchEngine
from
SearchDialogBase
import
SearchDialogBase
from
idlelib
import
SearchEngine
from
idlelib.SearchDialogBase
import
SearchDialogBase
def
replace
(
text
):
root
=
text
.
_root
()
...
...
Lib/idlelib/ScriptBinding.py
View file @
d630c04a
...
...
@@ -23,9 +23,9 @@ import string
import
tabnanny
import
tokenize
import
tkMessageBox
import
PyShell
from
idlelib
import
PyShell
from
configHandler
import
idleConf
from
idlelib.
configHandler
import
idleConf
IDENTCHARS
=
string
.
ascii_letters
+
string
.
digits
+
"_"
...
...
Lib/idlelib/SearchDialog.py
View file @
d630c04a
from
Tkinter
import
*
import
SearchEngine
from
SearchDialogBase
import
SearchDialogBase
from
idlelib
import
SearchEngine
from
idlelib.SearchDialogBase
import
SearchDialogBase
def
_setup
(
text
):
root
=
text
.
_root
()
...
...
Lib/idlelib/StackViewer.py
View file @
d630c04a
...
...
@@ -2,8 +2,8 @@ import os
import
sys
import
linecache
from
TreeWidget
import
TreeNode
,
TreeItem
,
ScrolledCanvas
from
ObjectBrowser
import
ObjectTreeItem
,
make_objecttreeitem
from
idlelib.
TreeWidget
import
TreeNode
,
TreeItem
,
ScrolledCanvas
from
idlelib.
ObjectBrowser
import
ObjectTreeItem
,
make_objecttreeitem
def
StackBrowser
(
root
,
flist
=
None
,
tb
=
None
,
top
=
None
):
if
top
is
None
:
...
...
Lib/idlelib/TreeWidget.py
View file @
d630c04a
...
...
@@ -18,8 +18,8 @@ import os
from
Tkinter
import
*
import
imp
import
ZoomHeight
from
configHandler
import
idleConf
from
idlelib
import
ZoomHeight
from
idlelib.
configHandler
import
idleConf
ICONDIR
=
"Icons"
...
...
@@ -397,7 +397,7 @@ class FileTreeItem(TreeItem):
names
=
os
.
listdir
(
self
.
path
)
except
os
.
error
:
return
[]
names
.
sort
(
lambda
a
,
b
:
cmp
(
os
.
path
.
normcase
(
a
),
os
.
path
.
normcase
(
b
))
)
names
.
sort
(
key
=
os
.
path
.
normcase
)
sublist
=
[]
for
name
in
names
:
item
=
FileTreeItem
(
os
.
path
.
join
(
self
.
path
,
name
))
...
...
@@ -452,7 +452,7 @@ class ScrolledCanvas:
# Testing functions
def
test
():
import
PyShell
from
idlelib
import
PyShell
root
=
Toplevel
(
PyShell
.
root
)
root
.
configure
(
bd
=
0
,
bg
=
"yellow"
)
root
.
focus_set
()
...
...
Lib/idlelib/UndoDelegator.py
View file @
d630c04a
import
string
from
Tkinter
import
*
from
Delegator
import
Delegator
from
idlelib.Delegator
import
Delegator
#$ event <<redo>>
#$ win <Control-y>
...
...
@@ -336,7 +337,7 @@ class CommandSequence(Command):
return
self
.
depth
def
main
():
from
Percolator
import
Percolator
from
idlelib.
Percolator
import
Percolator
root
=
Tk
()
root
.
wm_protocol
(
"WM_DELETE_WINDOW"
,
root
.
quit
)
text
=
Text
()
...
...
Lib/idlelib/ZoomHeight.py
View file @
d630c04a
...
...
@@ -2,7 +2,8 @@
import
re
import
sys
import
macosxSupport
from
idlelib
import
macosxSupport
class
ZoomHeight
:
...
...
Lib/idlelib/aboutDialog.py
View file @
d630c04a
...
...
@@ -4,9 +4,9 @@
from
Tkinter
import
*
import
os
import
os.path
import
textView
import
idlever
from
idlelib
import
textView
from
idlelib
import
idlever
class
AboutDialog
(
Toplevel
):
"""Modal about dialog for idle
...
...
@@ -144,7 +144,7 @@ if __name__ == '__main__':
# test the dialog
root
=
Tk
()
def
run
():
import
aboutDialog
from
idlelib
import
aboutDialog
aboutDialog
.
AboutDialog
(
root
,
'About'
)
Button
(
root
,
text
=
'Dialog'
,
command
=
run
).
pack
()
root
.
mainloop
()
Lib/idlelib/configDialog.py
View file @
d630c04a
...
...
@@ -13,13 +13,13 @@ from Tkinter import *
import
tkMessageBox
,
tkColorChooser
,
tkFont
import
string
from
configHandler
import
idleConf
from
dynOptionMenuWidget
import
DynOptionMenu
from
tabbedpages
import
TabbedPageSet
from
keybindingDialog
import
GetKeysDialog
from
configSectionNameDialog
import
GetCfgSectionNameDialog
from
configHelpSourceEdit
import
GetHelpSourceDialog
import
macosxSupport
from
idlelib.
configHandler
import
idleConf
from
idlelib.
dynOptionMenuWidget
import
DynOptionMenu
from
idlelib.
tabbedpages
import
TabbedPageSet
from
idlelib.
keybindingDialog
import
GetKeysDialog
from
idlelib.
configSectionNameDialog
import
GetCfgSectionNameDialog
from
idlelib.
configHelpSourceEdit
import
GetHelpSourceDialog
from
idlelib
import
macosxSupport
class
ConfigDialog
(
Toplevel
):
...
...
Lib/idlelib/configHandler.py
View file @
d630c04a
...
...
@@ -20,7 +20,7 @@ configuration problem notification and resolution.
import
os
import
sys
import
string
import
macosxSupport
from
idlelib
import
macosxSupport
from
ConfigParser
import
ConfigParser
,
NoOptionError
,
NoSectionError
class
InvalidConfigType
(
Exception
):
pass
...
...
Lib/idlelib/keybindingDialog.py
View file @
d630c04a
...
...
@@ -132,7 +132,7 @@ class GetKeysDialog(Toplevel):
order is also important: key binding equality depends on it, so
config-keys.def must use the same ordering.
"""
import
macosxSupport
from
idlelib
import
macosxSupport
if
macosxSupport
.
runningAsOSXApp
():
self
.
modifiers
=
[
'Shift'
,
'Control'
,
'Option'
,
'Command'
]
else
:
...
...
@@ -167,7 +167,7 @@ class GetKeysDialog(Toplevel):
def
GetModifiers
(
self
):
modList
=
[
variable
.
get
()
for
variable
in
self
.
modifier_vars
]
return
filter
(
None
,
modList
)
return
[
mod
for
mod
in
modList
if
mod
]
def
ClearKeySeq
(
self
):
self
.
listKeysFinal
.
select_clear
(
0
,
END
)
...
...
Lib/idlelib/macosxSupport.py
View file @
d630c04a
...
...
@@ -57,10 +57,10 @@ def overrideRootMenu(root, flist):
# Due to a (mis-)feature of TkAqua the user will also see an empty Help
# menu.
from
Tkinter
import
Menu
,
Text
,
Text
from
EditorWindow
import
prepstr
,
get_accelerator
import
Bindings
import
WindowList
from
MultiCall
import
MultiCallCreator
from
idlelib.
EditorWindow
import
prepstr
,
get_accelerator
from
idlelib
import
Bindings
from
idlelib
import
WindowList
from
idlelib.
MultiCall
import
MultiCallCreator
menubar
=
Menu
(
root
)
root
.
configure
(
menu
=
menubar
)
...
...
@@ -83,11 +83,11 @@ def overrideRootMenu(root, flist):
menubar
.
add_cascade
(
label
=
'IDLE'
,
menu
=
menu
)
def
about_dialog
(
event
=
None
):
import
aboutDialog
from
idlelib
import
aboutDialog
aboutDialog
.
AboutDialog
(
root
,
'About IDLE'
)
def
config_dialog
(
event
=
None
):
import
configDialog
from
idlelib
import
configDialog
root
.
instance_dict
=
flist
.
inversedict
configDialog
.
ConfigDialog
(
root
,
'Settings'
)
...
...
Lib/idlelib/run.py
View file @
d630c04a
...
...
@@ -7,13 +7,13 @@ import thread
import
threading
import
Queue
import
CallTips
import
AutoComplete
from
idlelib
import
CallTips
from
idlelib
import
AutoComplete
import
RemoteDebugger
import
RemoteObjectBrowser
import
StackViewer
import
rpc
from
idlelib
import
RemoteDebugger
from
idlelib
import
RemoteObjectBrowser
from
idlelib
import
StackViewer
from
idlelib
import
rpc
import
__main__
...
...
@@ -122,7 +122,7 @@ def manage_socket(address):
break
except
socket
.
error
,
err
:
print
>>
sys
.
__stderr__
,
"IDLE Subprocess: socket error: "
\
+
err
[
1
]
+
", retrying...."
+
err
.
args
[
1
]
+
", retrying...."
else
:
print
>>
sys
.
__stderr__
,
"IDLE Subprocess: Connection to "
\
"IDLE GUI failed, exiting."
...
...
@@ -137,14 +137,15 @@ def show_socket_error(err, address):
import
tkMessageBox
root
=
Tkinter
.
Tk
()
root
.
withdraw
()
if
err
[
0
]
==
61
:
# connection refused
if
err
.
args
[
0
]
==
61
:
# connection refused
msg
=
"IDLE's subprocess can't connect to %s:%d. This may be due "
\
"to your personal firewall configuration. It is safe to "
\
"allow this internal connection because no data is visible on "
\
"external ports."
%
address
tkMessageBox
.
showerror
(
"IDLE Subprocess Error"
,
msg
,
parent
=
root
)
else
:
tkMessageBox
.
showerror
(
"IDLE Subprocess Error"
,
"Socket Error: %s"
%
err
[
1
])
tkMessageBox
.
showerror
(
"IDLE Subprocess Error"
,
"Socket Error: %s"
%
err
.
args
[
1
])
root
.
destroy
()
def
print_exception
():
...
...
@@ -257,7 +258,7 @@ class MyHandler(rpc.RPCHandler):
sys
.
stdin
=
self
.
console
=
self
.
get_remote_proxy
(
"stdin"
)
sys
.
stdout
=
self
.
get_remote_proxy
(
"stdout"
)
sys
.
stderr
=
self
.
get_remote_proxy
(
"stderr"
)
import
IOBinding
from
idlelib
import
IOBinding
sys
.
stdin
.
encoding
=
sys
.
stdout
.
encoding
=
\
sys
.
stderr
.
encoding
=
IOBinding
.
encoding
self
.
interp
=
self
.
get_remote_proxy
(
"interp"
)
...
...
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