code: def _on_input_timeout(self, buff):
          
          assert isinstance(buff, Buffer)
          app = self.app
  
          # Never run multiple get-signature threads.
          if self._get_signatures_thread_running:
              return
          self._get_signatures_thread_running = True
  
          document = buff.document
  
          def run():
              script = get_jedi_script_from_document(document, self.get_locals(), self.get_globals())
  
              # Show signatures in help text.
              if script:
                  try:
                      signatures = script.call_signatures()
                  except ValueError:
                      # e.g. in case of an invalid \\x escape.
                      signatures = []
                  except Exception:
                      # Sometimes we still get an exception (TypeError), because
                      # of probably bugs in jedi. We can silence them.
                      # See: https://github.com/davidhalter/jedi/issues/492
                      signatures = []
                  else:
                      # Try to access the params attribute just once. For Jedi
                      # signatures containing the keyword-only argument star,
                      # this will crash when retrieving it the first time with
                      # AttributeError. Every following time it works.
                      # See: https://github.com/jonathanslenders/ptpython/issues/47
                      #      https://github.com/davidhalter/jedi/issues/598
                      try:
                          if signatures:
                              signatures[0].params
                      except AttributeError:
                          pass
              else:
                  signatures = []
  
              self._get_signatures_thread_running = False
  
              # Set signatures and redraw if the text didn't change in the
              # meantime. Otherwise request new signatures.
              if buff.text == document.text:
                  self.signatures = signatures
  
                  # Set docstring in docstring buffer.
                  if signatures:
                      string = signatures[0].docstring()
                      if not isinstance(string, six.text_type):
                          string = string.decode('utf-8')
                      self.docstring_buffer.reset(
                          document=Document(string, cursor_position=0))
                  else:
                      self.docstring_buffer.reset()
  
                  app.invalidate()
              else:
                  self._on_input_timeout(buff)
  
          get_event_loop().run_in_executor(run)
docs: When there is no input activity,
          in another thread, get the signature of the current code.