original_docstring: Filter displayed hints according to a text.
  
          Args:
              filterstr: The string to filter with, or None to use the filter
                         from previous call (saved in `self._context.filterstr`).
                         If `filterstr` is an empty string or if both `filterstr`
                         and `self._context.filterstr` are None, all hints are
                         shown.
          
docstring: Filter displayed hints according to a text.
docstring_tokens: Filter displayed hints according to a text .
code: def filter_hints(self, filterstr: Optional[str]) -> None:
          """Filter displayed hints according to a text.
  
          Args:
              filterstr: The string to filter with, or None to use the filter
                         from previous call (saved in `self._context.filterstr`).
                         If `filterstr` is an empty string or if both `filterstr`
                         and `self._context.filterstr` are None, all hints are
                         shown.
          """
          assert self._context is not None
  
          if filterstr is None:
              filterstr = self._context.filterstr
          else:
              self._context.filterstr = filterstr
  
          log.hints.debug("Filtering hints on {!r}".format(filterstr))
  
          visible = []
          for label in self._context.all_labels:
              try:
                  if self._filter_matches(filterstr, str(label.elem)):
                      visible.append(label)
                      # Show label again if it was hidden before
                      label.show()
                  else:
                      # element doesn't match anymore -> hide it
                      label.hide()
              except webelem.Error:
                  pass
  
          if not visible:
              # Whoops, filtered all hints
              modeman.leave(self._win_id, usertypes.KeyMode.hint,
                            'all filtered')
              return
  
          if self._context.hint_mode == 'number':
              # renumber filtered hints
              strings = self._hint_strings([label.elem for label in visible])
              self._context.labels = {}
              for label, string in zip(visible, strings):
                  label.update_text('', string)
                  self._context.labels[string] = label
  
              keyparser = self._get_keyparser(usertypes.KeyMode.hint)
              keyparser.update_bindings(strings, preserve_filter=True)
  
              # Note: filter_hints can be called with non-None filterstr only
              # when number mode is active
              if filterstr is not None:
                  # pass self._context.labels as the dict of visible hints
                  self._handle_auto_follow(filterstr=filterstr,
                                           visible=self._context.labels)
code_tokens: def filter_hints ( self , filterstr : Optional [ str ] ) -> None : assert self . _context is not None if filterstr is None : filterstr = self . _context . filterstr else : self . _context . filterstr = filterstr log . hints . debug ( "Filtering hints on {!r}" . format ( filterstr ) ) visible = [ ] for label in self . _context . all_labels : try : if self . _filter_matches ( filterstr , str ( label . elem ) ) : visible . append ( label ) label . show ( ) else : label . hide ( ) except webelem . Error : pass if not visible : modeman . leave ( self . _win_id , usertypes . KeyMode . hint , 'all filtered' ) return if self . _context . hint_mode == 'number' : strings = self . _hint_strings ( [ label . elem for label in visible ] ) self . _context . labels = { } for label , string in zip ( visible , strings ) : label . update_text ( '' , string ) self . _context . labels [ string ] = label keyparser = self . _get_keyparser ( usertypes . KeyMode . hint ) keyparser . update_bindings ( strings , preserve_filter = True ) if filterstr is not None : self . _handle_auto_follow ( filterstr = filterstr , visible = self . _context . labels )
short_docstring: Filter displayed hints according to a text.
short_docstring_tokens: Filter displayed hints according to a text .
comment: """Filter displayed hints according to a text.
  
          Args:
              filterstr: The string to filter with, or None to use the filter
                         from previous call (saved in `self._context.filterstr`).
                         If `filterstr` is an empty string or if both `filterstr`
                         and `self._context.filterstr` are None, all hints are
                         shown.
          """$SEP$# Show label again if it was hidden before$SEP$# element doesn't match anymore -> hide it$SEP$# Whoops, filtered all hints$SEP$# renumber filtered hints$SEP$# Note: filter_hints can be called with non-None filterstr only$SEP$# when number mode is active$SEP$# pass self._context.labels as the dict of visible hints