#-----------------------------------------------------------------------------# Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors.# All rights reserved.## The full license is in the file LICENSE.txt, distributed with this software.#-----------------------------------------------------------------------------""" Provide wildcard properties.The Any and AnyRef properties can be used to hold values without performingany validation."""#-----------------------------------------------------------------------------# Boilerplate#-----------------------------------------------------------------------------from__future__importannotationsimportlogging# isort:skiplog=logging.getLogger(__name__)#-----------------------------------------------------------------------------# Imports#-----------------------------------------------------------------------------# Standard library importsimporttyping# Bokeh importsfrom.basesimportInit,Property#-----------------------------------------------------------------------------# Globals and constants#-----------------------------------------------------------------------------__all__=("Any","AnyRef")#-----------------------------------------------------------------------------# General API#-----------------------------------------------------------------------------
[docs]classAny(Property[typing.Any]):""" Accept all values. The ``Any`` property does not do any validation or transformation. Args: default (obj or None, optional) : A default value for attributes created from this property to have (default: None) help (str or None, optional) : A documentation string for this property. It will be automatically used by the :ref:`bokeh.sphinxext.bokeh_prop` extension when generating Spinx documentation. (default: None) Example: .. code-block:: python >>> class AnyModel(HasProps): ... prop = Any() ... >>> m = AnyModel() >>> m.prop = True >>> m.prop = 10 >>> m.prop = 3.14 >>> m.prop = "foo" >>> m.prop = [1, 2, 3] """# TODO: default should be explicitly defined by the user (i.e. intrinsic here)def__init__(self,default:Init[typing.Any]=None,help:str|None=None)->None:super().__init__(default=default,help=help)
[docs]classAnyRef(Any):""" Accept all values and force reference discovery. """@propertydefhas_ref(self)->bool:returnTrue
#-----------------------------------------------------------------------------# Dev API#-----------------------------------------------------------------------------#-----------------------------------------------------------------------------# Private API#-----------------------------------------------------------------------------#-----------------------------------------------------------------------------# Code#-----------------------------------------------------------------------------