Code
stringlengths
103
85.9k
Summary
listlengths
0
94
Please provide a description of the function:def convert_timedelta_type(obj): ''' Convert any recognized timedelta value to floating point absolute milliseconds. Arg: obj (object) : the object to convert Returns: float : milliseconds ''' if isinstance(obj, dt.timedelta): ...
[]
Please provide a description of the function:def convert_datetime_type(obj): ''' Convert any recognized date, time, or datetime value to floating point milliseconds since epoch. Arg: obj (object) : the object to convert Returns: float : milliseconds ''' # Pandas NaT if pd ...
[]
Please provide a description of the function:def convert_datetime_array(array): ''' Convert NumPy datetime arrays to arrays to milliseconds since epoch. Args: array : (obj) A NumPy array of datetime to convert If the value passed in is not a NumPy array, it will be returned as-...
[]
Please provide a description of the function:def make_id(): ''' Return a new unique ID for a Bokeh object. Normally this function will return simple monotonically increasing integer IDs (as strings) for identifying Bokeh objects within a Document. However, if it is desirable to have globally unique for...
[]
Please provide a description of the function:def transform_array_to_list(array): ''' Transforms a NumPy array into a list of values Args: array (np.nadarray) : the NumPy array series to transform Returns: list or dict ''' if (array.dtype.kind in ('u', 'i', 'f') and (~np.isfinite(a...
[]
Please provide a description of the function:def transform_series(series, force_list=False, buffers=None): ''' Transforms a Pandas series into serialized form Args: series (pd.Series) : the Pandas series to transform force_list (bool, optional) : whether to only output to standard lists ...
[]
Please provide a description of the function:def serialize_array(array, force_list=False, buffers=None): ''' Transforms a NumPy array into serialized form. Args: array (np.ndarray) : the NumPy array to transform force_list (bool, optional) : whether to only output to standard lists ...
[]
Please provide a description of the function:def traverse_data(obj, use_numpy=True, buffers=None): ''' Recursively traverse an object until a flat list is found. If NumPy is available, the flat list is converted to a numpy array and passed to transform_array() to handle ``nan``, ``inf``, and ``-inf``. ...
[]
Please provide a description of the function:def transform_column_source_data(data, buffers=None, cols=None): ''' Transform ``ColumnSourceData`` data to a serialized format Args: data (dict) : the mapping of names to data columns to transform buffers (set, optional) : If binary buf...
[]
Please provide a description of the function:def encode_binary_dict(array, buffers): ''' Send a numpy array as an unencoded binary buffer The encoded format is a dict with the following structure: .. code:: python { '__buffer__' : << an ID to locate the buffer >>, 'shape'...
[]
Please provide a description of the function:def decode_base64_dict(data): ''' Decode a base64 encoded array into a NumPy array. Args: data (dict) : encoded array data to decode Data should have the format encoded by :func:`encode_base64_dict`. Returns: np.ndarray ''' b64 = b...
[]
Please provide a description of the function:def from_py_func(cls, code): ''' Create a ``CustomJSHover`` instance from a Python functions. The function is translated to JavaScript using PScript. The python functions must have no positional arguments. It is possible to pass Bokeh models ...
[]
Please provide a description of the function:def from_coffeescript(cls, code, args={}): ''' Create a CustomJSHover instance from a CoffeeScript snippet. The function bodies are translated to JavaScript functions using node and therefore require return statements. The ``code`` snippet na...
[]
Please provide a description of the function:def setup(app): ''' Required Sphinx extension setup function. ''' app.add_node( bokehjs_content, html=( html_visit_bokehjs_content, html_depart_bokehjs_content ) ) app.add_directive('bokehjs-content', BokehJSCon...
[]
Please provide a description of the function:def get_codeblock_node(self, code, language): # type: () -> List[nodes.Node] document = self.state.document location = self.state_machine.get_source_and_line(self.lineno) linespec = self.options.get('emphasize-lines') if lin...
[ "this is copied from sphinx.directives.code.CodeBlock.run\n\n it has been changed to accept code and language as an arguments instead\n of reading from self\n\n " ]
Please provide a description of the function:def get_code_language(self): js_source = self.get_js_source() if self.options.get("include_html", False): resources = get_sphinx_resources(include_bokehjs_api=True) html_source = BJS_HTML.render( css_files=reso...
[ "\n This is largely copied from bokeh.sphinxext.bokeh_plot.run\n " ]
Please provide a description of the function:def autoload_static(model, resources, script_path): ''' Return JavaScript code and a script tag that can be used to embed Bokeh Plots. The data for the plot is stored directly in the returned JavaScript code. Args: model (Model or Document) : ...
[]
Please provide a description of the function:def components(models, wrap_script=True, wrap_plot_info=True, theme=FromCurdoc): ''' Return HTML components to embed a Bokeh plot. The data for the plot is stored directly in the returned HTML. An example can be found in examples/embed/embed_multiple.py The...
[]
Please provide a description of the function:def file_html(models, resources, title=None, template=FILE, template_variables={}, theme=FromCurdoc, suppress_callback_warning=False, _always_new=False): ''' Return an HTML ...
[]
Please provide a description of the function:def json_item(model, target=None, theme=FromCurdoc): ''' Return a JSON block that can be used to embed standalone Bokeh content. Args: model (Model) : The Bokeh object to embed target (string, optional) A div id to embed the ...
[]
Please provide a description of the function:def process_document_events(events, use_buffers=True): ''' Create a JSON string describing a patch to be applied as well as any optional buffers. Args: events : list of events to be translated into patches Returns: str, list : JSON strin...
[]
Please provide a description of the function:def _copy_with_changed_callback(self, new_callback): ''' Dev API used to wrap the callback with decorators. ''' return PeriodicCallback(self._document, new_callback, self._period, self._id)
[]
Please provide a description of the function:def _copy_with_changed_callback(self, new_callback): ''' Dev API used to wrap the callback with decorators. ''' return TimeoutCallback(self._document, new_callback, self._timeout, self._id)
[]
Please provide a description of the function:def calc_cache_key(custom_models): ''' Generate a key to cache a custom extension implementation with. There is no metadata other than the Model classes, so this is the only base to generate a cache key. We build the model keys from the list of ``model.full...
[]
Please provide a description of the function:def bundle_models(models): custom_models = _get_custom_models(models) if custom_models is None: return None key = calc_cache_key(custom_models) bundle = _bundle_cache.get(key, None) if bundle is None: try: _bundle_cache[k...
[ "Create a bundle of selected `models`. " ]
Please provide a description of the function:def _get_custom_models(models): if models is None: models = Model.model_class_reverse_map.values() custom_models = OrderedDict() for cls in models: impl = getattr(cls, "__implementation__", None) if impl is not None: mod...
[ "Returns CustomModels for models with a custom `__implementation__`" ]
Please provide a description of the function:def _compile_models(custom_models): ordered_models = sorted(custom_models.values(), key=lambda model: model.full_name) custom_impls = {} dependencies = [] for model in ordered_models: dependencies.extend(list(model.dependencies.items())) if...
[ "Returns the compiled implementation of supplied `models`. " ]
Please provide a description of the function:def _bundle_models(custom_models): exports = [] modules = [] def read_json(name): with io.open(join(bokehjs_dir, "js", name + ".json"), encoding="utf-8") as f: return json.loads(f.read()) bundles = ["bokeh", "bokeh-api", "bokeh-widg...
[ " Create a JavaScript bundle with selected `models`. ", "require(\"%s\")", "require(\"%s\")", "require('%s')", "require('%s')" ]
Please provide a description of the function:def die(message, status=1): ''' Print an error message and exit. This function will call ``sys.exit`` with the given ``status`` and the process will terminate. Args: message (str) : error message to print status (int) : the exit status to p...
[]
Please provide a description of the function:def build_single_handler_application(path, argv=None): ''' Return a Bokeh application built using a single handler for a script, notebook, or directory. In general a Bokeh :class:`~bokeh.application.application.Application` may have any number of handlers to...
[]
Please provide a description of the function:def build_single_handler_applications(paths, argvs=None): ''' Return a dictionary mapping routes to Bokeh applications built using single handlers, for specified files or directories. This function iterates over ``paths`` and ``argvs`` and calls :func:`~boke...
[]
Please provide a description of the function:def report_server_init_errors(address=None, port=None, **kwargs): ''' A context manager to help print more informative error messages when a ``Server`` cannot be started due to a network problem. Args: address (str) : network address that the server will...
[]
Please provide a description of the function:def distance(p1, p2): R = 6371 lat1, lon1 = p1 lat2, lon2 = p2 phi1 = radians(lat1) phi2 = radians(lat2) delta_lat = radians(lat2 - lat1) delta_lon = radians(lon2 - lon1) a = haversin(delta_lat) + cos(phi1) * cos(phi2) * haversin(delta...
[ "Distance between (lat1, lon1) and (lat2, lon2). " ]
Please provide a description of the function:def setup(app): ''' Required Sphinx extension setup function. ''' # These two are deprecated and no longer have any effect, to be removed 2.0 app.add_config_value('bokeh_plot_pyfile_include_dirs', [], 'html') app.add_config_value('bokeh_plot_use_relative_pat...
[]
Please provide a description of the function:def bind_sockets(address, port): ''' Bind a socket to a port on an address. Args: address (str) : An address to bind a port on, e.g. ``"localhost"`` port (int) : A port number to bind. Pass 0 to have the OS autom...
[]
Please provide a description of the function:def check_whitelist(host, whitelist): ''' Check a given request host against a whitelist. Args: host (str) : A host string to compare against a whitelist. If the host does not specify a port, then ``":80"`` is implicitly ...
[]
Please provide a description of the function:def match_host(host, pattern): ''' Match a host string against a pattern Args: host (str) A hostname to compare to the given pattern pattern (str) A string representing a hostname pattern, possibly including wildc...
[]
Please provide a description of the function:def notebook_type(self, notebook_type): ''' Notebook type, acceptable values are 'jupyter' as well as any names defined by external notebook hooks that have been installed. ''' if notebook_type is None or not isinstance(notebook_type, string_...
[]
Please provide a description of the function:def output_file(self, filename, title="Bokeh Plot", mode="cdn", root_dir=None): ''' Configure output to a standalone HTML file. Calling ``output_file`` not clear the effects of any other calls to ``output_notebook``, etc. It adds an additional output...
[]
Please provide a description of the function:def save(obj, filename=None, resources=None, title=None, template=None, state=None, **kwargs): ''' Save an HTML file with the data for the current document. Will fall back to the default output state (or an explicitly provided :class:`State` object) for ``filena...
[]
Please provide a description of the function:def html_page_context(app, pagename, templatename, context, doctree): ''' Collect page names for the sitemap as HTML pages are built. ''' site = context['SITEMAP_BASE_URL'] version = context['version'] app.sitemap_links.add(site + version + '/' + pagenam...
[]
Please provide a description of the function:def build_finished(app, exception): ''' Generate a ``sitemap.txt`` from the collected HTML page links. ''' filename = join(app.outdir, "sitemap.txt") links_iter = status_iterator(sorted(app.sitemap_links), 'adding links to s...
[]
Please provide a description of the function:def setup(app): ''' Required Sphinx extension setup function. ''' app.connect('html-page-context', html_page_context) app.connect('build-finished', build_finished) app.sitemap_links = set()
[]
Please provide a description of the function:def initialize(self, io_loop): ''' Start a Bokeh Server Tornado Application on a given Tornado IOLoop. ''' self._loop = io_loop for app_context in self._applications.values(): app_context._loop = self._loop self._clients...
[]
Please provide a description of the function:def resources(self, absolute_url=None): ''' Provide a :class:`~bokeh.resources.Resources` that specifies where Bokeh application sessions should load BokehJS resources from. Args: absolute_url (bool): An absolute URL prefi...
[]
Please provide a description of the function:def start(self): ''' Start the Bokeh Server application. Starting the Bokeh Server Tornado application will run periodic callbacks for stats logging, cleanup, pinging, etc. Additionally, any startup hooks defined by the configured Bokeh appli...
[]
Please provide a description of the function:def stop(self, wait=True): ''' Stop the Bokeh Server application. Args: wait (bool): whether to wait for orderly cleanup (default: True) Returns: None ''' # TODO should probably close all connections and shu...
[]
Please provide a description of the function:def get_session(self, app_path, session_id): ''' Get an active a session by name application path and session ID. Args: app_path (str) : The configured application path for the application to return a session for. ...
[]
Please provide a description of the function:def get_sessions(self, app_path): ''' Gets all currently active sessions for an application. Args: app_path (str) : The configured application path for the application to return sessions for. Returns: ...
[]
Please provide a description of the function:def _validator(code_or_name, validator_type): ''' Internal shared implementation to handle both error and warning validation checks. Args: code code_or_name (int or str) : a defined error code or custom message validator_type (str) : either "erro...
[]
Please provide a description of the function:def find(objs, selector, context=None): ''' Query a collection of Bokeh models and yield any that match the a selector. Args: obj (Model) : object to test selector (JSON-like) : query selector context (dict) : kwargs to supply callable qu...
[]
Please provide a description of the function:def match(obj, selector, context=None): ''' Test whether a given Bokeh model matches a given selector. Args: obj (Model) : object to test selector (JSON-like) : query selector context (dict) : kwargs to supply callable query attributes R...
[]
Please provide a description of the function:def setup(app): ''' Required Sphinx extension setup function. ''' app.add_config_value('bokeh_gallery_dir', join("docs", "gallery"), 'html') app.connect('config-inited', config_inited_handler) app.add_directive('bokeh-gallery', BokehGalleryDirective)
[]
Please provide a description of the function:def default_filename(ext): ''' Generate a default filename with a given extension, attempting to use the filename of the currently running process, if possible. If the filename of the current process is not available (or would not be writable), then a tempor...
[]
Please provide a description of the function:def detect_current_filename(): ''' Attempt to return the filename of the currently running Python process Returns None if the filename cannot be detected. ''' import inspect filename = None frame = inspect.currentframe() try: while frame...
[]
Please provide a description of the function:def _no_access(basedir): ''' Return True if the given base dir is not accessible or writeable ''' import os return not os.access(basedir, os.W_OK | os.X_OK)
[]
Please provide a description of the function:def _shares_exec_prefix(basedir): ''' Whether a give base directory is on the system exex prefix ''' import sys prefix = sys.exec_prefix return (prefix is not None and basedir.startswith(prefix))
[]
Please provide a description of the function:def setup(app): ''' Required Sphinx extension setup function. ''' app.add_node(bokeh_palette_group, html=(html_visit_bokeh_palette_group, None)) app.add_directive('bokeh-palette-group', BokehPaletteGroupDirective)
[]
Please provide a description of the function:def other_args(cls): ''' Return args for ``-o`` / ``--output`` to specify where output should be written, and for a ``--args`` to pass on any additional command line args to the subcommand. Subclasses should append these to their class ``args...
[]
Please provide a description of the function:def _pop_colors_and_alpha(glyphclass, kwargs, prefix="", default_alpha=1.0): result = dict() # TODO: The need to do this and the complexity of managing this kind of # thing throughout the codebase really suggests that we need to have # a real stylesheet...
[ "\n Given a kwargs dict, a prefix, and a default value, looks for different\n color and alpha fields of the given prefix, and fills in the default value\n if it doesn't exist.\n " ]
Please provide a description of the function:def _tool_from_string(name): known_tools = sorted(_known_tools.keys()) if name in known_tools: tool_fn = _known_tools[name] if isinstance(tool_fn, string_types): tool_fn = _known_tools[tool_fn] return tool_fn() else: ...
[ " Takes a string and returns a corresponding `Tool` instance. " ]
Please provide a description of the function:def _process_tools_arg(plot, tools, tooltips=None): tool_objs = [] tool_map = {} temp_tool_str = "" repeated_tools = [] if isinstance(tools, (list, tuple)): for tool in tools: if isinstance(tool, Tool): tool_objs....
[ " Adds tools to the plot object\n\n Args:\n plot (Plot): instance of a plot object\n tools (seq[Tool or str]|str): list of tool types or string listing the\n tool names. Those are converted using the _tool_from_string\n function. I.e.: `wheel_zoom,box_zoom,reset`.\n too...
Please provide a description of the function:def _process_active_tools(toolbar, tool_map, active_drag, active_inspect, active_scroll, active_tap): if active_drag in ['auto', None] or isinstance(active_drag, Tool): toolbar.active_drag = active_drag elif active_drag in tool_map: toolbar.activ...
[ " Adds tools to the plot object\n\n Args:\n toolbar (Toolbar): instance of a Toolbar object\n tools_map (dict[str]|Tool): tool_map from _process_tools_arg\n active_drag (str or Tool): the tool to set active for drag\n active_inspect (str or Tool): the tool to set active for inspect\n ...
Please provide a description of the function:def from_py_func(cls, func): from bokeh.util.deprecation import deprecated deprecated("'from_py_func' is deprecated and will be removed in an eventual 2.0 release. " "Use CustomJS directly instead.") if not isinstance(func...
[ " Create a ``CustomJS`` instance from a Python function. The\n function is translated to JavaScript using PScript.\n " ]
Please provide a description of the function:def write_message(self, message, binary=False, locked=True): ''' Write a message to the websocket after obtaining the appropriate Bokeh Document lock. ''' def write_message_unlocked(): if self._socket.protocol is None: ...
[]
Please provide a description of the function:def _collect_external_resources(self, resource_attr): external_resources = [] for _, cls in sorted(Model.model_class_reverse_map.items(), key=lambda arg: arg[0]): external = getattr(cls, resource_attr, None) if isinstance(e...
[ " Collect external resources set on resource_attr attribute of all models." ]
Please provide a description of the function:def py_log_level(self, default='none'): ''' Set the log level for python Bokeh code. ''' level = self._get_str("PY_LOG_LEVEL", default, "debug") LEVELS = {'trace': logging.TRACE, 'debug': logging.DEBUG, 'in...
[]
Please provide a description of the function:def secret_key_bytes(self): ''' Return the secret_key, converted to bytes and cached. ''' if not hasattr(self, '_secret_key_bytes'): key = self.secret_key() if key is None: self._secret_key_bytes = None ...
[]
Please provide a description of the function:def bokehjssrcdir(self): ''' The absolute path of the BokehJS source code in the installed Bokeh source tree. ''' if self._is_dev or self.debugjs: bokehjssrcdir = abspath(join(ROOT_DIR, '..', 'bokehjs', 'src')) if isd...
[]
Please provide a description of the function:def css_files(self): ''' The CSS files in the BokehJS directory. ''' bokehjsdir = self.bokehjsdir() js_files = [] for root, dirnames, files in os.walk(bokehjsdir): for fname in files: if fname.endswith(".cs...
[]
Please provide a description of the function:def serialize_json(obj, pretty=None, indent=None, **kwargs): ''' Return a serialized JSON representation of objects, suitable to send to BokehJS. This function is typically used to serialize single python objects in the manner expected by BokehJS. In particu...
[]
Please provide a description of the function:def transform_python_types(self, obj): ''' Handle special scalars such as (Python, NumPy, or Pandas) datetimes, or Decimal values. Args: obj (obj) : The object to encode. Anything not specifically handled in ...
[]
Please provide a description of the function:def default(self, obj): ''' The required ``default`` method for ``JSONEncoder`` subclasses. Args: obj (obj) : The object to encode. Anything not specifically handled in this method is passed on to the default syst...
[]
Please provide a description of the function:def add(self, handler): ''' Add a handler to the pipeline used to initialize new documents. Args: handler (Handler) : a handler for this Application to use to process Documents ''' self._handlers.append(handler) ...
[]
Please provide a description of the function:def initialize_document(self, doc): ''' Fills in a new document using the Application's handlers. ''' for h in self._handlers: # TODO (havocp) we need to check the 'failed' flag on each handler # and build a composite error di...
[]
Please provide a description of the function:def on_session_created(self, session_context): ''' Invoked to execute code when a new session is created. This method calls ``on_session_created`` on each handler, in order, with the session context passed as the only argument. May return a ...
[]
Please provide a description of the function:def _select_helper(args, kwargs): if len(args) > 1: raise TypeError("select accepts at most ONE positional argument.") if len(args) > 0 and len(kwargs) > 0: raise TypeError("select accepts EITHER a positional argument, OR keyword arguments (not ...
[ " Allow flexible selector syntax.\n\n Returns:\n dict\n\n " ]
Please provide a description of the function:def select(self, *args, **kwargs): ''' Query this object and all of its references for objects that match the given selector. There are a few different ways to call the ``select`` method. The most general is to supply a JSON-like query dictio...
[]
Please provide a description of the function:def legend(self): ''' Splattable list of :class:`~bokeh.models.annotations.Legend` objects. ''' panels = self.above + self.below + self.left + self.right + self.center legends = [obj for obj in panels if isinstance(obj, Legend)] retur...
[]
Please provide a description of the function:def hover(self): ''' Splattable list of :class:`~bokeh.models.tools.HoverTool` objects. ''' hovers = [obj for obj in self.tools if isinstance(obj, HoverTool)] return _list_attr_splat(hovers)
[]
Please provide a description of the function:def add_layout(self, obj, place='center'): ''' Adds an object to the plot in a specified place. Args: obj (Renderer) : the object to add to the Plot place (str, optional) : where to add the object (default: 'center') V...
[]
Please provide a description of the function:def add_tools(self, *tools): ''' Adds tools to the plot. Args: *tools (Tool) : the tools to add to the Plot Returns: None ''' for tool in tools: if not isinstance(tool, Tool): rais...
[]
Please provide a description of the function:def add_glyph(self, source_or_glyph, glyph=None, **kw): ''' Adds a glyph to the plot with associated data sources and ranges. This function will take care of creating and configuring a Glyph object, and then add it to the plot's list of renderers. ...
[]
Please provide a description of the function:def add_tile(self, tile_source, **kw): ''' Adds new ``TileRenderer`` into ``Plot.renderers`` Args: tile_source (TileSource) : a tile source instance which contain tileset configuration Keyword Arguments: Additional keyword ar...
[]
Please provide a description of the function:def row(*args, **kwargs): sizing_mode = kwargs.pop('sizing_mode', None) children = kwargs.pop('children', None) children = _handle_children(*args, children=children) row_children = [] for item in children: if isinstance(item, LayoutDOM): ...
[ " Create a row of Bokeh Layout objects. Forces all objects to\n have the same sizing_mode, which is required for complex layouts to work.\n\n Args:\n children (list of :class:`~bokeh.models.layouts.LayoutDOM` ): A list of instances for\n the row. Can be any of the following - :class:`~bokeh....
Please provide a description of the function:def column(*args, **kwargs): sizing_mode = kwargs.pop('sizing_mode', None) children = kwargs.pop('children', None) children = _handle_children(*args, children=children) col_children = [] for item in children: if isinstance(item, LayoutDOM)...
[ " Create a column of Bokeh Layout objects. Forces all objects to\n have the same sizing_mode, which is required for complex layouts to work.\n\n Args:\n children (list of :class:`~bokeh.models.layouts.LayoutDOM` ): A list of instances for\n the column. Can be any of the following - :class:`~...
Please provide a description of the function:def widgetbox(*args, **kwargs): sizing_mode = kwargs.pop('sizing_mode', None) children = kwargs.pop('children', None) children = _handle_children(*args, children=children) col_children = [] for item in children: if isinstance(item, LayoutD...
[ " Create a column of bokeh widgets with predefined styling.\n\n Args:\n children (list of :class:`~bokeh.models.widgets.widget.Widget`): A list of widgets.\n\n sizing_mode (``\"fixed\"``, ``\"stretch_both\"``, ``\"scale_width\"``, ``\"scale_height\"``, ``\"scale_both\"`` ): How\n will th...
Please provide a description of the function:def layout(*args, **kwargs): sizing_mode = kwargs.pop('sizing_mode', None) children = kwargs.pop('children', None) children = _handle_children(*args, children=children) # Make the grid return _create_grid(children, sizing_mode)
[ " Create a grid-based arrangement of Bokeh Layout objects.\n\n Args:\n children (list of lists of :class:`~bokeh.models.layouts.LayoutDOM` ): A list of lists of instances\n for a grid layout. Can be any of the following - :class:`~bokeh.models.plots.Plot`,\n :class:`~bokeh.models.wid...
Please provide a description of the function:def gridplot(children, sizing_mode=None, toolbar_location='above', ncols=None, plot_width=None, plot_height=None, toolbar_options=None, merge_tools=True): ''' Create a grid of plots rendered on separate canvases. The ``gridplot`` function builds a singl...
[]
Please provide a description of the function:def grid(children=[], sizing_mode=None, nrows=None, ncols=None): row = namedtuple("row", ["children"]) col = namedtuple("col", ["children"]) def flatten(layout): Item = namedtuple("Item", ["layout", "r0", "c0", "r1", "c1"]) Grid = namedtuple...
[ "\n Conveniently create a grid of layoutable objects.\n\n Grids are created by using ``GridBox`` model. This gives the most control over\n the layout of a grid, but is also tedious and may result in unreadable code in\n practical applications. ``grid()`` function remedies this by reducing the level\n ...
Please provide a description of the function:def _create_grid(iterable, sizing_mode, layer=0): return_list = [] for item in iterable: if isinstance(item, list): return_list.append(_create_grid(item, sizing_mode, layer+1)) elif isinstance(item, LayoutDOM): if sizing_m...
[ "Recursively create grid from input lists.", "Only LayoutDOM items can be inserted into a layout.\n Tried to insert: %s of type %s" ]
Please provide a description of the function:def _chunks(l, ncols): assert isinstance(ncols, int), "ncols must be an integer" for i in range(0, len(l), ncols): yield l[i: i+ncols]
[ "Yield successive n-sized chunks from list, l." ]
Please provide a description of the function:def without_document_lock(func): ''' Wrap a callback function to execute without first obtaining the document lock. Args: func (callable) : The function to wrap Returns: callable : a function wrapped to execute without a |Document| lock. ...
[]
Please provide a description of the function:def server_document(url="default", relative_urls=False, resources="default", arguments=None): ''' Return a script tag that embeds content from a Bokeh server. Bokeh apps embedded using these methods will NOT set the browser window title. Args: url (str,...
[]
Please provide a description of the function:def server_session(model=None, session_id=None, url="default", relative_urls=False, resources="default"): ''' Return a script tag that embeds content from a specific existing session on a Bokeh server. This function is typically only useful for serving from a a ...
[]
Please provide a description of the function:def _clean_url(url): ''' Produce a canonical Bokeh server URL. Args: url (str) A URL to clean, or "defatul". If "default" then the ``BOKEH_SERVER_HTTP_URL`` will be returned. Returns: str ''' if url == 'default':...
[]
Please provide a description of the function:def _get_app_path(url): ''' Extract the app path from a Bokeh server URL Args: url (str) : Returns: str ''' app_path = urlparse(url).path.rstrip("/") if not app_path.startswith("/"): app_path = "/" + app_path return app_...
[]
Please provide a description of the function:def _process_arguments(arguments): ''' Return user-supplied HTML arguments to add to a Bokeh server URL. Args: arguments (dict[str, object]) : Key/value pairs to add to the URL Returns: str ''' if arguments is None: return "...
[]
Please provide a description of the function:def check_origin(self, origin): ''' Implement a check_origin policy for Tornado to call. The supplied origin will be compared to the Bokeh server whitelist. If the origin is not allow, an error will be logged and ``False`` will be returned. ...
[]
Please provide a description of the function:def open(self): ''' Initialize a connection to a client. Returns: None ''' log.info('WebSocket connection opened') proto_version = self.get_argument("bokeh-protocol-version", default=None) if proto_version is Non...
[]