/opt/alt/python27/lib64/python2.7/idlelib
NameSizeModeActions
Icons/-0755rm
idle_test/-0755rm
aboutDialog.py70140644editdlrm
aboutDialog.pyc70170644editdlrm
aboutDialog.pyo70170644editdlrm
AutoComplete.py89640644editdlrm
AutoComplete.pyc81810644editdlrm
AutoComplete.pyo81810644editdlrm
AutoCompleteWindow.py173180644editdlrm
AutoCompleteWindow.pyc127140644editdlrm
AutoCompleteWindow.pyo126550644editdlrm
AutoExpand.py33950644editdlrm
AutoExpand.pyc35800644editdlrm
AutoExpand.pyo35800644editdlrm
Bindings.py29760644editdlrm
Bindings.pyc47080644editdlrm
Bindings.pyo47080644editdlrm
CallTips.py77400644editdlrm
CallTips.pyc83540644editdlrm
CallTips.pyo83540644editdlrm
CallTipWindow.py60650644editdlrm
CallTipWindow.pyc62920644editdlrm
CallTipWindow.pyo62920644editdlrm
ChangeLog563930644editdlrm
ClassBrowser.py69990644editdlrm
ClassBrowser.pyc98900644editdlrm
ClassBrowser.pyo98900644editdlrm
CodeContext.py83420644editdlrm
CodeContext.pyc67880644editdlrm
CodeContext.pyo67440644editdlrm
ColorDelegator.py97620644editdlrm
ColorDelegator.pyc91190644editdlrm
ColorDelegator.pyo91190644editdlrm
config-extensions.def29650644editdlrm
config-highlight.def25150644editdlrm
config-keys.def77770644editdlrm
config-main.def25610644editdlrm
configDialog.py659580644editdlrm
configDialog.pyc544350644editdlrm
configDialog.pyo544350644editdlrm
configHandler.py324850644editdlrm
configHandler.pyc299850644editdlrm
configHandler.pyo299850644editdlrm
configHelpSourceEdit.py66860644editdlrm
configHelpSourceEdit.pyc67120644editdlrm
configHelpSourceEdit.pyo67120644editdlrm
configSectionNameDialog.py40400644editdlrm
configSectionNameDialog.pyc45100644editdlrm
configSectionNameDialog.pyo45100644editdlrm
CREDITS.txt18660644editdlrm
Debugger.py182360644editdlrm
Debugger.pyc181440644editdlrm
Debugger.pyo181440644editdlrm
Delegator.py6650644editdlrm
Delegator.pyc13460644editdlrm
Delegator.pyo13460644editdlrm
dynOptionMenuWidget.py19840644editdlrm
dynOptionMenuWidget.pyc28680644editdlrm
dynOptionMenuWidget.pyo28680644editdlrm
EditorWindow.py654980644editdlrm
EditorWindow.pyc585220644editdlrm
EditorWindow.pyo584200644editdlrm
extend.txt36420644editdlrm
FileList.py37180644editdlrm
FileList.pyc41680644editdlrm
FileList.pyo41350644editdlrm
FormatParagraph.py72870644editdlrm
FormatParagraph.pyc73110644editdlrm
FormatParagraph.pyo73110644editdlrm
GrepDialog.py51450644editdlrm
GrepDialog.pyc66070644editdlrm
GrepDialog.pyo66070644editdlrm
help.html424140644editdlrm
help.py110350644editdlrm
help.pyc125430644editdlrm
help.pyo125430644editdlrm
help.txt121440644editdlrm
HISTORY.txt103170644editdlrm
HyperParser.py104970644editdlrm
HyperParser.pyc68030644editdlrm
HyperParser.pyo68030644editdlrm
idle.py4530644editdlrm
idle.pyc4230644editdlrm
idle.pyo4230644editdlrm
idle.pyw5630644editdlrm
IdleHistory.py40520644editdlrm
IdleHistory.pyc41510644editdlrm
IdleHistory.pyo41510644editdlrm
idlever.py4150644editdlrm
idlever.pyc5910644editdlrm
idlever.pyo5910644editdlrm
IOBinding.py219110644editdlrm
IOBinding.pyc190680644editdlrm
IOBinding.pyo190680644editdlrm
keybindingDialog.py124680644editdlrm
keybindingDialog.pyc123680644editdlrm
keybindingDialog.pyo123680644editdlrm
macosxSupport.py84350644editdlrm
macosxSupport.pyc85850644editdlrm
macosxSupport.pyo84470644editdlrm
MultiCall.py177010644editdlrm
MultiCall.pyc167930644editdlrm
MultiCall.pyo167190644editdlrm
MultiStatusBar.py13480644editdlrm
MultiStatusBar.pyc23570644editdlrm
MultiStatusBar.pyo23570644editdlrm
NEWS.txt472470644editdlrm
ObjectBrowser.py43760644editdlrm
ObjectBrowser.pyc74310644editdlrm
ObjectBrowser.pyo74310644editdlrm
OutputWindow.py45760644editdlrm
OutputWindow.pyc54270644editdlrm
OutputWindow.pyo54270644editdlrm
ParenMatch.py67140644editdlrm
ParenMatch.pyc73500644editdlrm
ParenMatch.pyo73500644editdlrm
PathBrowser.py30090644editdlrm
PathBrowser.pyc46810644editdlrm
PathBrowser.pyo46810644editdlrm
Percolator.py32220644editdlrm
Percolator.pyc48030644editdlrm
Percolator.pyo46190644editdlrm
PyParse.py195100644editdlrm
PyParse.pyc102260644editdlrm
PyParse.pyo97880644editdlrm
PyShell.py588590755editdlrm
PyShell.pyc542690644editdlrm
PyShell.pyo541670644editdlrm
README.txt78900644editdlrm
RemoteDebugger.py116320644editdlrm
RemoteDebugger.pyc171310644editdlrm
RemoteDebugger.pyo169770644editdlrm
RemoteObjectBrowser.py9420644editdlrm
RemoteObjectBrowser.pyc22800644editdlrm
RemoteObjectBrowser.pyo22800644editdlrm
ReplaceDialog.py66390644editdlrm
ReplaceDialog.pyc80160644editdlrm
ReplaceDialog.pyo80160644editdlrm
rpc.py201500644editdlrm
rpc.pyc224950644editdlrm
rpc.pyo223890644editdlrm
RstripExtension.py10500644editdlrm
RstripExtension.pyc16650644editdlrm
RstripExtension.pyo16650644editdlrm
run.py129170644editdlrm
run.pyc137700644editdlrm
run.pyo137120644editdlrm
ScriptBinding.py84590644editdlrm
ScriptBinding.pyc83700644editdlrm
ScriptBinding.pyo83700644editdlrm
ScrolledList.py43730644editdlrm
ScrolledList.pyc67680644editdlrm
ScrolledList.pyo67680644editdlrm
SearchDialog.py26300644editdlrm
SearchDialog.pyc41390644editdlrm
SearchDialog.pyo41390644editdlrm
SearchDialogBase.py70940644editdlrm
SearchDialogBase.pyc86310644editdlrm
SearchDialogBase.pyo86310644editdlrm
SearchEngine.py74630644editdlrm
SearchEngine.pyc85750644editdlrm
SearchEngine.pyo85750644editdlrm
StackViewer.py44310644editdlrm
StackViewer.pyc66770644editdlrm
StackViewer.pyo66770644editdlrm
tabbedpages.py184390644editdlrm
tabbedpages.pyc190810644editdlrm
tabbedpages.pyo190810644editdlrm
textView.py35200644editdlrm
textView.pyc41160644editdlrm
textView.pyo41160644editdlrm
TODO.txt84780644editdlrm
ToolTip.py31730644editdlrm
ToolTip.pyc48900644editdlrm
ToolTip.pyo48900644editdlrm
TreeWidget.py150370644editdlrm
TreeWidget.pyc183830644editdlrm
TreeWidget.pyo183830644editdlrm
UndoDelegator.py107870644editdlrm
UndoDelegator.pyc142180644editdlrm
UndoDelegator.pyo142180644editdlrm
WidgetRedirector.py69060644editdlrm
WidgetRedirector.pyc79510644editdlrm
WidgetRedirector.pyo79510644editdlrm
WindowList.py24730644editdlrm
WindowList.pyc38310644editdlrm
WindowList.pyo38310644editdlrm
ZoomHeight.py13000644editdlrm
ZoomHeight.pyc17110644editdlrm
ZoomHeight.pyo17110644editdlrm
__init__.py2880644editdlrm
__init__.pyc4440644editdlrm
__init__.pyo4440644editdlrm
Edit: /opt/alt/python27/lib64/python2.7/idlelib/CallTips.py (7740B)
"""CallTips.py - An IDLE Extension to Jog Your Memory Call Tips are floating windows which display function, class, and method parameter and docstring information when you type an opening parenthesis, and which disappear when you type a closing parenthesis. """ import __main__ import re import sys import textwrap import types from idlelib import CallTipWindow from idlelib.HyperParser import HyperParser class CallTips: menudefs = [ ('edit', [ ("Show call tip", "<>"), ]) ] def __init__(self, editwin=None): if editwin is None: # subprocess and test self.editwin = None return self.editwin = editwin self.text = editwin.text self.calltip = None self._make_calltip_window = self._make_tk_calltip_window def close(self): self._make_calltip_window = None def _make_tk_calltip_window(self): # See __init__ for usage return CallTipWindow.CallTip(self.text) def _remove_calltip_window(self, event=None): if self.calltip: self.calltip.hidetip() self.calltip = None def force_open_calltip_event(self, event): """Happens when the user really wants to open a CallTip, even if a function call is needed. """ self.open_calltip(True) def try_open_calltip_event(self, event): """Happens when it would be nice to open a CallTip, but not really necessary, for example after an opening bracket, so function calls won't be made. """ self.open_calltip(False) def refresh_calltip_event(self, event): """If there is already a calltip window, check if it is still needed, and if so, reload it. """ if self.calltip and self.calltip.is_active(): self.open_calltip(False) def open_calltip(self, evalfuncs): self._remove_calltip_window() hp = HyperParser(self.editwin, "insert") sur_paren = hp.get_surrounding_brackets('(') if not sur_paren: return hp.set_index(sur_paren[0]) expression = hp.get_expression() if not expression or (not evalfuncs and expression.find('(') != -1): return arg_text = self.fetch_tip(expression) if not arg_text: return self.calltip = self._make_calltip_window() self.calltip.showtip(arg_text, sur_paren[0], sur_paren[1]) def fetch_tip(self, expression): """Return the argument list and docstring of a function or class If there is a Python subprocess, get the calltip there. Otherwise, either fetch_tip() is running in the subprocess itself or it was called in an IDLE EditorWindow before any script had been run. The subprocess environment is that of the most recently run script. If two unrelated modules are being edited some calltips in the current module may be inoperative if the module was not the last to run. To find methods, fetch_tip must be fed a fully qualified name. """ try: rpcclt = self.editwin.flist.pyshell.interp.rpcclt except AttributeError: rpcclt = None if rpcclt: return rpcclt.remotecall("exec", "get_the_calltip", (expression,), {}) else: entity = self.get_entity(expression) return get_arg_text(entity) def get_entity(self, expression): """Return the object corresponding to expression evaluated in a namespace spanning sys.modules and __main.dict__. """ if expression: namespace = sys.modules.copy() namespace.update(__main__.__dict__) try: return eval(expression, namespace) except BaseException: # An uncaught exception closes idle, and eval can raise any # exception, especially if user classes are involved. return None def _find_constructor(class_ob): # Given a class object, return a function object used for the # constructor (ie, __init__() ) or None if we can't find one. try: return class_ob.__init__.im_func except AttributeError: for base in class_ob.__bases__: rc = _find_constructor(base) if rc is not None: return rc return None # The following are used in get_arg_text _MAX_COLS = 85 _MAX_LINES = 5 # enough for bytes _INDENT = ' '*4 # for wrapped signatures def get_arg_text(ob): '''Return a string describing the signature of a callable object, or ''. For Python-coded functions and methods, the first line is introspected. Delete 'self' parameter for classes (.__init__) and bound methods. The next lines are the first lines of the doc string up to the first empty line or _MAX_LINES. For builtins, this typically includes the arguments in addition to the return value. ''' argspec = "" try: ob_call = ob.__call__ except BaseException: if type(ob) is types.ClassType: # old-style ob_call = ob else: return argspec arg_offset = 0 if type(ob) in (types.ClassType, types.TypeType): # Look for the first __init__ in the class chain with .im_func. # Slot wrappers (builtins, classes defined in funcs) do not. fob = _find_constructor(ob) if fob is None: fob = lambda: None else: arg_offset = 1 elif type(ob) == types.MethodType: # bit of a hack for methods - turn it into a function # and drop the "self" param for bound methods fob = ob.im_func if ob.im_self is not None: arg_offset = 1 elif type(ob_call) == types.MethodType: # a callable class instance fob = ob_call.im_func arg_offset = 1 else: fob = ob # Try to build one for Python defined functions if type(fob) in [types.FunctionType, types.LambdaType]: argcount = fob.func_code.co_argcount real_args = fob.func_code.co_varnames[arg_offset:argcount] defaults = fob.func_defaults or [] defaults = list(map(lambda name: "=%s" % repr(name), defaults)) defaults = [""] * (len(real_args) - len(defaults)) + defaults items = map(lambda arg, dflt: arg + dflt, real_args, defaults) for flag, pre, name in ((0x4, '*', 'args'), (0x8, '**', 'kwargs')): if fob.func_code.co_flags & flag: pre_name = pre + name if name not in real_args: items.append(pre_name) else: i = 1 while ((name+'%s') % i) in real_args: i += 1 items.append((pre_name+'%s') % i) argspec = ", ".join(items) argspec = "(%s)" % re.sub("(?", argspec) lines = (textwrap.wrap(argspec, _MAX_COLS, subsequent_indent=_INDENT) if len(argspec) > _MAX_COLS else [argspec] if argspec else []) if isinstance(ob_call, types.MethodType): doc = ob_call.__doc__ else: doc = getattr(ob, "__doc__", "") if doc: for line in doc.split('\n', _MAX_LINES)[:_MAX_LINES]: line = line.strip() if not line: break if len(line) > _MAX_COLS: line = line[: _MAX_COLS - 3] + '...' lines.append(line) argspec = '\n'.join(lines) return argspec if __name__ == '__main__': from unittest import main main('idlelib.idle_test.test_calltips', verbosity=2)