cpython: eea379307efa (original) (raw)

--- a/Lib/idlelib/CallTips.py +++ b/Lib/idlelib/CallTips.py @@ -117,7 +117,7 @@ def get_entity(expression): return None

The following are used in both get_argspec and tests

-_self_pat = re.compile('self,?\s*') +_first_param = re.compile('(?<=()\w,?\s') _default_callable_argspec = "No docstring, see docs." def get_argspec(ob): @@ -141,7 +141,7 @@ def get_argspec(ob): argspec = inspect.formatargspec(*inspect.getfullargspec(fob)) if (isinstance(ob, (type, types.MethodType)) or isinstance(ob.call, types.MethodType)):

if isinstance(ob.call, types.MethodType): doc = ob.call.doc @@ -169,8 +169,7 @@ def main(): def t2(a, b=None): "(a, b=None)" def t3(a, *args): "(a, *args)" def t4(*args): "(*args)"

class TC(object): "(ai=None, *b)" @@ -179,13 +178,13 @@ def main(): def t2(self, ai, b=None): "(self, ai, b=None)" def t3(self, ai, *args): "(self, ai, *args)" def t4(self, *args): "(self, *args)"

tc = TC() @@ -228,19 +227,26 @@ def main(): test('SB()', _default_callable_argspec) def test_funcs():

def test_methods():

def test_non_callables(): # expression evaluates, but not to a callable