code: def collect_defaults() -> dict[str, Any]:
      serializer = DefaultsSerializer()
      defaults: dict[str, Any] = {}
  
      # In order to look up from the model catalog that Model maintains, it
      # has to be created first. These imports ensure that all built-in Bokeh
      # models are represented in the catalog.
      import bokeh.models
      import bokeh.plotting  # noqa: F401
  
      models = sorted(
          Model.model_class_reverse_map.values(),
          key=lambda model: f"{model.__module__}.{model.__name__}",
      )
  
      for model in models:
          with warnings.catch_warnings():
              warnings.filterwarnings(
                  "ignore", category=BokehDeprecationWarning
              )
              obj = model()
  
          # filter only own properties and overrides
          def query(prop: PropertyDescriptor[Any]) -> bool:
              return (prop.readonly or prop.serialized) and (
                  prop.name in obj.__class__.__properties__
                  or prop.name in obj.__class__.__overridden_defaults__
              )
  
          properties = obj.query_properties_with_values(
              query, include_defaults=True, include_undefined=True
          )
          attributes = {
              key: serializer.encode(val)
              for key, val in properties.items()
          }
  
          bases = [
              base.__qualified_model__
              for base in model.__bases__
              if issubclass(base, HasProps) and base != HasProps
          ]
          if bases != []:
              attributes = dict(
                  __extends__=bases[0] if len(bases) == 1 else bases,
                  **attributes,
              )
  
          name = model.__qualified_model__
          defaults[name] = attributes
  
      return defaults
  
file_path: bokeh/tests/support/defaults.py
imports: from __future__ import annotations
  import logging
  import os
  import warnings
  from pathlib import Path
  from typing import Any
  import json5
  from bokeh.core.has_props import HasProps
  from bokeh.core.property.descriptors import PropertyDescriptor
  from bokeh.core.property.singletons import Undefined
  from bokeh.core.serialization import AnyRep, ObjectRep, Serializer, SymbolRep
  from bokeh.model import Model
  from bokeh.util.warnings import BokehDeprecationWarning
label_desc: Use image node_id 1 for calling a global function with example usage: collect_defaults() and returns: defaults, unknown