mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
Merged revisions 55795-55816 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk ........ r55797 | neal.norwitz | 2007-06-07 00:00:57 -0700 (Thu, 07 Jun 2007) | 3 lines Get rid of some remnants of classic classes. types.ClassType == type. Also get rid of almost all uses of the types module and use the builtin name. ........ r55798 | neal.norwitz | 2007-06-07 00:12:36 -0700 (Thu, 07 Jun 2007) | 1 line Remove a use of types, verify commit hook works ........ r55809 | guido.van.rossum | 2007-06-07 11:11:29 -0700 (Thu, 07 Jun 2007) | 2 lines Fix syntax error introduced by Neal in last checkin. ........
This commit is contained in:
parent
7b955bd125
commit
1325790b93
40 changed files with 161 additions and 202 deletions
|
|
@ -21,7 +21,7 @@ class ScrolledText(Text):
|
|||
cnf = _cnfmerge((cnf, kw))
|
||||
fcnf = {}
|
||||
for k in cnf.keys():
|
||||
if type(k) == ClassType or k == 'name':
|
||||
if isinstace(k, type) or k == 'name':
|
||||
fcnf[k] = cnf[k]
|
||||
del cnf[k]
|
||||
self.frame = Frame(master, **fcnf)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ if sys.platform == "win32":
|
|||
import _tkinter # If this fails your Python may not be configured for Tk
|
||||
tkinter = _tkinter # b/w compat for export
|
||||
TclError = _tkinter.TclError
|
||||
from types import *
|
||||
from Tkconstants import *
|
||||
try:
|
||||
import MacOS; _MacOS = MacOS; del MacOS
|
||||
|
|
@ -61,11 +60,11 @@ try: _tkinter.deletefilehandler
|
|||
except AttributeError: _tkinter.deletefilehandler = None
|
||||
|
||||
|
||||
def _flatten(tuple):
|
||||
def _flatten(seq):
|
||||
"""Internal function."""
|
||||
res = ()
|
||||
for item in tuple:
|
||||
if type(item) in (TupleType, ListType):
|
||||
for item in seq:
|
||||
if isinstance(item, (tuple, list)):
|
||||
res = res + _flatten(item)
|
||||
elif item is not None:
|
||||
res = res + (item,)
|
||||
|
|
@ -76,9 +75,9 @@ except AttributeError: pass
|
|||
|
||||
def _cnfmerge(cnfs):
|
||||
"""Internal function."""
|
||||
if type(cnfs) is DictionaryType:
|
||||
if isinstance(cnfs, dict):
|
||||
return cnfs
|
||||
elif type(cnfs) in (NoneType, StringType):
|
||||
elif isinstance(cnfs, (type(None), str)):
|
||||
return cnfs
|
||||
else:
|
||||
cnf = {}
|
||||
|
|
@ -867,7 +866,7 @@ class Misc:
|
|||
data = self.tk.split(
|
||||
self.tk.call('winfo', 'visualsavailable', self._w,
|
||||
includeids and 'includeids' or None))
|
||||
if type(data) is StringType:
|
||||
if isinstance(data, str):
|
||||
data = [self.tk.split(data)]
|
||||
return map(self.__winfo_parseitem, data)
|
||||
def __winfo_parseitem(self, t):
|
||||
|
|
@ -934,7 +933,7 @@ class Misc:
|
|||
self.tk.call('bindtags', self._w, tagList)
|
||||
def _bind(self, what, sequence, func, add, needcleanup=1):
|
||||
"""Internal function."""
|
||||
if type(func) is StringType:
|
||||
if isinstance(func, str):
|
||||
self.tk.call(what + (sequence, func))
|
||||
elif func:
|
||||
funcid = self._register(func, self._substitute,
|
||||
|
|
@ -1181,7 +1180,7 @@ class Misc:
|
|||
self.tk.call(_flatten((self._w, cmd)))):
|
||||
cnf[x[0][1:]] = (x[0][1:],) + x[1:]
|
||||
return cnf
|
||||
if type(cnf) is StringType:
|
||||
if isinstance(cnf, str):
|
||||
x = self.tk.split(
|
||||
self.tk.call(_flatten((self._w, cmd, '-'+cnf))))
|
||||
return (x[0][1:],) + x[1:]
|
||||
|
|
@ -1262,7 +1261,7 @@ class Misc:
|
|||
bbox = grid_bbox
|
||||
def _grid_configure(self, command, index, cnf, kw):
|
||||
"""Internal function."""
|
||||
if type(cnf) is StringType and not kw:
|
||||
if isinstance(cnf, str) and not kw:
|
||||
if cnf[-1:] == '_':
|
||||
cnf = cnf[:-1]
|
||||
if cnf[:1] != '-':
|
||||
|
|
@ -1923,7 +1922,7 @@ class BaseWidget(Misc):
|
|||
BaseWidget._setup(self, master, cnf)
|
||||
classes = []
|
||||
for k in cnf.keys():
|
||||
if type(k) is ClassType:
|
||||
if isinstance(k, type):
|
||||
classes.append((k, cnf[k]))
|
||||
del cnf[k]
|
||||
self.tk.call(
|
||||
|
|
@ -2136,7 +2135,7 @@ class Canvas(Widget):
|
|||
"""Internal function."""
|
||||
args = _flatten(args)
|
||||
cnf = args[-1]
|
||||
if type(cnf) in (DictionaryType, TupleType):
|
||||
if isinstance(cnf, (dict, tuple)):
|
||||
args = args[:-1]
|
||||
else:
|
||||
cnf = {}
|
||||
|
|
@ -3695,7 +3694,7 @@ class PanedWindow(Widget):
|
|||
'paneconfigure', tagOrId)):
|
||||
cnf[x[0][1:]] = (x[0][1:],) + x[1:]
|
||||
return cnf
|
||||
if type(cnf) == StringType and not kw:
|
||||
if isinstance(cnf, str) and not kw:
|
||||
x = self.tk.split(self.tk.call(
|
||||
self._w, 'paneconfigure', tagOrId, '-'+cnf))
|
||||
return (x[0][1:],) + x[1:]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue