<s> """<STR_LIT>""" <EOL> from __future__ import absolute_import <EOL> import logging <EOL> logger = logging . getLogger ( __name__ ) <EOL> from . . model import Model <EOL> from . . core . enums import RenderLevel <EOL> from . . core . properties import abstract <EOL> from . . core . properties import String , Enum , Instance , Float , Bool , Override <EOL> from . . core import validation <EOL> from . . core . validation . errors import BAD_COLUMN_NAME , MISSING_GLYPH , NO_SOURCE_FOR_GLYPH <EOL> from . glyphs import Glyph <EOL> from . images import ImageSource <EOL> from . sources import DataSource , RemoteSource <EOL> from . tiles import TileSource , WMTSTileSource <EOL> @ abstract <EOL> class Renderer ( Model ) : <EOL> """<STR_LIT>""" <EOL> level = Enum ( RenderLevel , help = """<STR_LIT>""" ) <EOL> @ abstract <EOL> class DataRenderer ( Renderer ) : <EOL> """<STR_LIT>""" <EOL> class TileRenderer ( DataRenderer ) : <EOL> tile_source = Instance ( TileSource , default = lambda : WMTSTileSource ( ) , help = """<STR_LIT>""" ) <EOL> alpha = Float ( <NUM_LIT:1.0> , help = """<STR_LIT>""" ) <EOL> x_range_name = String ( '<STR_LIT:default>' , help = """<STR_LIT>""" ) <EOL> y_range_name = String ( '<STR_LIT:default>' , help = """<STR_LIT>""" ) <EOL> level = Override ( default = "<STR_LIT>" ) <EOL> render_parents = Bool ( default = True , help = """<STR_LIT>""" ) <EOL> class DynamicImageRenderer ( DataRenderer ) : <EOL> image_source = Instance ( ImageSource , help = """<STR_LIT>""" ) <EOL> alpha = Float ( <NUM_LIT:1.0> , help = """<STR_LIT>""" ) <EOL> level = Override ( default = "<STR_LIT>" ) <EOL> render_parents = Bool ( default = True , help = """<STR_LIT>""" ) <EOL> class GlyphRenderer ( DataRenderer ) : <EOL> """<STR_LIT:U+0020>""" <EOL> @ validation . error ( MISSING_GLYPH ) <EOL> def _check_missing_glyph ( self ) : <EOL> if not self . glyph : return str ( self ) <EOL> @ validation . error ( NO_SOURCE_FOR_GLYPH ) <EOL> def _check_no_source_for_glyph ( self ) : <EOL> if not self . data_source : return str ( self ) <EOL> @ validation . error ( BAD_COLUMN_NAME ) <EOL> def _check_bad_column_name ( self ) : <EOL> if not self . glyph : return <EOL> if not self . data_source : return <EOL> if isinstance ( self . data_source , RemoteSource ) : return <EOL> missing = set ( ) <EOL> specs = self . glyph . dataspecs ( ) <EOL> for name , item in self . glyph . properties_with_values ( include_defaults = False ) . items ( ) : <EOL> if name not in specs : continue <EOL> if not isinstance ( item , dict ) : continue <EOL> if '<STR_LIT>' in item and item [ '<STR_LIT>' ] not in self . data_source . column_names : <EOL> missing . add ( item [ '<STR_LIT>' ] ) <EOL> if missing : <EOL> return "<STR_LIT>" % ( "<STR_LIT:U+002CU+0020>" . join ( sorted ( missing ) ) , self ) <EOL> data_source = Instance ( DataSource , help = """<STR_LIT>""" ) <EOL> x_range_name = String ( '<STR_LIT:default>' , help = """<STR_LIT>""" ) <EOL> y_range_name = String ( '<STR_LIT:default>' , help = """<STR_LIT>""" ) <EOL> glyph = Instance ( Glyph , help = """<STR_LIT>""" ) <EOL> selection_glyph = Instance ( Glyph , help = """<STR_LIT>""" ) <EOL> nonselection_glyph = Instance ( Glyph , help = """<STR_LIT>""" ) <EOL> hover_glyph = Instance ( Glyph , help = """<STR_LIT>""" ) <EOL> level = Override ( default = "<STR_LIT>" ) <EOL> @ abstract <EOL> class GuideRenderer ( Renderer ) : <EOL> """<STR_LIT>""" <EOL> plot = Instance ( "<STR_LIT>" , help = """<STR_LIT>""" ) <EOL> def __init__ ( self , ** kwargs ) : <EOL> super ( GuideRenderer , self ) . __init__ ( ** kwargs ) <EOL> if self . plot is not None : <EOL> if self not in self . plot . renderers : <EOL> self . plot . renderers . append ( self ) <EOL> level = Override ( default = "<STR_LIT>" ) </s>
