Exemple #1
0
 def _handle_object_info_reply(self, rep):
     """
     Reimplement call tips to only show signatures, using the same style
     from our Editor and External Console too
     Note: For IPython 2-
     """
     self.log.debug("oinfo: %s", rep.get('content', ''))
     cursor = self._get_cursor()
     info = self._request_info.get('call_tip')
     if info and info.id == rep['parent_header']['msg_id'] and \
       info.pos == cursor.position():
         content = rep['content']
         if content.get('ismagic', False):
             call_info, doc = None, None
         else:
             call_info, doc = call_tip(content, format_call=True)
             if call_info is None and doc is not None:
                 name = content['name'].split('.')[-1]
                 argspec = getargspecfromtext(doc)
                 if argspec:
                     # This covers cases like np.abs, whose docstring is
                     # the same as np.absolute and because of that a proper
                     # signature can't be obtained correctly
                     call_info = name + argspec
                 else:
                     call_info = getsignaturefromtext(doc, name)
         if call_info:
             self._control.show_calltip(_("Arguments"), call_info,
                                        signature=True, color='#2D62FF')
Exemple #2
0
 def _handle_object_info_reply(self, rep):
     """
     Reimplement call tips to only show signatures, using the same style
     from our Editor and External Console too
     Note: For IPython 2-
     """
     self.log.debug("oinfo: %s", rep.get('content', ''))
     cursor = self._get_cursor()
     info = self._request_info.get('call_tip')
     if info and info.id == rep['parent_header']['msg_id'] and \
       info.pos == cursor.position():
         content = rep['content']
         if content.get('ismagic', False):
             call_info, doc = None, None
         else:
             call_info, doc = call_tip(content, format_call=True)
             if call_info is None and doc is not None:
                 name = content['name'].split('.')[-1]
                 argspec = getargspecfromtext(doc)
                 if argspec:
                     # This covers cases like np.abs, whose docstring is
                     # the same as np.absolute and because of that a proper
                     # signature can't be obtained correctly
                     call_info = name + argspec
                 else:
                     call_info = getsignaturefromtext(doc, name)
         if call_info:
             self._control.show_calltip(_("Arguments"),
                                        call_info,
                                        signature=True,
                                        color='#2D62FF')
Exemple #3
0
 def _handle_object_info_reply(self, rep):
     """ Handle replies for call tips.
     """
     cursor = self._get_cursor()
     info = self._request_info.get('call_tip')
     if info and info.id == rep['parent_header']['msg_id'] and \
             info.pos == cursor.position():
         # Get the information for a call tip.  For now we format the call
         # line as string, later we can pass False to format_call and
         # syntax-highlight it ourselves for nicer formatting in the
         # calltip.
         call_info, doc = call_tip(rep['content'], format_call=True)
         if call_info or doc:
             self._call_tip_widget.show_call_info(call_info, doc)
 def _handle_object_info_reply(self, rep):
     """ Handle replies for call tips.
     """
     cursor = self._get_cursor()
     info = self._request_info.get('call_tip')
     if info and info.id == rep['parent_header']['msg_id'] and \
             info.pos == cursor.position():
         # Get the information for a call tip.  For now we format the call
         # line as string, later we can pass False to format_call and
         # syntax-highlight it ourselves for nicer formatting in the
         # calltip.
         call_info, doc = call_tip(rep['content'], format_call=True)
         if call_info or doc:
             self._call_tip_widget.show_call_info(call_info, doc)
 def _handle_object_info_reply(self, rep):
     """ Handle replies for call tips.
     """
     cursor = self._get_cursor()
     info = self._request_info.get('call_tip')
     if info and info.id == rep['parent_header']['msg_id'] and \
             info.pos == cursor.position():
         # Get the information for a call tip.  For now we format the call
         # line as string, later we can pass False to format_call and
         # syntax-highlight it ourselves for nicer formatting in the
         # calltip.
         if rep['content']['ismagic']:
             # Don't generate a call-tip for magics. Ideally, we should
             # generate a tooltip, but not on ( like we do for actual
             # callables.
             call_info, doc = None, None
         else:
             call_info, doc = call_tip(rep['content'], format_call=True)
         if call_info or doc:
             self._call_tip_widget.show_call_info(call_info, doc)
Exemple #6
0
 def _handle_object_info_reply(self, rep):
     """ Handle replies for call tips.
     """
     cursor = self._get_cursor()
     info = self._request_info.get('call_tip')
     if info and info.id == rep['parent_header']['msg_id'] and \
             info.pos == cursor.position():
         # Get the information for a call tip.  For now we format the call
         # line as string, later we can pass False to format_call and
         # syntax-highlight it ourselves for nicer formatting in the
         # calltip.
         if rep['content']['ismagic']:
             # Don't generate a call-tip for magics. Ideally, we should
             # generate a tooltip, but not on ( like we do for actual
             # callables.
             call_info, doc = None, None
         else:
             call_info, doc = call_tip(rep['content'], format_call=True)
         if call_info or doc:
             self._call_tip_widget.show_call_info(call_info, doc)
