Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/idle
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv4261/Pythonwin/pywin/idle
Modified Files:
Tag: py3k
AutoIndent.py CallTips.py
Log Message:
merge lots of changes (most via 2to3) from the trunk
Index: CallTips.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/idle/CallTips.py,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -C2 -d -r1.3.2.1 -r1.3.2.2
*** CallTips.py 29 Aug 2008 06:16:42 -0000 1.3.2.1
--- CallTips.py 5 Jan 2009 12:51:26 -0000 1.3.2.2
***************
*** 4,8 ****
import string
import sys
! import types
class CallTips:
--- 4,9 ----
import string
import sys
! import inspect
! import traceback
class CallTips:
***************
*** 101,105 ****
# constructor (ie, __init__() ) or None if we can't find one.
try:
! return class_ob.__init__.__func__
except AttributeError:
for base in class_ob.__bases__:
--- 102,109 ----
# constructor (ie, __init__() ) or None if we can't find one.
try:
! if sys.version_info < (3,):
! return class_ob.__init__.im_func
! else:
! return class_ob.__init__.__func__
except AttributeError:
for base in class_ob.__bases__:
***************
*** 113,146 ****
if ob is not None:
argOffset = 0
! if type(ob)==type:
# Look for the highest __init__ in the class chain.
fob = _find_constructor(ob)
if fob is None:
fob = lambda: None
- else:
- argOffset = 1
- elif type(ob)==types.MethodType:
- # bit of a hack for methods - turn it into a function
- # but we drop the "self" param.
- fob = ob.__func__
- argOffset = 1
else:
fob = ob
! # Try and build one for Python defined functions
! if type(fob) in [types.FunctionType, types.LambdaType]:
try:
! realArgs = fob.__code__.co_varnames[argOffset:fob.__code__.co_argcount]
! defaults = fob.__defaults__ or []
! defaults = list(["=%s" % name for name in defaults])
! defaults = [""] * (len(realArgs)-len(defaults)) + defaults
! items = list(map(lambda arg, dflt: arg+dflt, realArgs, defaults))
! if fob.__code__.co_flags & 0x4:
! items.append("...")
! if fob.__code__.co_flags & 0x8:
! items.append("***")
! argText = ", ".join(items)
! argText = "(%s)" % argText
except:
! pass
# See if we can use the docstring
if hasattr(ob, "__doc__"):
--- 117,135 ----
if ob is not None:
argOffset = 0
! if inspect.isclass(ob):
# Look for the highest __init__ in the class chain.
fob = _find_constructor(ob)
if fob is None:
fob = lambda: None
else:
fob = ob
! if inspect.isfunction(fob) or inspect.ismethod(fob):
try:
! # py3k has a 'getfullargspec' which can handle py3k specific things.
! arg_getter = getattr(inspect, "getfullargspec", inspect.getargspec)
! argText = inspect.formatargspec(*arg_getter(fob))
except:
! print("Failed to format the args")
! traceback.print_exc()
# See if we can use the docstring
if hasattr(ob, "__doc__"):
***************
*** 167,184 ****
def t1(): "()"
def t2(a, b=None): "(a, b=None)"
! def t3(a, *args): "(a, ...)"
! def t4(*args): "(...)"
! def t5(a, *args): "(a, ...)"
! def t6(a, b=None, *args, **kw): "(a, b=None, ..., ***)"
class TC:
! "(a=None, ...)"
! def __init__(self, a=None, *b): "(a=None, ...)"
! def t1(self): "()"
! def t2(self, a, b=None): "(a, b=None)"
! def t3(self, a, *args): "(a, ...)"
! def t4(self, *args): "(...)"
! def t5(self, a, *args): "(a, ...)"
! def t6(self, a, b=None, *args, **kw): "(a, b=None, ..., ***)"
def test( tests ):
--- 156,173 ----
def t1(): "()"
def t2(a, b=None): "(a, b=None)"
! def t3(a, *args): "(a, *args)"
! def t4(*args): "(*args)"
! def t5(a, *args): "(a, *args)"
! def t6(a, b=None, *args, **kw): "(a, b=None, *args, **kw)"
class TC:
! "(self, a=None, *b)"
! def __init__(self, a=None, *b): "(self, a=None, *b)"
! def t1(self): "(self)"
! def t2(self, a, b=None): "(self, a, b=None)"
! def t3(self, a, *args): "(self, a, *args)"
! def t4(self, *args): "(self, *args)"
! def t5(self, a, *args): "(self, a, *args)"
! def t6(self, a, b=None, *args, **kw): "(self, a, b=None, *args, **kw)"
def test( tests ):
***************
*** 196,197 ****
--- 185,187 ----
test(tests)
+
Index: AutoIndent.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/idle/AutoIndent.py,v
retrieving revision 1.3.2.8
retrieving revision 1.3.2.9
diff -C2 -d -r1.3.2.8 -r1.3.2.9
*** AutoIndent.py 3 Jan 2009 04:45:17 -0000 1.3.2.8
--- AutoIndent.py 5 Jan 2009 12:51:26 -0000 1.3.2.9
***************
*** 94,98 ****
def config(self, **options):
! for key, value in list(options.items()):
if key == 'usetabs':
self.usetabs = value
--- 94,98 ----
def config(self, **options):
! for key, value in options.items():
if key == 'usetabs':
self.usetabs = value
***************
*** 210,214 ****
# the cursor is in or at leading indentation; just inject
# an empty line at the start
! text.insert("insert linestart", '\r\n')
return "break"
indent = line[:i]
--- 210,214 ----
# the cursor is in or at leading indentation; just inject
# an empty line at the start
! text.insert("insert linestart", '\n')
return "break"
indent = line[:i]
***************
*** 224,229 ****
text.delete("insert")
# start new line
! ## Line ending needs to be configured somewhere instead of hardcoded
! text.insert("insert", '\r\n')
# adjust indentation for continuations and block
--- 224,228 ----
text.delete("insert")
# start new line
! text.insert("insert", '\n')
# adjust indentation for continuations and block
|