class_docstr: Abstract base class for an input validator.
  
  A validator is typically created in one of the following two ways:
  
  - Either by overriding this class and implementing the `validate` method.
  - Or by passing a callable to `Validator.from_callable`.
  
  If the validation takes some time and needs to happen in a background
  thread, this can be wrapped in a :class:`.ThreadedValidator`.
class_docstr_tok: ["Abstract","base","class","for","an","input","validator",".","A","validator","is","typically","created","in","one","of","the","following","two","ways",":","-","Either","by","overriding","this","class","and","implementing","the","`","validate","`","method",".","-","Or","by","passing","a","callable","to","`","Validator.from_callable","`",".","If","the","validation","takes","some","time","and","needs","to","happen","in","a","background","thread",",","this","can","be","wrapped","in","a",":","class",":","`",".ThreadedValidator","`","."]
docstr: Validate the input.
  If invalid, this should raise a :class:`.ValidationError`.
  
  :param document: :class:`~prompt_toolkit.document.Document` instance.
docstr_tok: ["Validate","the","input",".","If","invalid",",","this","should","raise","a",":","class",":","`",".ValidationError","`",".",":","param","document",":",":","class",":","`","~prompt_toolkit.document.Document","`","instance","."]
code: def validate(self, document: Document) -> None:
      """
      Validate the input.
      If invalid, this should raise a :class:`.ValidationError`.
  
      :param document: :class:`~prompt_toolkit.document.Document` instance.
      """
      pass
  
imports: from __future__ import annotations
  from abc import ABCMeta, abstractmethod
  from typing import Callable
  from prompt_toolkit.eventloop import run_in_executor_with_context
  from .document import Document
  from .filters import FilterOrBool, to_filter
label_desc: Use image node_id 1 for calling the Validator obj's underlying member method code with example usage: obj.validate(document) without return types