Exemple #7
0
 def _handle_object_info_reply(self, rep):
     """ Handle replies for call tips.
     """
     cursor = self._get_cursor()
     info = self._request_info.get("call_tip")
     if info and info.id == rep["parent_header"]["msg_id"] and info.pos == cursor.position():
         # Get the information for a call tip.  For now we format the call
         # line as string, later we can pass False to format_call and
         # syntax-highlight it ourselves for nicer formatting in the
         # calltip.
         content = rep["content"]
         # if this is from pykernel, 'docstring' will be the only key
         if content.get("ismagic", False):
             # Don't generate a call-tip for magics. Ideally, we should
             # generate a tooltip, but not on ( like we do for actual
             # callables.
             call_info, doc = None, None
         else:
             call_info, doc = call_tip(content, format_call=True)
         if call_info or doc:
             self._call_tip_widget.show_call_info(call_info, doc)
Exemple #8
0
 def _handle_object_info_reply(self, rep):
     """
     Reimplement call tips to only show signatures, using the same style
     from our Editor and External Console too.
     """
     self.log.debug("oinfo: %s", rep.get('content', ''))
     cursor = self._get_cursor()
     info = self._request_info.get('call_tip')
     if info and info.id == rep['parent_header']['msg_id'] and \
             info.pos == cursor.position():
         # Get the information for a call tip.  For now we format the call
         # line as string, later we can pass False to format_call and
         # syntax-highlight it ourselves for nicer formatting in the
         # calltip.
         content = rep['content']
         # if this is from pykernel, 'docstring' will be the only key
         if content.get('ismagic', False):
             # Don't generate a call-tip for magics. Ideally, we should
             # generate a tooltip, but not on ( like we do for actual
             # callables.
             call_info, doc = None, None
         else:
             call_info, doc = call_tip(content, format_call=True)
             if call_info is None and doc is not None:
                 name = content['name'].split('.')[-1]
                 argspec = getargspecfromtext(doc)
                 if argspec:
                     # This covers cases like np.abs, whose docstring is
                     # the same as np.absolute and because of that a proper
                     # signature can't be obtained correctly
                     call_info = name + argspec
                 else:
                     call_info = getsignaturefromtext(doc, name)
         if call_info:
             self._control.show_calltip(_("Arguments"),
                                        call_info,
                                        signature=True,
                                        color='#2D62FF')
Exemple #9
0
 def _handle_object_info_reply(self, rep):
     """ Handle replies for call tips.
     """
     self.log.debug("oinfo: %s", rep.get('content', ''))
     cursor = self._get_cursor()
     info = self._request_info.get('call_tip')
     if info and info.id == rep['parent_header']['msg_id'] and \
             info.pos == cursor.position():
         # Get the information for a call tip.  For now we format the call
         # line as string, later we can pass False to format_call and
         # syntax-highlight it ourselves for nicer formatting in the
         # calltip.
         content = rep['content']
         # if this is from pykernel, 'docstring' will be the only key
         if content.get('ismagic', False):
             # Don't generate a call-tip for magics. Ideally, we should
             # generate a tooltip, but not on ( like we do for actual
             # callables.
             call_info, doc = None, None
         else:
             call_info, doc = call_tip(content, format_call=True)
         if call_info or doc:
             self._call_tip_widget.show_call_info(call_info, doc)
Exemple #10
0
 def _handle_object_info_reply(self, rep):
     """
     Reimplement call tips to only show signatures, using the same style
     from our Editor and External Console too.
     """
     self.log.debug("oinfo: %s", rep.get('content', ''))
     cursor = self._get_cursor()
     info = self._request_info.get('call_tip')
     if info and info.id == rep['parent_header']['msg_id'] and \
             info.pos == cursor.position():
         # Get the information for a call tip.  For now we format the call
         # line as string, later we can pass False to format_call and
         # syntax-highlight it ourselves for nicer formatting in the
         # calltip.
         content = rep['content']
         # if this is from pykernel, 'docstring' will be the only key
         if content.get('ismagic', False):
             # Don't generate a call-tip for magics. Ideally, we should
             # generate a tooltip, but not on ( like we do for actual
             # callables.
             call_info, doc = None, None
         else:
             call_info, doc = call_tip(content, format_call=True)
             if call_info is None and doc is not None:
                 name = content['name'].split('.')[-1]
                 argspec = getargspecfromtext(doc)
                 if argspec:
                     # This covers cases like np.abs, whose docstring is
                     # the same as np.absolute and because of that a proper
                     # signature can't be obtained correctly
                     call_info = name + argspec
                 else:
                     call_info = getsignaturefromtext(doc, name)
         if call_info:
             self._control.show_calltip(_("Arguments"), call_info,
                                        signature=True, color='#2D62FF')