Source code for bokeh.models.annotations.dimensional
#-----------------------------------------------------------------------------# Copyright (c) 2012 - 2023, Anaconda, Inc., and Bokeh Contributors.# All rights reserved.## The full license is in the file LICENSE.txt, distributed with this software.#-----------------------------------------------------------------------------''''''#-----------------------------------------------------------------------------# Boilerplate#-----------------------------------------------------------------------------from__future__importannotationsimportlogging# isort:skiplog=logging.getLogger(__name__)#-----------------------------------------------------------------------------# Imports#-----------------------------------------------------------------------------# Standard library importsfromtypingimportAny# Bokeh importsfrom...core.has_propsimportabstractfrom...core.propertiesimport(Float,List,Nullable,Override,String,)from...modelimportModel#-----------------------------------------------------------------------------# Globals and constants#-----------------------------------------------------------------------------__all__=("MetricLength",)#-----------------------------------------------------------------------------# General API#-----------------------------------------------------------------------------@abstractclassDimensional(Model):""" A base class for models defining units of measurement. """# explicit __init__ to support Init signaturesdef__init__(self,*args:Any,**kwargs:Any)->None:super().__init__(*args,**kwargs)ticks=List(Float,help=""" Preferred values to choose from in non-exact mode. """)include=Nullable(List(String),default=None,help=""" An optional subset of preferred units from the basis. """)exclude=List(String,default=[],help=""" A subset of units from the basis to avoid. """)@abstractclassMetric(Dimensional):""" A base class defining metric units of measurement. """# explicit __init__ to support Init signaturesdef__init__(self,*args:Any,**kwargs:Any)->None:super().__init__(*args,**kwargs)ticks=Override(default=[1,2,5,10,15,20,25,50,75,100,125,150,200,250,500,750])
[docs]classMetricLength(Metric):""" Units of metric length. """# explicit __init__ to support Init signaturesdef__init__(self,*args:Any,**kwargs:Any)->None:super().__init__(*args,**kwargs)exclude=Override(default=["dm","hm"])
#-----------------------------------------------------------------------------# Dev API#-----------------------------------------------------------------------------#-----------------------------------------------------------------------------# Private API#-----------------------------------------------------------------------------#-----------------------------------------------------------------------------# Code#-----------------------------------------------------------------------------