cpython: a7501ddf74ac (original) (raw)
Mercurial > cpython
changeset 77317:a7501ddf74ac
Merge with 3.2 #12510 [#12510]
Terry Jan Reedy tjreedy@udel.edu | |
---|---|
date | Sun, 03 Jun 2012 01:06:38 -0400 |
parents | 3c43be281196(current diff)f927a5c6e4be(diff) |
children | 5e6676be2224 |
files | |
diffstat | 1 files changed, 17 insertions(+), 15 deletions(-)[+] [-] Lib/idlelib/CallTips.py 32 |
line wrap: on
line diff
--- a/Lib/idlelib/CallTips.py +++ b/Lib/idlelib/CallTips.py @@ -67,18 +67,18 @@ class CallTips: if not sur_paren: return hp.set_index(sur_paren[0])
name = hp.get_expression()[](#l1.7)
if not name:[](#l1.8)
expression = hp.get_expression()[](#l1.9)
if not expression:[](#l1.10) return[](#l1.11)
if not evalfuncs and (name.find('(') != -1):[](#l1.12)
if not evalfuncs and (expression.find('(') != -1):[](#l1.13) return[](#l1.14)
argspec = self.fetch_tip(name)[](#l1.15)
argspec = self.fetch_tip(expression)[](#l1.16) if not argspec:[](#l1.17) return[](#l1.18) self.active_calltip = self._calltip_window()[](#l1.19) self.active_calltip.showtip(argspec, sur_paren[0], sur_paren[1])[](#l1.20)
If there is a Python subprocess, get the calltip there. Otherwise, @@ -94,25 +94,27 @@ class CallTips: """ try: rpcclt = self.editwin.flist.pyshell.interp.rpcclt
except:[](#l1.31)
except AttributeError:[](#l1.32) rpcclt = None[](#l1.33) if rpcclt:[](#l1.34) return rpcclt.remotecall("exec", "get_the_calltip",[](#l1.35)
(name,), {})[](#l1.36)
(expression,), {})[](#l1.37) else:[](#l1.38)
entity = self.get_entity(name)[](#l1.39)
entity = self.get_entity(expression)[](#l1.40) return get_argspec(entity)[](#l1.41)
- def get_entity(self, name):
"Lookup name in a namespace spanning sys.modules and __main.dict__."[](#l1.44)
if name:[](#l1.45)
- def get_entity(self, expression):
"""Return the object corresponding to expression evaluated[](#l1.47)
in a namespace spanning sys.modules and __main.dict__.[](#l1.48)
"""[](#l1.49)
if expression:[](#l1.50) namespace = sys.modules.copy()[](#l1.51) namespace.update(__main__.__dict__)[](#l1.52) try:[](#l1.53)
return eval(name, namespace)[](#l1.54)
# any exception is possible if evalfuncs True in open_calltip[](#l1.55)
# at least Syntax, Name, Attribute, Index, and Key E. if not[](#l1.56)
except:[](#l1.57)
return eval(expression, namespace)[](#l1.58)
except BaseException:[](#l1.59)
# An uncaught exception closes idle, and eval can raise any[](#l1.60)
# exception, especially if user classes are involved.[](#l1.61) return None[](#l1.62)