class_docstr: Control that displays a list of (Token, text) tuples.
  (It's mostly optimized for rather small widgets, like toolbars, menus, etc...)
  
  Mouse support:
  
      The list of tokens can also contain tuples of three items, looking like:
      (Token, text, handler). When mouse support is enabled and the user
      clicks on this token, then the given handler is called. That handler
      should accept two inputs: (CommandLineInterface, MouseEvent) and it
      should either handle the event or return `NotImplemented` in case we
      want the containing Window to handle this event.
  
  :param get_tokens: Callable that takes a `CommandLineInterface` instance
      and returns the list of (Token, text) tuples to be displayed right now.
  :param default_char: default :class:`.Char` (character and Token) to use
      for the background when there is more space available than `get_tokens`
      returns.
  :param get_default_char: Like `default_char`, but this is a callable that
      takes a :class:`prompt_toolkit.interface.CommandLineInterface` and
      returns a :class:`.Char` instance.
  :param has_focus: `bool` or `CLIFilter`, when this evaluates to `True`,
      this UI control will take the focus. The cursor will be shown in the
      upper left corner of this control, unless `get_token` returns a
      ``Token.SetCursorPosition`` token somewhere in the token list, then the
      cursor will be shown there.
class_docstr_tok: ["Control","that","displays","a","list","of","(","Token",",","text",")","tuples",".","(","It","'s","mostly","optimized","for","rather","small","widgets",",","like","toolbars",",","menus",",","etc","...",")","Mouse","support",":","The","list","of","tokens","can","also","contain","tuples","of","three","items",",","looking","like",":","(","Token",",","text",",","handler",")",".","When","mouse","support","is","enabled","and","the","user","clicks","on","this","token",",","then","the","given","handler","is","called",".","That","handler","should","accept","two","inputs",":","(","CommandLineInterface",",","MouseEvent",")","and","it","should","either","handle","the","event","or","return","`","NotImplemented","`","in","case","we","want","the","containing","Window","to","handle","this","event",".",":","param","get_tokens",":","Callable","that","takes","a","`","CommandLineInterface","`","instance","and","returns","the","list","of","(","Token",",","text",")","tuples","to","be","displayed","right","now",".",":","param","default_char",":","default",":","class",":","`",".Char","`","(","character","and","Token",")","to","use","for","the","background","when","there","is","more","space","available","than","`","get_tokens","`","returns",".",":","param","get_default_char",":","Like","`","default_char","`",",","but","this","is","a","callable","that","takes","a",":","class",":","`","prompt_toolkit.interface.CommandLineInterface","`","and","returns","a",":","class",":","`",".Char","`","instance",".",":","param","has_focus",":","`","bool","`","or","`","CLIFilter","`",",","when","this","evaluates","to","`","True","`",",","this","UI","control","will","take","the","focus",".","The","cursor","will","be","shown","in","the","upper","left","corner","of","this","control",",","unless","`","get_token","`","returns","a","``","Token.SetCursorPosition","``","token","somewhere","in","the","token","list",",","then","the","cursor","will","be","shown","there","."]
docstr: Get tokens, but only retrieve tokens once during one render run.
  (This function is called several times during one rendering, because
  we also need those for calculating the dimensions.)
docstr_tok: ["Get","tokens",",","but","only","retrieve","tokens","once","during","one","render","run",".","(","This","function","is","called","several","times","during","one","rendering",",","because","we","also","need","those","for","calculating","the","dimensions",".",")"]
code: def _get_tokens_cached(self, cli):
      """
      Get tokens, but only retrieve tokens once during one render run.
      (This function is called several times during one rendering, because
      we also need those for calculating the dimensions.)
      """
      return self._token_cache.get(
          cli.render_counter, lambda: self.get_tokens(cli)
      )
  
imports: from __future__ import unicode_literals
  from abc import ABCMeta, abstractmethod
  from collections import namedtuple
  from six import with_metaclass
  from six.moves import range
  from prompt_toolkit.cache import SimpleCache
  from prompt_toolkit.enums import DEFAULT_BUFFER, SEARCH_BUFFER
  from prompt_toolkit.filters import to_cli_filter
  from prompt_toolkit.mouse_events import MouseEventType
  from prompt_toolkit.search_state import SearchState
  from prompt_toolkit.selection import SelectionType
  from prompt_toolkit.token import Token
  from prompt_toolkit.utils import get_cwidth
  from .lexers import Lexer, SimpleLexer
  from .processors import Processor
  from .screen import Char, Point
  from .utils import token_list_width, split_lines, token_list_to_text
  import six
  import time
label_desc: Use image node_id 4 for calling the TokenListControl obj's underlying member method code with example usage: obj._get_tokens_cached(cli) and returns: self