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
bfbaa6b2
Commit
bfbaa6b2
authored
Aug 31, 2016
by
Terry Jan Reedy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #27891: Consistently group and sort imports within idlelib modules.
parent
89b11625
Changes
47
Hide whitespace changes
Inline
Side-by-side
Showing
47 changed files
with
197 additions
and
122 deletions
+197
-122
Lib/idlelib/README.txt
Lib/idlelib/README.txt
+20
-1
Lib/idlelib/autocomplete.py
Lib/idlelib/autocomplete.py
+9
-8
Lib/idlelib/autocomplete_w.py
Lib/idlelib/autocomplete_w.py
+2
-1
Lib/idlelib/autoexpand.py
Lib/idlelib/autoexpand.py
+1
-2
Lib/idlelib/browser.py
Lib/idlelib/browser.py
+3
-3
Lib/idlelib/calltips.py
Lib/idlelib/calltips.py
+1
-1
Lib/idlelib/codecontext.py
Lib/idlelib/codecontext.py
+4
-2
Lib/idlelib/colorizer.py
Lib/idlelib/colorizer.py
+5
-4
Lib/idlelib/config.py
Lib/idlelib/config.py
+1
-1
Lib/idlelib/configdialog.py
Lib/idlelib/configdialog.py
+3
-3
Lib/idlelib/debugger.py
Lib/idlelib/debugger.py
+5
-3
Lib/idlelib/debugobj.py
Lib/idlelib/debugobj.py
+1
-2
Lib/idlelib/dynoption.py
Lib/idlelib/dynoption.py
+1
-0
Lib/idlelib/editor.py
Lib/idlelib/editor.py
+21
-20
Lib/idlelib/filelist.py
Lib/idlelib/filelist.py
+1
-0
Lib/idlelib/grep.py
Lib/idlelib/grep.py
+7
-4
Lib/idlelib/help.py
Lib/idlelib/help.py
+2
-0
Lib/idlelib/help_about.py
Lib/idlelib/help_about.py
+4
-1
Lib/idlelib/history.py
Lib/idlelib/history.py
+3
-1
Lib/idlelib/hyperparser.py
Lib/idlelib/hyperparser.py
+2
-3
Lib/idlelib/idle_test/test_iomenu.py
Lib/idlelib/idle_test/test_iomenu.py
+3
-2
Lib/idlelib/macosx.py
Lib/idlelib/macosx.py
+2
-1
Lib/idlelib/multicall.py
Lib/idlelib/multicall.py
+2
-2
Lib/idlelib/outwin.py
Lib/idlelib/outwin.py
+5
-2
Lib/idlelib/paragraph.py
Lib/idlelib/paragraph.py
+3
-1
Lib/idlelib/parenmatch.py
Lib/idlelib/parenmatch.py
+0
-1
Lib/idlelib/pathbrowser.py
Lib/idlelib/pathbrowser.py
+5
-2
Lib/idlelib/percolator.py
Lib/idlelib/percolator.py
+1
-1
Lib/idlelib/pyparse.py
Lib/idlelib/pyparse.py
+1
-1
Lib/idlelib/pyshell.py
Lib/idlelib/pyshell.py
+12
-12
Lib/idlelib/query.py
Lib/idlelib/query.py
+2
-1
Lib/idlelib/replace.py
Lib/idlelib/replace.py
+3
-3
Lib/idlelib/rpc.py
Lib/idlelib/rpc.py
+16
-10
Lib/idlelib/run.py
Lib/idlelib/run.py
+12
-12
Lib/idlelib/runscript.py
Lib/idlelib/runscript.py
+2
-1
Lib/idlelib/scrolledlist.py
Lib/idlelib/scrolledlist.py
+3
-1
Lib/idlelib/search.py
Lib/idlelib/search.py
+1
-0
Lib/idlelib/searchbase.py
Lib/idlelib/searchbase.py
+1
-0
Lib/idlelib/searchengine.py
Lib/idlelib/searchengine.py
+3
-0
Lib/idlelib/stackviewer.py
Lib/idlelib/stackviewer.py
+8
-3
Lib/idlelib/statusbar.py
Lib/idlelib/statusbar.py
+2
-0
Lib/idlelib/tabbedpages.py
Lib/idlelib/tabbedpages.py
+3
-0
Lib/idlelib/textview.py
Lib/idlelib/textview.py
+1
-1
Lib/idlelib/tree.py
Lib/idlelib/tree.py
+3
-1
Lib/idlelib/undo.py
Lib/idlelib/undo.py
+3
-4
Lib/idlelib/windows.py
Lib/idlelib/windows.py
+2
-0
Lib/idlelib/zoomheight.py
Lib/idlelib/zoomheight.py
+2
-0
No files found.
Lib/idlelib/README.txt
View file @
bfbaa6b2
...
@@ -228,4 +228,23 @@ Help
...
@@ -228,4 +228,23 @@ Help
<No menu>
<No menu>
Center Insert # eEW.center_insert_event
Center Insert # eEW.center_insert_event
CODE STYLE -- Generally PEP 8.
import
------
Put import at the top, unless there is a good reason otherwise.
PEP 8 says to group stdlib, 3rd-party dependencies, and package imports.
For idlelib, the groups are general stdlib, tkinter, and idlelib.
Sort modules within each group, except that tkinter.ttk follows tkinter.
Sort 'from idlelib import mod1' and 'from idlelib.mod2 import object'
together by module, ignoring within module objects.
Put 'import __main__' after other idlelib imports.
Imports only needed for testing are not at the top but are put in the
htest function def or the "if __name__ == '__main__'" clause.
Within module imports like "from idlelib.mod import class" may cause
circular imports to deadlock. Even without this, circular imports may
require at least one of the imports to be delayed until a function call.
Lib/idlelib/autocomplete.py
View file @
bfbaa6b2
...
@@ -4,26 +4,27 @@ This extension can complete either attribute names or file names. It can pop
...
@@ -4,26 +4,27 @@ This extension can complete either attribute names or file names. It can pop
a window with all available names, for the user to select from.
a window with all available names, for the user to select from.
"""
"""
import
os
import
os
import
sys
import
string
import
string
import
sys
from
idlelib.config
import
idleConf
# These constants represent the two different types of completions.
# They must be defined here so autocomple_w can import them.
# This string includes all chars that may be in an identifier
ID_CHARS
=
string
.
ascii_letters
+
string
.
digits
+
"_"
# These constants represent the two different types of completions
COMPLETE_ATTRIBUTES
,
COMPLETE_FILES
=
range
(
1
,
2
+
1
)
COMPLETE_ATTRIBUTES
,
COMPLETE_FILES
=
range
(
1
,
2
+
1
)
from
idlelib
import
autocomplete_w
from
idlelib
import
autocomplete_w
from
idlelib.config
import
idleConf
from
idlelib.hyperparser
import
HyperParser
from
idlelib.hyperparser
import
HyperParser
import
__main__
import
__main__
# This string includes all chars that may be in an identifier.
# TODO Update this here and elsewhere.
ID_CHARS
=
string
.
ascii_letters
+
string
.
digits
+
"_"
SEPS
=
os
.
sep
SEPS
=
os
.
sep
if
os
.
altsep
:
# e.g. '/' on Windows...
if
os
.
altsep
:
# e.g. '/' on Windows...
SEPS
+=
os
.
altsep
SEPS
+=
os
.
altsep
class
AutoComplete
:
class
AutoComplete
:
menudefs
=
[
menudefs
=
[
...
...
Lib/idlelib/autocomplete_w.py
View file @
bfbaa6b2
...
@@ -3,8 +3,9 @@ An auto-completion window for IDLE, used by the autocomplete extension
...
@@ -3,8 +3,9 @@ An auto-completion window for IDLE, used by the autocomplete extension
"""
"""
from
tkinter
import
*
from
tkinter
import
*
from
tkinter.ttk
import
Scrollbar
from
tkinter.ttk
import
Scrollbar
from
idlelib.multicall
import
MC_SHIFT
from
idlelib.autocomplete
import
COMPLETE_FILES
,
COMPLETE_ATTRIBUTES
from
idlelib.autocomplete
import
COMPLETE_FILES
,
COMPLETE_ATTRIBUTES
from
idlelib.multicall
import
MC_SHIFT
HIDE_VIRTUAL_EVENT_NAME
=
"<<autocompletewindow-hide>>"
HIDE_VIRTUAL_EVENT_NAME
=
"<<autocompletewindow-hide>>"
HIDE_SEQUENCES
=
(
"<FocusOut>"
,
"<ButtonPress>"
)
HIDE_SEQUENCES
=
(
"<FocusOut>"
,
"<ButtonPress>"
)
...
...
Lib/idlelib/autoexpand.py
View file @
bfbaa6b2
...
@@ -12,8 +12,8 @@ its state.
...
@@ -12,8 +12,8 @@ its state.
This is an extension file and there is only one instance of AutoExpand.
This is an extension file and there is only one instance of AutoExpand.
'''
'''
import
string
import
re
import
re
import
string
###$ event <<expand-word>>
###$ event <<expand-word>>
###$ win <Alt-slash>
###$ win <Alt-slash>
...
@@ -100,7 +100,6 @@ class AutoExpand:
...
@@ -100,7 +100,6 @@ class AutoExpand:
i
=
i
-
1
i
=
i
-
1
return
line
[
i
:]
return
line
[
i
:]
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
import
unittest
import
unittest
unittest
.
main
(
'idlelib.idle_test.test_autoexpand'
,
verbosity
=
2
)
unittest
.
main
(
'idlelib.idle_test.test_autoexpand'
,
verbosity
=
2
)
Lib/idlelib/browser.py
View file @
bfbaa6b2
...
@@ -11,13 +11,13 @@ XXX TO DO:
...
@@ -11,13 +11,13 @@ XXX TO DO:
"""
"""
import
os
import
os
import
sys
import
pyclbr
import
pyclbr
import
sys
from
idlelib.config
import
idleConf
from
idlelib
import
pyshell
from
idlelib
import
pyshell
from
idlelib.windows
import
ListedToplevel
from
idlelib.tree
import
TreeNode
,
TreeItem
,
ScrolledCanvas
from
idlelib.tree
import
TreeNode
,
TreeItem
,
ScrolledCanvas
from
idlelib.
config
import
idleConf
from
idlelib.
windows
import
ListedToplevel
file_open
=
None
# Method...Item and Class...Item use this.
file_open
=
None
# Method...Item and Class...Item use this.
# Normally pyshell.flist.open, but there is no pyshell.flist for htest.
# Normally pyshell.flist.open, but there is no pyshell.flist for htest.
...
...
Lib/idlelib/calltips.py
View file @
bfbaa6b2
...
@@ -5,7 +5,6 @@ parameter and docstring information when you type an opening parenthesis, and
...
@@ -5,7 +5,6 @@ parameter and docstring information when you type an opening parenthesis, and
which disappear when you type a closing parenthesis.
which disappear when you type a closing parenthesis.
"""
"""
import
__main__
import
inspect
import
inspect
import
re
import
re
import
sys
import
sys
...
@@ -14,6 +13,7 @@ import types
...
@@ -14,6 +13,7 @@ import types
from
idlelib
import
calltip_w
from
idlelib
import
calltip_w
from
idlelib.hyperparser
import
HyperParser
from
idlelib.hyperparser
import
HyperParser
import
__main__
class
CallTips
:
class
CallTips
:
...
...
Lib/idlelib/codecontext.py
View file @
bfbaa6b2
...
@@ -9,10 +9,12 @@ variable in the codecontext section of config-extensions.def. Lines which do
...
@@ -9,10 +9,12 @@ variable in the codecontext section of config-extensions.def. Lines which do
not open blocks are not shown in the context hints pane.
not open blocks are not shown in the context hints pane.
"""
"""
import
tkinter
from
tkinter.constants
import
TOP
,
LEFT
,
X
,
W
,
SUNKEN
import
re
import
re
from
sys
import
maxsize
as
INFINITY
from
sys
import
maxsize
as
INFINITY
import
tkinter
from
tkinter.constants
import
TOP
,
LEFT
,
X
,
W
,
SUNKEN
from
idlelib.config
import
idleConf
from
idlelib.config
import
idleConf
BLOCKOPENERS
=
{
"class"
,
"def"
,
"elif"
,
"else"
,
"except"
,
"finally"
,
"for"
,
BLOCKOPENERS
=
{
"class"
,
"def"
,
"elif"
,
"else"
,
"except"
,
"finally"
,
"for"
,
...
...
Lib/idlelib/colorizer.py
View file @
bfbaa6b2
import
time
import
re
import
keyword
import
builtins
import
builtins
from
idlelib.delegator
import
Delegator
import
keyword
import
re
import
time
from
idlelib.config
import
idleConf
from
idlelib.config
import
idleConf
from
idlelib.delegator
import
Delegator
DEBUG
=
False
DEBUG
=
False
...
...
Lib/idlelib/config.py
View file @
bfbaa6b2
...
@@ -18,10 +18,10 @@ configuration problem notification and resolution.
...
@@ -18,10 +18,10 @@ configuration problem notification and resolution.
"""
"""
# TODOs added Oct 2014, tjr
# TODOs added Oct 2014, tjr
from
configparser
import
ConfigParser
import
os
import
os
import
sys
import
sys
from
configparser
import
ConfigParser
from
tkinter.font
import
Font
,
nametofont
from
tkinter.font
import
Font
,
nametofont
class
InvalidConfigType
(
Exception
):
pass
class
InvalidConfigType
(
Exception
):
pass
...
...
Lib/idlelib/configdialog.py
View file @
bfbaa6b2
...
@@ -11,17 +11,17 @@ Refer to comments in EditorWindow autoindent code for details.
...
@@ -11,17 +11,17 @@ Refer to comments in EditorWindow autoindent code for details.
"""
"""
from
tkinter
import
*
from
tkinter
import
*
from
tkinter.ttk
import
Scrollbar
from
tkinter.ttk
import
Scrollbar
import
tkinter.messagebox
as
tkMessageBox
import
tkinter.colorchooser
as
tkColorChooser
import
tkinter.colorchooser
as
tkColorChooser
import
tkinter.font
as
tkFont
import
tkinter.font
as
tkFont
import
tkinter.messagebox
as
tkMessageBox
from
idlelib.config
import
idleConf
from
idlelib.config
import
idleConf
from
idlelib.dynoption
import
DynOptionMenu
from
idlelib.config_key
import
GetKeysDialog
from
idlelib.config_key
import
GetKeysDialog
from
idlelib.dynoption
import
DynOptionMenu
from
idlelib
import
macosx
from
idlelib.query
import
SectionName
,
HelpSource
from
idlelib.query
import
SectionName
,
HelpSource
from
idlelib.tabbedpages
import
TabbedPageSet
from
idlelib.tabbedpages
import
TabbedPageSet
from
idlelib.textview
import
view_text
from
idlelib.textview
import
view_text
from
idlelib
import
macosx
class
ConfigDialog
(
Toplevel
):
class
ConfigDialog
(
Toplevel
):
...
...
Lib/idlelib/debugger.py
View file @
bfbaa6b2
import
os
import
bdb
import
bdb
import
os
from
tkinter
import
*
from
tkinter
import
*
from
tkinter.ttk
import
Scrollbar
from
tkinter.ttk
import
Scrollbar
from
idlelib.windows
import
ListedToplevel
from
idlelib.scrolledlist
import
ScrolledList
from
idlelib
import
macosx
from
idlelib
import
macosx
from
idlelib.scrolledlist
import
ScrolledList
from
idlelib.windows
import
ListedToplevel
class
Idb
(
bdb
.
Bdb
):
class
Idb
(
bdb
.
Bdb
):
...
...
Lib/idlelib/debugobj.py
View file @
bfbaa6b2
...
@@ -8,11 +8,10 @@
...
@@ -8,11 +8,10 @@
# XXX TO DO:
# XXX TO DO:
# - for classes/modules, add "open source" to object browser
# - for classes/modules, add "open source" to object browser
from
reprlib
import
Repr
from
idlelib.tree
import
TreeItem
,
TreeNode
,
ScrolledCanvas
from
idlelib.tree
import
TreeItem
,
TreeNode
,
ScrolledCanvas
from
reprlib
import
Repr
myrepr
=
Repr
()
myrepr
=
Repr
()
myrepr
.
maxstring
=
100
myrepr
.
maxstring
=
100
myrepr
.
maxother
=
100
myrepr
.
maxother
=
100
...
...
Lib/idlelib/dynoption.py
View file @
bfbaa6b2
...
@@ -3,6 +3,7 @@ OptionMenu widget modified to allow dynamic menu reconfiguration
...
@@ -3,6 +3,7 @@ OptionMenu widget modified to allow dynamic menu reconfiguration
and setting of highlightthickness
and setting of highlightthickness
"""
"""
import
copy
import
copy
from
tkinter
import
OptionMenu
,
_setit
,
StringVar
,
Button
from
tkinter
import
OptionMenu
,
_setit
,
StringVar
,
Button
class
DynOptionMenu
(
OptionMenu
):
class
DynOptionMenu
(
OptionMenu
):
...
...
Lib/idlelib/editor.py
View file @
bfbaa6b2
...
@@ -6,24 +6,28 @@ import platform
...
@@ -6,24 +6,28 @@ import platform
import
re
import
re
import
string
import
string
import
sys
import
sys
import
tokenize
import
traceback
import
webbrowser
from
tkinter
import
*
from
tkinter
import
*
from
tkinter.ttk
import
Scrollbar
from
tkinter.ttk
import
Scrollbar
import
tkinter.simpledialog
as
tkSimpleDialog
import
tkinter.simpledialog
as
tkSimpleDialog
import
tkinter.messagebox
as
tkMessageBox
import
tkinter.messagebox
as
tkMessageBox
import
traceback
import
webbrowser
from
idlelib.config
import
idleConf
from
idlelib
import
configdialog
from
idlelib
import
grep
from
idlelib
import
help
from
idlelib
import
help_about
from
idlelib
import
macosx
from
idlelib.multicall
import
MultiCallCreator
from
idlelib.multicall
import
MultiCallCreator
from
idlelib
import
pyparse
from
idlelib
import
query
from
idlelib
import
query
from
idlelib
import
windows
from
idlelib
import
search
from
idlelib
import
grep
from
idlelib
import
replace
from
idlelib
import
replace
from
idlelib
import
pyparse
from
idlelib
import
search
from
idlelib.config
import
idleConf
from
idlelib
import
textview
from
idlelib
import
help_about
,
textview
,
configdialog
from
idlelib
import
windows
from
idlelib
import
macosx
from
idlelib
import
help
# The default tab setting for a Text widget, in average-width characters.
# The default tab setting for a Text widget, in average-width characters.
TK_TABWIDTH_DEFAULT
=
8
TK_TABWIDTH_DEFAULT
=
8
...
@@ -1515,9 +1519,6 @@ def classifyws(s, tabwidth):
...
@@ -1515,9 +1519,6 @@ def classifyws(s, tabwidth):
break
break
return
raw
,
effective
return
raw
,
effective
import
tokenize
_tokenize
=
tokenize
del
tokenize
class
IndentSearcher
(
object
):
class
IndentSearcher
(
object
):
...
@@ -1542,8 +1543,8 @@ class IndentSearcher(object):
...
@@ -1542,8 +1543,8 @@ class IndentSearcher(object):
return
self
.
text
.
get
(
mark
,
mark
+
" lineend+1c"
)
return
self
.
text
.
get
(
mark
,
mark
+
" lineend+1c"
)
def
tokeneater
(
self
,
type
,
token
,
start
,
end
,
line
,
def
tokeneater
(
self
,
type
,
token
,
start
,
end
,
line
,
INDENT
=
_
tokenize
.
INDENT
,
INDENT
=
tokenize
.
INDENT
,
NAME
=
_
tokenize
.
NAME
,
NAME
=
tokenize
.
NAME
,
OPENERS
=
(
'class'
,
'def'
,
'for'
,
'if'
,
'try'
,
'while'
)):
OPENERS
=
(
'class'
,
'def'
,
'for'
,
'if'
,
'try'
,
'while'
)):
if
self
.
finished
:
if
self
.
finished
:
pass
pass
...
@@ -1554,19 +1555,19 @@ class IndentSearcher(object):
...
@@ -1554,19 +1555,19 @@ class IndentSearcher(object):
self
.
finished
=
1
self
.
finished
=
1
def
run
(
self
):
def
run
(
self
):
save_tabsize
=
_
tokenize
.
tabsize
save_tabsize
=
tokenize
.
tabsize
_
tokenize
.
tabsize
=
self
.
tabwidth
tokenize
.
tabsize
=
self
.
tabwidth
try
:
try
:
try
:
try
:
tokens
=
_
tokenize
.
generate_tokens
(
self
.
readline
)
tokens
=
tokenize
.
generate_tokens
(
self
.
readline
)
for
token
in
tokens
:
for
token
in
tokens
:
self
.
tokeneater
(
*
token
)
self
.
tokeneater
(
*
token
)
except
(
_
tokenize
.
TokenError
,
SyntaxError
):
except
(
tokenize
.
TokenError
,
SyntaxError
):
# since we cut off the tokenizer early, we can trigger
# since we cut off the tokenizer early, we can trigger
# spurious errors
# spurious errors
pass
pass
finally
:
finally
:
_
tokenize
.
tabsize
=
save_tabsize
tokenize
.
tabsize
=
save_tabsize
return
self
.
blkopenline
,
self
.
indentedline
return
self
.
blkopenline
,
self
.
indentedline
### end autoindent code ###
### end autoindent code ###
...
...
Lib/idlelib/filelist.py
View file @
bfbaa6b2
import
os
import
os
from
tkinter
import
*
from
tkinter
import
*
import
tkinter.messagebox
as
tkMessageBox
import
tkinter.messagebox
as
tkMessageBox
...
...
Lib/idlelib/grep.py
View file @
bfbaa6b2
import
os
import
fnmatch
import
fnmatch
import
os
import
sys
import
sys
from
tkinter
import
StringVar
,
BooleanVar
from
tkinter
import
StringVar
,
BooleanVar
from
tkinter.ttk
import
Checkbutton
from
tkinter.ttk
import
Checkbutton
from
idlelib
import
searchengine
from
idlelib.searchbase
import
SearchDialogBase
from
idlelib.searchbase
import
SearchDialogBase
# Importing OutputWindow fails due to import loop
from
idlelib
import
searchengine
# Importing OutputWindow here fails due to import loop
# EditorWindow -> GrepDialop -> OutputWindow -> EditorWindow
# EditorWindow -> GrepDialop -> OutputWindow -> EditorWindow
def
grep
(
text
,
io
=
None
,
flist
=
None
):
def
grep
(
text
,
io
=
None
,
flist
=
None
):
...
@@ -127,9 +130,9 @@ class GrepDialog(SearchDialogBase):
...
@@ -127,9 +130,9 @@ class GrepDialog(SearchDialogBase):
def
_grep_dialog
(
parent
):
# htest #
def
_grep_dialog
(
parent
):
# htest #
from
idlelib.pyshell
import
PyShellFileList
from
tkinter
import
Toplevel
,
Text
,
SEL
,
END
from
tkinter
import
Toplevel
,
Text
,
SEL
,
END
from
tkinter.ttk
import
Button
from
tkinter.ttk
import
Button
from
idlelib.pyshell
import
PyShellFileList
top
=
Toplevel
(
parent
)
top
=
Toplevel
(
parent
)
top
.
title
(
"Test GrepDialog"
)
top
.
title
(
"Test GrepDialog"
)
x
,
y
=
map
(
int
,
parent
.
geometry
().
split
(
'+'
)[
1
:])
x
,
y
=
map
(
int
,
parent
.
geometry
().
split
(
'+'
)[
1
:])
...
...
Lib/idlelib/help.py
View file @
bfbaa6b2
...
@@ -27,9 +27,11 @@ show_idlehelp - Create HelpWindow. Called in EditorWindow.help_dialog.
...
@@ -27,9 +27,11 @@ show_idlehelp - Create HelpWindow. Called in EditorWindow.help_dialog.
from
html.parser
import
HTMLParser
from
html.parser
import
HTMLParser
from
os.path
import
abspath
,
dirname
,
isfile
,
join
from
os.path
import
abspath
,
dirname
,
isfile
,
join
from
platform
import
python_version
from
platform
import
python_version
from
tkinter
import
Toplevel
,
Frame
,
Text
,
Menu
from
tkinter
import
Toplevel
,
Frame
,
Text
,
Menu
from
tkinter.ttk
import
Menubutton
,
Scrollbar
from
tkinter.ttk
import
Menubutton
,
Scrollbar
from
tkinter
import
font
as
tkfont
from
tkinter
import
font
as
tkfont
from
idlelib.config
import
idleConf
from
idlelib.config
import
idleConf
## About IDLE ##
## About IDLE ##
...
...
Lib/idlelib/help_about.py
View file @
bfbaa6b2
"""About Dialog for IDLE
"""About Dialog for IDLE
"""
"""
import
os
import
os
from
sys
import
version
from
sys
import
version
from
tkinter
import
*
from
tkinter
import
*
from
idlelib
import
textview
from
idlelib
import
textview
class
AboutDialog
(
Toplevel
):
class
AboutDialog
(
Toplevel
):
"""Modal about dialog for idle
"""Modal about dialog for idle
...
@@ -144,6 +146,7 @@ class AboutDialog(Toplevel):
...
@@ -144,6 +146,7 @@ class AboutDialog(Toplevel):
def
Ok
(
self
,
event
=
None
):
def
Ok
(
self
,
event
=
None
):
self
.
destroy
()
self
.
destroy
()
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
import
unittest
import
unittest
unittest
.
main
(
'idlelib.idle_test.test_help_about'
,
verbosity
=
2
,
exit
=
False
)
unittest
.
main
(
'idlelib.idle_test.test_help_about'
,
verbosity
=
2
,
exit
=
False
)
...
...
Lib/idlelib/history.py
View file @
bfbaa6b2
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
from
idlelib.config
import
idleConf
from
idlelib.config
import
idleConf
class
History
:
class
History
:
''' Implement Idle Shell history mechanism.
''' Implement Idle Shell history mechanism.
...
@@ -99,6 +100,7 @@ class History:
...
@@ -99,6 +100,7 @@ class History:
self
.
pointer
=
None
self
.
pointer
=
None
self
.
prefix
=
None
self
.
prefix
=
None
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
from
unittest
import
main
from
unittest
import
main
main
(
'idlelib.idle_test.test_
idle
history'
,
verbosity
=
2
,
exit
=
False
)
main
(
'idlelib.idle_test.test_history'
,
verbosity
=
2
,
exit
=
False
)
Lib/idlelib/hyperparser.py
View file @
bfbaa6b2
...
@@ -4,11 +4,10 @@ HyperParser uses PyParser. PyParser mostly gives information on the
...
@@ -4,11 +4,10 @@ HyperParser uses PyParser. PyParser mostly gives information on the
proper indentation of code. HyperParser gives additional information on
proper indentation of code. HyperParser gives additional information on
the structure of code.
the structure of code.
"""
"""
import
string
from
keyword
import
iskeyword
from
keyword
import
iskeyword
from
idlelib
import
pyparse
import
string
from
idlelib
import
pyparse
# all ASCII chars that may be in an identifier
# all ASCII chars that may be in an identifier
_ASCII_ID_CHARS
=
frozenset
(
string
.
ascii_letters
+
string
.
digits
+
"_"
)
_ASCII_ID_CHARS
=
frozenset
(
string
.
ascii_letters
+
string
.
digits
+
"_"
)
...
...
Lib/idlelib/idle_test/test_iomenu.py
View file @
bfbaa6b2
import
unittest
import
unittest
import
io
import
io
from
idlelib.pyshell
import
PseudoInputFile
,
PseudoOutputFile
from
idlelib.run
import
PseudoInputFile
,
PseudoOutputFile
class
S
(
str
):
class
S
(
str
):
...
@@ -230,4 +231,4 @@ class PseudeInputFilesTest(unittest.TestCase):
...
@@ -230,4 +231,4 @@ class PseudeInputFilesTest(unittest.TestCase):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
(
verbosity
=
2
)
Lib/idlelib/macosx.py
View file @
bfbaa6b2
...
@@ -2,9 +2,10 @@
...
@@ -2,9 +2,10 @@
A number of functions that enhance IDLE on Mac OSX.
A number of functions that enhance IDLE on Mac OSX.
"""
"""
from
sys
import
platform
# Used in _init_tk_type, changed by test.
from
sys
import
platform
# Used in _init_tk_type, changed by test.
import
tkinter
import
warnings
import
warnings
import
tkinter
## Define functions that query the Mac graphics type.
## Define functions that query the Mac graphics type.
## _tk_type and its initializer are private to this section.
## _tk_type and its initializer are private to this section.
...
...
Lib/idlelib/multicall.py
View file @
bfbaa6b2
...
@@ -28,9 +28,9 @@ The order by which events are called is defined by these rules:
...
@@ -28,9 +28,9 @@ The order by which events are called is defined by these rules:
unless this conflicts with the first rule.
unless this conflicts with the first rule.
Each function will be called at most once for each event.
Each function will be called at most once for each event.
"""
"""
import
sys
import
re
import
re
import
sys
import
tkinter
import
tkinter
# the event type constants, which define the meaning of mc_type
# the event type constants, which define the meaning of mc_type
...
...
Lib/idlelib/outwin.py
View file @
bfbaa6b2
from
tkinter
import
*
from
idlelib.editor
import
EditorWindow
import
re
import
re
from
tkinter
import
*
import
tkinter.messagebox
as
tkMessageBox
import
tkinter.messagebox
as
tkMessageBox
from
idlelib.editor
import
EditorWindow
from
idlelib
import
iomenu
from
idlelib
import
iomenu
class
OutputWindow
(
EditorWindow
):
class
OutputWindow
(
EditorWindow
):
"""An editor window that can serve as an output file.
"""An editor window that can serve as an output file.
...
...
Lib/idlelib/paragraph.py
View file @
bfbaa6b2
...
@@ -14,10 +14,11 @@ Known problems with comment reformatting:
...
@@ -14,10 +14,11 @@ Known problems with comment reformatting:
spaces, they will not be considered part of the same block.
spaces, they will not be considered part of the same block.
* Fancy comments, like this bulleted list, aren't handled :-)
* Fancy comments, like this bulleted list, aren't handled :-)
"""
"""
import
re
import
re
from
idlelib.config
import
idleConf
from
idlelib.config
import
idleConf
class
FormatParagraph
:
class
FormatParagraph
:
menudefs
=
[
menudefs
=
[
...
@@ -189,6 +190,7 @@ def get_comment_header(line):
...
@@ -189,6 +190,7 @@ def get_comment_header(line):
if
m
is
None
:
return
""
if
m
is
None
:
return
""
return
m
.
group
(
1
)
return
m
.
group
(
1
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
import
unittest
import
unittest
unittest
.
main
(
'idlelib.idle_test.test_paragraph'
,
unittest
.
main
(
'idlelib.idle_test.test_paragraph'
,
...
...
Lib/idlelib/parenmatch.py
View file @
bfbaa6b2
...
@@ -4,7 +4,6 @@ When you hit a right paren, the cursor should move briefly to the left
...
@@ -4,7 +4,6 @@ When you hit a right paren, the cursor should move briefly to the left
paren. Paren here is used generically; the matching applies to
paren. Paren here is used generically; the matching applies to
parentheses, square brackets, and curly braces.
parentheses, square brackets, and curly braces.
"""
"""
from
idlelib.hyperparser
import
HyperParser
from
idlelib.hyperparser
import
HyperParser
from
idlelib.config
import
idleConf
from
idlelib.config
import
idleConf
...
...
Lib/idlelib/pathbrowser.py
View file @
bfbaa6b2
import
importlib.machinery
import
os
import
os
import
sys
import
sys
import
importlib.machinery
from
idlelib.tree
import
TreeItem
from
idlelib.browser
import
ClassBrowser
,
ModuleBrowserTreeItem
from
idlelib.browser
import
ClassBrowser
,
ModuleBrowserTreeItem
from
idlelib.pyshell
import
PyShellFileList
from
idlelib.pyshell
import
PyShellFileList
from
idlelib.tree
import
TreeItem
class
PathBrowser
(
ClassBrowser
):
class
PathBrowser
(
ClassBrowser
):
...
@@ -24,6 +24,7 @@ class PathBrowser(ClassBrowser):
...
@@ -24,6 +24,7 @@ class PathBrowser(ClassBrowser):
def
rootnode
(
self
):
def
rootnode
(
self
):
return
PathBrowserTreeItem
()
return
PathBrowserTreeItem
()
class
PathBrowserTreeItem
(
TreeItem
):
class
PathBrowserTreeItem
(
TreeItem
):
def
GetText
(
self
):
def
GetText
(
self
):
...
@@ -36,6 +37,7 @@ class PathBrowserTreeItem(TreeItem):
...
@@ -36,6 +37,7 @@ class PathBrowserTreeItem(TreeItem):
sublist
.
append
(
item
)
sublist
.
append
(
item
)
return
sublist
return
sublist
class
DirBrowserTreeItem
(
TreeItem
):
class
DirBrowserTreeItem
(
TreeItem
):
def
__init__
(
self
,
dir
,
packages
=
[]):
def
__init__
(
self
,
dir
,
packages
=
[]):
...
@@ -95,6 +97,7 @@ class DirBrowserTreeItem(TreeItem):
...
@@ -95,6 +97,7 @@ class DirBrowserTreeItem(TreeItem):
sorted
.
sort
()
sorted
.
sort
()
return
sorted
return
sorted
def
_path_browser
(
parent
):
# htest #
def
_path_browser
(
parent
):
# htest #
flist
=
PyShellFileList
(
parent
)
flist
=
PyShellFileList
(
parent
)
PathBrowser
(
flist
,
_htest
=
True
)
PathBrowser
(
flist
,
_htest
=
True
)
...
...
Lib/idlelib/percolator.py
View file @
bfbaa6b2
from
idlelib.redirector
import
WidgetRedirector
from
idlelib.delegator
import
Delegator
from
idlelib.delegator
import
Delegator
from
idlelib.redirector
import
WidgetRedirector
class
Percolator
:
class
Percolator
:
...
...
Lib/idlelib/pyparse.py
View file @
bfbaa6b2
from
collections
import
Mapping
import
re
import
re
import
sys
import
sys
from
collections
import
Mapping
# Reason last stmt is continued (or C_NONE if it's not).
# Reason last stmt is continued (or C_NONE if it's not).
(
C_NONE
,
C_BACKSLASH
,
C_STRING_FIRST_LINE
,
(
C_NONE
,
C_BACKSLASH
,
C_STRING_FIRST_LINE
,
...
...
Lib/idlelib/pyshell.py
View file @
bfbaa6b2
...
@@ -15,9 +15,13 @@ if TkVersion < 8.5:
...
@@ -15,9 +15,13 @@ if TkVersion < 8.5:
parent
=
root
)
parent
=
root
)
sys
.
exit
(
1
)
sys
.
exit
(
1
)
from
code
import
InteractiveInterpreter
import
getopt
import
getopt
import
io
import
linecache
import
os
import
os
import
os.path
import
os.path
from
platform
import
python_version
,
system
import
re
import
re
import
socket
import
socket
import
subprocess
import
subprocess
...
@@ -25,23 +29,20 @@ import sys
...
@@ -25,23 +29,20 @@ import sys
import
threading
import
threading
import
time
import
time
import
tokenize
import
tokenize
import
warnings
import
linecache
from
idlelib
import
testing
# bool value
from
code
import
InteractiveInterpreter
from
platform
import
python_version
,
system
from
idlelib
import
testing
from
idlelib.editor
import
EditorWindow
,
fixwordbreaks
from
idlelib.filelist
import
FileList
from
idlelib.colorizer
import
ColorDelegator
from
idlelib.colorizer
import
ColorDelegator
from
idlelib.undo
import
UndoDelegator
from
idlelib.outwin
import
OutputWindow
from
idlelib.config
import
idleConf
from
idlelib.config
import
idleConf
from
idlelib.run
import
idle_formatwarning
,
PseudoInputFile
,
PseudoOutputFile
from
idlelib
import
rpc
from
idlelib
import
debugger
from
idlelib
import
debugger
from
idlelib
import
debugger_r
from
idlelib
import
debugger_r
from
idlelib.editor
import
EditorWindow
,
fixwordbreaks
from
idlelib.filelist
import
FileList
from
idlelib
import
macosx
from
idlelib
import
macosx
from
idlelib.outwin
import
OutputWindow
from
idlelib
import
rpc
from
idlelib.run
import
idle_formatwarning
,
PseudoInputFile
,
PseudoOutputFile
from
idlelib.undo
import
UndoDelegator
HOST
=
'127.0.0.1'
# python execution server on localhost loopback
HOST
=
'127.0.0.1'
# python execution server on localhost loopback
PORT
=
0
# someday pass in host, port for remote debug capability
PORT
=
0
# someday pass in host, port for remote debug capability
...
@@ -51,7 +52,6 @@ PORT = 0 # someday pass in host, port for remote debug capability
...
@@ -51,7 +52,6 @@ PORT = 0 # someday pass in host, port for remote debug capability
# temporarily redirect the stream to the shell window to display warnings when
# temporarily redirect the stream to the shell window to display warnings when
# checking user's code.
# checking user's code.
warning_stream
=
sys
.
__stderr__
# None, at least on Windows, if no console.
warning_stream
=
sys
.
__stderr__
# None, at least on Windows, if no console.
import
warnings
def
idle_showwarning
(
def
idle_showwarning
(
message
,
category
,
filename
,
lineno
,
file
=
None
,
line
=
None
):
message
,
category
,
filename
,
lineno
,
file
=
None
,
line
=
None
):
...
...
Lib/idlelib/query.py
View file @
bfbaa6b2
...
@@ -23,9 +23,10 @@ Subclass HelpSource gets menu item and path for additions to Help menu.
...
@@ -23,9 +23,10 @@ Subclass HelpSource gets menu item and path for additions to Help menu.
import
importlib
import
importlib
import
os
import
os
from
sys
import
executable
,
platform
# Platform is set for one test.
from
sys
import
executable
,
platform
# Platform is set for one test.
from
tkinter
import
Toplevel
,
StringVar
,
W
,
E
,
N
,
S
from
tkinter
import
Toplevel
,
StringVar
,
W
,
E
,
N
,
S
from
tkinter
import
filedialog
from
tkinter.ttk
import
Frame
,
Button
,
Entry
,
Label
from
tkinter.ttk
import
Frame
,
Button
,
Entry
,
Label
from
tkinter
import
filedialog
from
tkinter.font
import
Font
from
tkinter.font
import
Font
class
Query
(
Toplevel
):
class
Query
(
Toplevel
):
...
...
Lib/idlelib/replace.py
View file @
bfbaa6b2
...
@@ -3,12 +3,12 @@ Uses idlelib.SearchEngine for search capability.
...
@@ -3,12 +3,12 @@ Uses idlelib.SearchEngine for search capability.
Defines various replace related functions like replace, replace all,
Defines various replace related functions like replace, replace all,
replace+find.
replace+find.
"""
"""
import
re
from
tkinter
import
StringVar
,
TclError
from
tkinter
import
StringVar
,
TclError
from
idlelib
import
searchengine
from
idlelib.searchbase
import
SearchDialogBase
from
idlelib.searchbase
import
SearchDialogBase
import
re
from
idlelib
import
searchengine
def
replace
(
text
):
def
replace
(
text
):
"""Returns a singleton ReplaceDialog instance.The single dialog
"""Returns a singleton ReplaceDialog instance.The single dialog
...
...
Lib/idlelib/rpc.py
View file @
bfbaa6b2
...
@@ -26,23 +26,21 @@ See the Idle run.main() docstring for further information on how this was
...
@@ -26,23 +26,21 @@ See the Idle run.main() docstring for further information on how this was
accomplished in Idle.
accomplished in Idle.
"""
"""
import
builtins
import
sys
import
copyreg
import
os
import
io
import
io
import
socket
import
marshal
import
os
import
pickle
import
queue
import
select
import
select
import
socket
import
socketserver
import
socketserver
import
struct
import
struct
import
pickle
import
sys
import
threading
import
threading
import
queue
import
traceback
import
traceback
import
copyreg
import
types
import
types
import
marshal
import
builtins
def
unpickle_code
(
ms
):
def
unpickle_code
(
ms
):
co
=
marshal
.
loads
(
ms
)
co
=
marshal
.
loads
(
ms
)
...
@@ -60,10 +58,12 @@ def dumps(obj, protocol=None):
...
@@ -60,10 +58,12 @@ def dumps(obj, protocol=None):
p
.
dump
(
obj
)
p
.
dump
(
obj
)
return
f
.
getvalue
()
return
f
.
getvalue
()
class
CodePickler
(
pickle
.
Pickler
):
class
CodePickler
(
pickle
.
Pickler
):
dispatch_table
=
{
types
.
CodeType
:
pickle_code
}
dispatch_table
=
{
types
.
CodeType
:
pickle_code
}
dispatch_table
.
update
(
copyreg
.
dispatch_table
)
dispatch_table
.
update
(
copyreg
.
dispatch_table
)
BUFSIZE
=
8
*
1024
BUFSIZE
=
8
*
1024
LOCALHOST
=
'127.0.0.1'
LOCALHOST
=
'127.0.0.1'
...
@@ -487,16 +487,19 @@ class RemoteObject(object):
...
@@ -487,16 +487,19 @@ class RemoteObject(object):
# Token mix-in class
# Token mix-in class
pass
pass
def
remoteref
(
obj
):
def
remoteref
(
obj
):
oid
=
id
(
obj
)
oid
=
id
(
obj
)
objecttable
[
oid
]
=
obj
objecttable
[
oid
]
=
obj
return
RemoteProxy
(
oid
)
return
RemoteProxy
(
oid
)
class
RemoteProxy
(
object
):
class
RemoteProxy
(
object
):
def
__init__
(
self
,
oid
):
def
__init__
(
self
,
oid
):
self
.
oid
=
oid
self
.
oid
=
oid
class
RPCHandler
(
socketserver
.
BaseRequestHandler
,
SocketIO
):
class
RPCHandler
(
socketserver
.
BaseRequestHandler
,
SocketIO
):
debugging
=
False
debugging
=
False
...
@@ -514,6 +517,7 @@ class RPCHandler(socketserver.BaseRequestHandler, SocketIO):
...
@@ -514,6 +517,7 @@ class RPCHandler(socketserver.BaseRequestHandler, SocketIO):
def
get_remote_proxy
(
self
,
oid
):
def
get_remote_proxy
(
self
,
oid
):
return
RPCProxy
(
self
,
oid
)
return
RPCProxy
(
self
,
oid
)
class
RPCClient
(
SocketIO
):
class
RPCClient
(
SocketIO
):
debugging
=
False
debugging
=
False
...
@@ -539,6 +543,7 @@ class RPCClient(SocketIO):
...
@@ -539,6 +543,7 @@ class RPCClient(SocketIO):
def
get_remote_proxy
(
self
,
oid
):
def
get_remote_proxy
(
self
,
oid
):
return
RPCProxy
(
self
,
oid
)
return
RPCProxy
(
self
,
oid
)
class
RPCProxy
(
object
):
class
RPCProxy
(
object
):
__methods
=
None
__methods
=
None
...
@@ -587,6 +592,7 @@ def _getattributes(obj, attributes):
...
@@ -587,6 +592,7 @@ def _getattributes(obj, attributes):
if
not
callable
(
attr
):
if
not
callable
(
attr
):
attributes
[
name
]
=
1
attributes
[
name
]
=
1
class
MethodProxy
(
object
):
class
MethodProxy
(
object
):
def
__init__
(
self
,
sockio
,
oid
,
name
):
def
__init__
(
self
,
sockio
,
oid
,
name
):
...
...
Lib/idlelib/run.py
View file @
bfbaa6b2
...
@@ -2,21 +2,21 @@ import io
...
@@ -2,21 +2,21 @@ import io
import
linecache
import
linecache
import
queue
import
queue
import
sys
import
sys
import
_thread
as
thread
import
threading
import
time
import
time
import
traceback
import
traceback
import
tkinter
import
_thread
as
thread
import
threading
from
idlelib
import
calltips
import
warnings
from
idlelib
import
autocomplete
from
idlelib
import
debugger_r
import
tkinter
# Tcl, deletions, messagebox if startup fails
from
idlelib
import
debugobj_r
from
idlelib
import
stackviewer
from
idlelib
import
rpc
from
idlelib
import
iomenu
from
idlelib
import
autocomplete
# AutoComplete, fetch_encodings
from
idlelib
import
calltips
# CallTips
from
idlelib
import
debugger_r
# start_debugger
from
idlelib
import
debugobj_r
# remote_object_tree_item
from
idlelib
import
iomenu
# encoding
from
idlelib
import
rpc
# multiple objects
from
idlelib
import
stackviewer
# StackTreeItem
import
__main__
import
__main__
for
mod
in
(
'simpledialog'
,
'messagebox'
,
'font'
,
for
mod
in
(
'simpledialog'
,
'messagebox'
,
'font'
,
...
@@ -27,7 +27,6 @@ for mod in ('simpledialog', 'messagebox', 'font',
...
@@ -27,7 +27,6 @@ for mod in ('simpledialog', 'messagebox', 'font',
LOCALHOST
=
'127.0.0.1'
LOCALHOST
=
'127.0.0.1'
import
warnings
def
idle_formatwarning
(
message
,
category
,
filename
,
lineno
,
line
=
None
):
def
idle_formatwarning
(
message
,
category
,
filename
,
lineno
,
line
=
None
):
"""Format warnings the IDLE way."""
"""Format warnings the IDLE way."""
...
@@ -280,6 +279,7 @@ def exit():
...
@@ -280,6 +279,7 @@ def exit():
capture_warnings
(
False
)
capture_warnings
(
False
)
sys
.
exit
(
0
)
sys
.
exit
(
0
)
class
MyRPCServer
(
rpc
.
RPCServer
):
class
MyRPCServer
(
rpc
.
RPCServer
):
def
handle_error
(
self
,
request
,
client_address
):
def
handle_error
(
self
,
request
,
client_address
):
...
...
Lib/idlelib/runscript.py
View file @
bfbaa6b2
...
@@ -20,11 +20,12 @@ XXX GvR Redesign this interface (yet again) as follows:
...
@@ -20,11 +20,12 @@ XXX GvR Redesign this interface (yet again) as follows:
import
os
import
os
import
tabnanny
import
tabnanny
import
tokenize
import
tokenize
import
tkinter.messagebox
as
tkMessageBox
import
tkinter.messagebox
as
tkMessageBox
from
idlelib
import
pyshell
from
idlelib.config
import
idleConf
from
idlelib.config
import
idleConf
from
idlelib
import
macosx
from
idlelib
import
macosx
from
idlelib
import
pyshell
indent_message
=
"""Error: Inconsistent indentation detected!
indent_message
=
"""Error: Inconsistent indentation detected!
...
...
Lib/idlelib/scrolledlist.py
View file @
bfbaa6b2
from
tkinter
import
*
from
tkinter
import
*
from
idlelib
import
macosx
from
tkinter.ttk
import
Scrollbar
from
tkinter.ttk
import
Scrollbar
from
idlelib
import
macosx
class
ScrolledList
:
class
ScrolledList
:
default
=
"(None)"
default
=
"(None)"
...
...
Lib/idlelib/search.py
View file @
bfbaa6b2
...
@@ -24,6 +24,7 @@ def find_selection(text):
...
@@ -24,6 +24,7 @@ def find_selection(text):
"Handle the editor edit menu item and corresponding event."
"Handle the editor edit menu item and corresponding event."
return
_setup
(
text
).
find_selection
(
text
)
return
_setup
(
text
).
find_selection
(
text
)
class
SearchDialog
(
SearchDialogBase
):
class
SearchDialog
(
SearchDialogBase
):
def
create_widgets
(
self
):
def
create_widgets
(
self
):
...
...
Lib/idlelib/searchbase.py
View file @
bfbaa6b2
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
from
tkinter
import
Toplevel
,
Frame
from
tkinter
import
Toplevel
,
Frame
from
tkinter.ttk
import
Entry
,
Label
,
Button
,
Checkbutton
,
Radiobutton
from
tkinter.ttk
import
Entry
,
Label
,
Button
,
Checkbutton
,
Radiobutton
class
SearchDialogBase
:
class
SearchDialogBase
:
'''Create most of a 3 or 4 row, 3 column search dialog.
'''Create most of a 3 or 4 row, 3 column search dialog.
...
...
Lib/idlelib/searchengine.py
View file @
bfbaa6b2
'''Define SearchEngine for search dialogs.'''
'''Define SearchEngine for search dialogs.'''
import
re
import
re
from
tkinter
import
StringVar
,
BooleanVar
,
TclError
from
tkinter
import
StringVar
,
BooleanVar
,
TclError
import
tkinter.messagebox
as
tkMessageBox
import
tkinter.messagebox
as
tkMessageBox
...
@@ -14,6 +15,7 @@ def get(root):
...
@@ -14,6 +15,7 @@ def get(root):
# This creates a cycle that persists until root is deleted.
# This creates a cycle that persists until root is deleted.
return
root
.
_searchengine
return
root
.
_searchengine
class
SearchEngine
:
class
SearchEngine
:
"""Handles searching a text widget for Find, Replace, and Grep."""
"""Handles searching a text widget for Find, Replace, and Grep."""
...
@@ -186,6 +188,7 @@ class SearchEngine:
...
@@ -186,6 +188,7 @@ class SearchEngine:
col
=
len
(
chars
)
-
1
col
=
len
(
chars
)
-
1
return
None
return
None
def
search_reverse
(
prog
,
chars
,
col
):
def
search_reverse
(
prog
,
chars
,
col
):
'''Search backwards and return an re match object or None.
'''Search backwards and return an re match object or None.
...
...
Lib/idlelib/stackviewer.py
View file @
bfbaa6b2
import
os
import
sys
import
linecache
import
linecache
import
os
import
re
import
re
import
sys
import
tkinter
as
tk
import
tkinter
as
tk
from
idlelib.tree
import
TreeNode
,
TreeItem
,
ScrolledCanvas
from
idlelib.debugobj
import
ObjectTreeItem
,
make_objecttreeitem
from
idlelib.debugobj
import
ObjectTreeItem
,
make_objecttreeitem
from
idlelib.tree
import
TreeNode
,
TreeItem
,
ScrolledCanvas
def
StackBrowser
(
root
,
flist
=
None
,
tb
=
None
,
top
=
None
):
def
StackBrowser
(
root
,
flist
=
None
,
tb
=
None
,
top
=
None
):
if
top
is
None
:
if
top
is
None
:
...
@@ -16,6 +17,7 @@ def StackBrowser(root, flist=None, tb=None, top=None):
...
@@ -16,6 +17,7 @@ def StackBrowser(root, flist=None, tb=None, top=None):
node
=
TreeNode
(
sc
.
canvas
,
None
,
item
)
node
=
TreeNode
(
sc
.
canvas
,
None
,
item
)
node
.
expand
()
node
.
expand
()
class
StackTreeItem
(
TreeItem
):
class
StackTreeItem
(
TreeItem
):
def
__init__
(
self
,
flist
=
None
,
tb
=
None
):
def
__init__
(
self
,
flist
=
None
,
tb
=
None
):
...
@@ -54,6 +56,7 @@ class StackTreeItem(TreeItem):
...
@@ -54,6 +56,7 @@ class StackTreeItem(TreeItem):
sublist
.
append
(
item
)
sublist
.
append
(
item
)
return
sublist
return
sublist
class
FrameTreeItem
(
TreeItem
):
class
FrameTreeItem
(
TreeItem
):
def
__init__
(
self
,
info
,
flist
):
def
__init__
(
self
,
info
,
flist
):
...
@@ -95,6 +98,7 @@ class FrameTreeItem(TreeItem):
...
@@ -95,6 +98,7 @@ class FrameTreeItem(TreeItem):
if
os
.
path
.
isfile
(
filename
):
if
os
.
path
.
isfile
(
filename
):
self
.
flist
.
gotofileline
(
filename
,
lineno
)
self
.
flist
.
gotofileline
(
filename
,
lineno
)
class
VariablesTreeItem
(
ObjectTreeItem
):
class
VariablesTreeItem
(
ObjectTreeItem
):
def
GetText
(
self
):
def
GetText
(
self
):
...
@@ -119,6 +123,7 @@ class VariablesTreeItem(ObjectTreeItem):
...
@@ -119,6 +123,7 @@ class VariablesTreeItem(ObjectTreeItem):
sublist
.
append
(
item
)
sublist
.
append
(
item
)
return
sublist
return
sublist
def
_stack_viewer
(
parent
):
# htest #
def
_stack_viewer
(
parent
):
# htest #
from
idlelib.pyshell
import
PyShellFileList
from
idlelib.pyshell
import
PyShellFileList
top
=
tk
.
Toplevel
(
parent
)
top
=
tk
.
Toplevel
(
parent
)
...
...
Lib/idlelib/statusbar.py
View file @
bfbaa6b2
from
tkinter
import
Frame
,
Label
from
tkinter
import
Frame
,
Label
class
MultiStatusBar
(
Frame
):
class
MultiStatusBar
(
Frame
):
def
__init__
(
self
,
master
,
**
kw
):
def
__init__
(
self
,
master
,
**
kw
):
...
@@ -17,6 +18,7 @@ class MultiStatusBar(Frame):
...
@@ -17,6 +18,7 @@ class MultiStatusBar(Frame):
label
.
config
(
width
=
width
)
label
.
config
(
width
=
width
)
label
.
config
(
text
=
text
)
label
.
config
(
text
=
text
)
def
_multistatus_bar
(
parent
):
# htest #
def
_multistatus_bar
(
parent
):
# htest #
from
tkinter
import
Toplevel
,
Frame
,
Text
,
Button
from
tkinter
import
Toplevel
,
Frame
,
Text
,
Button
top
=
Toplevel
(
parent
)
top
=
Toplevel
(
parent
)
...
...
Lib/idlelib/tabbedpages.py
View file @
bfbaa6b2
...
@@ -285,6 +285,7 @@ class TabSet(Frame):
...
@@ -285,6 +285,7 @@ class TabSet(Frame):
# placed hide it
# placed hide it
self
.
tab_set
.
lower
()
self
.
tab_set
.
lower
()
class
TabbedPageSet
(
Frame
):
class
TabbedPageSet
(
Frame
):
"""A Tkinter tabbed-pane widget.
"""A Tkinter tabbed-pane widget.
...
@@ -302,6 +303,7 @@ class TabbedPageSet(Frame):
...
@@ -302,6 +303,7 @@ class TabbedPageSet(Frame):
remove_page() methods.
remove_page() methods.
"""
"""
class
Page
(
object
):
class
Page
(
object
):
"""Abstract base class for TabbedPageSet's pages.
"""Abstract base class for TabbedPageSet's pages.
...
@@ -467,6 +469,7 @@ class TabbedPageSet(Frame):
...
@@ -467,6 +469,7 @@ class TabbedPageSet(Frame):
self
.
_tab_set
.
set_selected_tab
(
page_name
)
self
.
_tab_set
.
set_selected_tab
(
page_name
)
def
_tabbed_pages
(
parent
):
# htest #
def
_tabbed_pages
(
parent
):
# htest #
top
=
Toplevel
(
parent
)
top
=
Toplevel
(
parent
)
x
,
y
=
map
(
int
,
parent
.
geometry
().
split
(
'+'
)[
1
:])
x
,
y
=
map
(
int
,
parent
.
geometry
().
split
(
'+'
)[
1
:])
...
...
Lib/idlelib/textview.py
View file @
bfbaa6b2
"""Simple text browser for IDLE
"""Simple text browser for IDLE
"""
"""
from
tkinter
import
*
from
tkinter
import
*
from
tkinter.ttk
import
Scrollbar
from
tkinter.ttk
import
Scrollbar
from
tkinter.messagebox
import
showerror
from
tkinter.messagebox
import
showerror
class
TextViewer
(
Toplevel
):
class
TextViewer
(
Toplevel
):
"""A simple text viewer dialog for IDLE
"""A simple text viewer dialog for IDLE
...
...
Lib/idlelib/tree.py
View file @
bfbaa6b2
...
@@ -15,10 +15,12 @@
...
@@ -15,10 +15,12 @@
# - optimize tree redraw after expand of subnode
# - optimize tree redraw after expand of subnode
import
os
import
os
from
tkinter
import
*
from
tkinter
import
*
from
tkinter.ttk
import
Scrollbar
from
tkinter.ttk
import
Scrollbar
from
idlelib
import
zoomheight
from
idlelib.config
import
idleConf
from
idlelib.config
import
idleConf
from
idlelib
import
zoomheight
ICONDIR
=
"Icons"
ICONDIR
=
"Icons"
...
...
Lib/idlelib/undo.py
View file @
bfbaa6b2
import
string
import
string
from
idlelib.delegator
import
Delegator
from
idlelib.delegator
import
Delegator
# tkintter import not needed because module does not create widgets,
# tkintter import not needed because module does not create widgets,
# although many methods operate on text widget arguments.
# although many methods operate on text widget arguments.
...
@@ -158,7 +160,6 @@ class UndoDelegator(Delegator):
...
@@ -158,7 +160,6 @@ class UndoDelegator(Delegator):
class
Command
:
class
Command
:
# Base class for Undoable commands
# Base class for Undoable commands
tags
=
None
tags
=
None
...
@@ -204,7 +205,6 @@ class Command:
...
@@ -204,7 +205,6 @@ class Command:
class
InsertCommand
(
Command
):
class
InsertCommand
(
Command
):
# Undoable insert command
# Undoable insert command
def
__init__
(
self
,
index1
,
chars
,
tags
=
None
):
def
__init__
(
self
,
index1
,
chars
,
tags
=
None
):
...
@@ -262,7 +262,6 @@ class InsertCommand(Command):
...
@@ -262,7 +262,6 @@ class InsertCommand(Command):
class
DeleteCommand
(
Command
):
class
DeleteCommand
(
Command
):
# Undoable delete command
# Undoable delete command
def
__init__
(
self
,
index1
,
index2
=
None
):
def
__init__
(
self
,
index1
,
index2
=
None
):
...
@@ -297,8 +296,8 @@ class DeleteCommand(Command):
...
@@ -297,8 +296,8 @@ class DeleteCommand(Command):
text
.
see
(
'insert'
)
text
.
see
(
'insert'
)
##sys.__stderr__.write("undo: %s\n" % self)
##sys.__stderr__.write("undo: %s\n" % self)
class
CommandSequence
(
Command
):
class
CommandSequence
(
Command
):
# Wrapper for a sequence of undoable cmds to be undone/redone
# Wrapper for a sequence of undoable cmds to be undone/redone
# as a unit
# as a unit
...
...
Lib/idlelib/windows.py
View file @
bfbaa6b2
from
tkinter
import
*
from
tkinter
import
*
class
WindowList
:
class
WindowList
:
def
__init__
(
self
):
def
__init__
(
self
):
...
@@ -48,6 +49,7 @@ class WindowList:
...
@@ -48,6 +49,7 @@ class WindowList:
t
,
v
,
tb
=
sys
.
exc_info
()
t
,
v
,
tb
=
sys
.
exc_info
()
print
(
"warning: callback failed in WindowList"
,
t
,
":"
,
v
)
print
(
"warning: callback failed in WindowList"
,
t
,
":"
,
v
)
registry
=
WindowList
()
registry
=
WindowList
()
add_windows_to_menu
=
registry
.
add_windows_to_menu
add_windows_to_menu
=
registry
.
add_windows_to_menu
...
...
Lib/idlelib/zoomheight.py
View file @
bfbaa6b2
...
@@ -5,6 +5,7 @@ import sys
...
@@ -5,6 +5,7 @@ import sys
from
idlelib
import
macosx
from
idlelib
import
macosx
class
ZoomHeight
:
class
ZoomHeight
:
menudefs
=
[
menudefs
=
[
...
@@ -20,6 +21,7 @@ class ZoomHeight:
...
@@ -20,6 +21,7 @@ class ZoomHeight:
top
=
self
.
editwin
.
top
top
=
self
.
editwin
.
top
zoom_height
(
top
)
zoom_height
(
top
)
def
zoom_height
(
top
):
def
zoom_height
(
top
):
geom
=
top
.
wm_geometry
()
geom
=
top
.
wm_geometry
()
m
=
re
.
match
(
r"(\
d+)x(
\d+)\
+(-?
\d+)\
+(-?
\d+)"
,
geom
)
m
=
re
.
match
(
r"(\
d+)x(
\d+)\
+(-?
\d+)\
+(-?
\d+)"
,
geom
)
...
...
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