

def _on_input_timeout(self, cli):
    '\n        When there is no input activity,\n        in another thread, get the signature of the current code.\n        '
    if (buffer.current_buffer_name != DEFAULT_BUFFER):
        return
    if self._get_signatures_thread_running:
        return
    self._get_signatures_thread_running = True
    buffer = cli.current_buffer
    document = buffer.document

    def run():
        script = get_jedi_script_from_document(document, self.get_locals(), self.get_globals())
        if script:
            try:
                signatures = script.call_signatures()
            except ValueError:
                signatures = []
            except Exception:
                signatures = []
            else:
                try:
                    if signatures:
                        signatures[0].params
                except AttributeError:
                    pass
        else:
            signatures = []
        self._get_signatures_thread_running = False
        if (buffer.text == document.text):
            self.signatures = signatures
            if signatures:
                string = signatures[0].docstring()
                if (not isinstance(string, six.text_type)):
                    string = string.decode('utf-8')
                cli.buffers['docstring'].reset(initial_document=Document(string, cursor_position=0))
            else:
                cli.buffers['docstring'].reset()
            cli.request_redraw()
        else:
            self._on_input_timeout(cli)
    cli.eventloop.run_in_executor(run)

dataset/ETHPy150Open jonathanslenders/ptpython/ptpython/python_input.py PythonInput._on_input_timeout/VarMisuse@16/60 `cli`->`buffer`