class_docstr: Allows to check if an attribute of an object satisfies the
  given type or a collection of types.
class_docstr_tok: ["Allows","to","check","if","an","attribute","of","an","object","satisfies","the","given","type","or","a","collection","of","types","."]
code: def validate(self, value: Any, detail: bool = True) -> None:
      super().validate(value, detail)
  
      name = self._query_name
      type = self._query_type
  
      try:
          attr = getattr(value, name)
      except AttributeError:
          raise ValueError(
              f"expected {value!r} to have an attribute '{name}'"
              if detail
              else ""
          )
  
      if type.is_valid(attr):
          return
  
      raise ValueError(
          f"expected {value!r} to have an attribute {name!r} of type {type}"
          if detail
          else ""
      )
  
file_path: bokeh/src/bokeh/core/property/constraints.py
imports: from __future__ import annotations
  import logging
  from typing import Any, TypeVar
  from ._sphinx import property_link, register_type_link, type_link
  from .bases import Init, Property, SingleParameterizedProperty, TypeOrInst
  from .singletons import Intrinsic
label_desc: Use image node_id 4 for calling the TypeOfAttr obj's underlying member method code with example usage: obj.validate(value, detail) without return types