id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
30,300
bokeh/bokeh
bokeh/util/serialization.py
transform_column_source_data
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 buffers are desired, the buffers parameter may b...
python
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 buffers are desired, the buffers parameter may b...
[ "def", "transform_column_source_data", "(", "data", ",", "buffers", "=", "None", ",", "cols", "=", "None", ")", ":", "to_transform", "=", "set", "(", "data", ")", "if", "cols", "is", "None", "else", "set", "(", "cols", ")", "data_copy", "=", "{", "}", ...
Transform ``ColumnSourceData`` data to a serialized format Args: data (dict) : the mapping of names to data columns to transform buffers (set, optional) : If binary buffers are desired, the buffers parameter may be provided, and any columns that may be sent as binary buffer...
[ "Transform", "ColumnSourceData", "data", "to", "a", "serialized", "format" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/serialization.py#L458-L492
30,301
bokeh/bokeh
bokeh/util/serialization.py
encode_binary_dict
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' : << array shape >>, 'dtype...
python
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' : << array shape >>, 'dtype...
[ "def", "encode_binary_dict", "(", "array", ",", "buffers", ")", ":", "buffer_id", "=", "make_id", "(", ")", "buf", "=", "(", "dict", "(", "id", "=", "buffer_id", ")", ",", "array", ".", "tobytes", "(", ")", ")", "buffers", ".", "append", "(", "buf", ...
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' : << array shape >>, 'dtype' : << dtype name >>, 'order' ...
[ "Send", "a", "numpy", "array", "as", "an", "unencoded", "binary", "buffer" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/serialization.py#L494-L530
30,302
bokeh/bokeh
bokeh/util/serialization.py
decode_base64_dict
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 = base64.b64decode(data['__ndarray__']) arra...
python
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 = base64.b64decode(data['__ndarray__']) arra...
[ "def", "decode_base64_dict", "(", "data", ")", ":", "b64", "=", "base64", ".", "b64decode", "(", "data", "[", "'__ndarray__'", "]", ")", "array", "=", "np", ".", "copy", "(", "np", ".", "frombuffer", "(", "b64", ",", "dtype", "=", "data", "[", "'dtyp...
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
[ "Decode", "a", "base64", "encoded", "array", "into", "a", "NumPy", "array", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/serialization.py#L559-L575
30,303
bokeh/bokeh
bokeh/models/tools.py
CustomJSHover.from_py_func
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 (e.g. a ``ColumnDataSource``) as keyword ...
python
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 (e.g. a ``ColumnDataSource``) as keyword ...
[ "def", "from_py_func", "(", "cls", ",", "code", ")", ":", "from", "bokeh", ".", "util", ".", "deprecation", "import", "deprecated", "deprecated", "(", "\"'from_py_func' is deprecated and will be removed in an eventual 2.0 release. \"", "\"Use CustomJSHover directly instead.\"",...
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 (e.g. a ``ColumnDataSource``) as keyword arguments to the functions. ...
[ "Create", "a", "CustomJSHover", "instance", "from", "a", "Python", "functions", ".", "The", "function", "is", "translated", "to", "JavaScript", "using", "PScript", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/models/tools.py#L882-L932
30,304
bokeh/bokeh
bokeh/models/tools.py
CustomJSHover.from_coffeescript
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 namespace will contain the variable ``value`` (...
python
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 namespace will contain the variable ``value`` (...
[ "def", "from_coffeescript", "(", "cls", ",", "code", ",", "args", "=", "{", "}", ")", ":", "compiled", "=", "nodejs_compile", "(", "code", ",", "lang", "=", "\"coffeescript\"", ",", "file", "=", "\"???\"", ")", "if", "\"error\"", "in", "compiled", ":", ...
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 namespace will contain the variable ``value`` (the untransformed value) at render time as well...
[ "Create", "a", "CustomJSHover", "instance", "from", "a", "CoffeeScript", "snippet", ".", "The", "function", "bodies", "are", "translated", "to", "JavaScript", "functions", "using", "node", "and", "therefore", "require", "return", "statements", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/models/tools.py#L935-L962
30,305
bokeh/bokeh
bokeh/sphinxext/bokehjs_content.py
BokehJSContent.get_codeblock_node
def get_codeblock_node(self, code, language): """this is copied from sphinx.directives.code.CodeBlock.run it has been changed to accept code and language as an arguments instead of reading from self """ # type: () -> List[nodes.Node] document = self.state.document ...
python
def get_codeblock_node(self, code, language): """this is copied from sphinx.directives.code.CodeBlock.run it has been changed to accept code and language as an arguments instead of reading from self """ # type: () -> List[nodes.Node] document = self.state.document ...
[ "def", "get_codeblock_node", "(", "self", ",", "code", ",", "language", ")", ":", "# type: () -> List[nodes.Node]", "document", "=", "self", ".", "state", ".", "document", "location", "=", "self", ".", "state_machine", ".", "get_source_and_line", "(", "self", "....
this is copied from sphinx.directives.code.CodeBlock.run it has been changed to accept code and language as an arguments instead of reading from self
[ "this", "is", "copied", "from", "sphinx", ".", "directives", ".", "code", ".", "CodeBlock", ".", "run" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/sphinxext/bokehjs_content.py#L117-L174
30,306
bokeh/bokeh
bokeh/sphinxext/bokehjs_content.py
BokehJSContent.get_code_language
def get_code_language(self): """ This is largely copied from bokeh.sphinxext.bokeh_plot.run """ 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.r...
python
def get_code_language(self): """ This is largely copied from bokeh.sphinxext.bokeh_plot.run """ 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.r...
[ "def", "get_code_language", "(", "self", ")", ":", "js_source", "=", "self", ".", "get_js_source", "(", ")", "if", "self", ".", "options", ".", "get", "(", "\"include_html\"", ",", "False", ")", ":", "resources", "=", "get_sphinx_resources", "(", "include_bo...
This is largely copied from bokeh.sphinxext.bokeh_plot.run
[ "This", "is", "largely", "copied", "from", "bokeh", ".", "sphinxext", ".", "bokeh_plot", ".", "run" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/sphinxext/bokehjs_content.py#L196-L209
30,307
bokeh/bokeh
bokeh/embed/standalone.py
autoload_static
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) : resources (Resources) : script_pa...
python
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) : resources (Resources) : script_pa...
[ "def", "autoload_static", "(", "model", ",", "resources", ",", "script_path", ")", ":", "# TODO: maybe warn that it's not exactly useful, but technically possible", "# if resources.mode == 'inline':", "# raise ValueError(\"autoload_static() requires non-inline resources\")", "if", "i...
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) : resources (Resources) : script_path (str) : Returns: (js, tag) : Jav...
[ "Return", "JavaScript", "code", "and", "a", "script", "tag", "that", "can", "be", "used", "to", "embed", "Bokeh", "Plots", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/embed/standalone.py#L55-L109
30,308
bokeh/bokeh
bokeh/embed/standalone.py
components
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 returned components assume that BokehJS reso...
python
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 returned components assume that BokehJS reso...
[ "def", "components", "(", "models", ",", "wrap_script", "=", "True", ",", "wrap_plot_info", "=", "True", ",", "theme", "=", "FromCurdoc", ")", ":", "# 1) Convert single items and dicts into list", "was_single_object", "=", "isinstance", "(", "models", ",", "Model", ...
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 returned components assume that BokehJS resources are **already loaded**. The html template in which they will be embedded needs ...
[ "Return", "HTML", "components", "to", "embed", "a", "Bokeh", "plot", ".", "The", "data", "for", "the", "plot", "is", "stored", "directly", "in", "the", "returned", "HTML", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/embed/standalone.py#L111-L248
30,309
bokeh/bokeh
bokeh/embed/standalone.py
file_html
def file_html(models, resources, title=None, template=FILE, template_variables={}, theme=FromCurdoc, suppress_callback_warning=False, _always_new=False): ''' Return an HTML document that embeds Bokeh Model or Document ...
python
def file_html(models, resources, title=None, template=FILE, template_variables={}, theme=FromCurdoc, suppress_callback_warning=False, _always_new=False): ''' Return an HTML document that embeds Bokeh Model or Document ...
[ "def", "file_html", "(", "models", ",", "resources", ",", "title", "=", "None", ",", "template", "=", "FILE", ",", "template_variables", "=", "{", "}", ",", "theme", "=", "FromCurdoc", ",", "suppress_callback_warning", "=", "False", ",", "_always_new", "=", ...
Return an HTML document that embeds Bokeh Model or Document objects. The data for the plot is stored directly in the returned HTML, with support for customizing the JS/CSS resources independently and customizing the jinja2 template. Args: models (Model or Document or seq[Model]) : Bokeh object...
[ "Return", "an", "HTML", "document", "that", "embeds", "Bokeh", "Model", "or", "Document", "objects", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/embed/standalone.py#L250-L312
30,310
bokeh/bokeh
bokeh/embed/standalone.py
json_item
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 model into. If None, the target id must ...
python
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 model into. If None, the target id must ...
[ "def", "json_item", "(", "model", ",", "target", "=", "None", ",", "theme", "=", "FromCurdoc", ")", ":", "with", "OutputDocumentFor", "(", "[", "model", "]", ",", "apply_theme", "=", "theme", ")", "as", "doc", ":", "doc", ".", "title", "=", "\"\"", "...
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 model into. If None, the target id must be supplied in the JavaScript call. theme (Th...
[ "Return", "a", "JSON", "block", "that", "can", "be", "used", "to", "embed", "standalone", "Bokeh", "content", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/embed/standalone.py#L314-L383
30,311
bokeh/bokeh
bokeh/protocol/messages/patch_doc.py
process_document_events
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 string which can be applied to make the given upda...
python
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 string which can be applied to make the given upda...
[ "def", "process_document_events", "(", "events", ",", "use_buffers", "=", "True", ")", ":", "json_events", "=", "[", "]", "references", "=", "set", "(", ")", "buffers", "=", "[", "]", "if", "use_buffers", "else", "None", "for", "event", "in", "events", "...
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 string which can be applied to make the given updates to obj as well as any optional buffers
[ "Create", "a", "JSON", "string", "describing", "a", "patch", "to", "be", "applied", "as", "well", "as", "any", "optional", "buffers", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/protocol/messages/patch_doc.py#L109-L136
30,312
bokeh/bokeh
bokeh/util/compiler.py
calc_cache_key
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_name``. This is not ideal but possibly a...
python
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_name``. This is not ideal but possibly a...
[ "def", "calc_cache_key", "(", "custom_models", ")", ":", "model_names", "=", "{", "model", ".", "full_name", "for", "model", "in", "custom_models", ".", "values", "(", ")", "}", "encoded_names", "=", "\",\"", ".", "join", "(", "sorted", "(", "model_names", ...
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_name``. This is not ideal but possibly a better solution can be found found later.
[ "Generate", "a", "key", "to", "cache", "a", "custom", "extension", "implementation", "with", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/compiler.py#L312-L324
30,313
bokeh/bokeh
bokeh/util/compiler.py
bundle_models
def bundle_models(models): """Create a bundle of selected `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[ke...
python
def bundle_models(models): """Create a bundle of selected `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[ke...
[ "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", ...
Create a bundle of selected `models`.
[ "Create", "a", "bundle", "of", "selected", "models", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/compiler.py#L328-L343
30,314
bokeh/bokeh
bokeh/util/compiler.py
_compile_models
def _compile_models(custom_models): """Returns the compiled implementation of supplied `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.dependencie...
python
def _compile_models(custom_models): """Returns the compiled implementation of supplied `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.dependencie...
[ "def", "_compile_models", "(", "custom_models", ")", ":", "ordered_models", "=", "sorted", "(", "custom_models", ".", "values", "(", ")", ",", "key", "=", "lambda", "model", ":", "model", ".", "full_name", ")", "custom_impls", "=", "{", "}", "dependencies", ...
Returns the compiled implementation of supplied `models`.
[ "Returns", "the", "compiled", "implementation", "of", "supplied", "models", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/compiler.py#L518-L542
30,315
bokeh/bokeh
bokeh/command/util.py
build_single_handler_application
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 initialize :class:`~bokeh.document.Document`...
python
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 initialize :class:`~bokeh.document.Document`...
[ "def", "build_single_handler_application", "(", "path", ",", "argv", "=", "None", ")", ":", "argv", "=", "argv", "or", "[", "]", "path", "=", "os", ".", "path", ".", "abspath", "(", "path", ")", "# There are certainly race conditions here if the file/directory is ...
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 initialize :class:`~bokeh.document.Document` objects for new client sessions. However, in many cases on...
[ "Return", "a", "Bokeh", "application", "built", "using", "a", "single", "handler", "for", "a", "script", "notebook", "or", "directory", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/command/util.py#L77-L139
30,316
bokeh/bokeh
bokeh/command/util.py
build_single_handler_applications
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:`~bokeh.command.util.build_single_handler_applicati...
python
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:`~bokeh.command.util.build_single_handler_applicati...
[ "def", "build_single_handler_applications", "(", "paths", ",", "argvs", "=", "None", ")", ":", "applications", "=", "{", "}", "argvs", "=", "{", "}", "or", "argvs", "for", "path", "in", "paths", ":", "application", "=", "build_single_handler_application", "(",...
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:`~bokeh.command.util.build_single_handler_application` on each to generate the mapping. Args: path (...
[ "Return", "a", "dictionary", "mapping", "routes", "to", "Bokeh", "applications", "built", "using", "single", "handlers", "for", "specified", "files", "or", "directories", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/command/util.py#L141-L177
30,317
bokeh/bokeh
bokeh/command/util.py
report_server_init_errors
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 be listening on port (int) : networ...
python
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 be listening on port (int) : networ...
[ "def", "report_server_init_errors", "(", "address", "=", "None", ",", "port", "=", "None", ",", "*", "*", "kwargs", ")", ":", "try", ":", "yield", "except", "EnvironmentError", "as", "e", ":", "if", "e", ".", "errno", "==", "errno", ".", "EADDRINUSE", ...
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 be listening on port (int) : network address that the server will be listening on Example: .. c...
[ "A", "context", "manager", "to", "help", "print", "more", "informative", "error", "messages", "when", "a", "Server", "cannot", "be", "started", "due", "to", "a", "network", "problem", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/command/util.py#L181-L212
30,318
bokeh/bokeh
bokeh/server/util.py
bind_sockets
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 automatically choose a free port. This functi...
python
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 automatically choose a free port. This functi...
[ "def", "bind_sockets", "(", "address", ",", "port", ")", ":", "ss", "=", "netutil", ".", "bind_sockets", "(", "port", "=", "port", "or", "0", ",", "address", "=", "address", ")", "assert", "len", "(", "ss", ")", "ports", "=", "{", "s", ".", "getsoc...
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 automatically choose a free port. This function returns a 2-tuple with the new socket ...
[ "Bind", "a", "socket", "to", "a", "port", "on", "an", "address", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/util.py#L46-L73
30,319
bokeh/bokeh
bokeh/server/util.py
check_whitelist
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 assumed. whitelist (seq[str]) : ...
python
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 assumed. whitelist (seq[str]) : ...
[ "def", "check_whitelist", "(", "host", ",", "whitelist", ")", ":", "if", "':'", "not", "in", "host", ":", "host", "=", "host", "+", "':80'", "if", "host", "in", "whitelist", ":", "return", "True", "return", "any", "(", "match_host", "(", "host", ",", ...
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 assumed. whitelist (seq[str]) : A list of host patterns to match again...
[ "Check", "a", "given", "request", "host", "against", "a", "whitelist", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/util.py#L75-L99
30,320
bokeh/bokeh
bokeh/server/util.py
match_host
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 wildcards for ip address octets or ports. Thi...
python
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 wildcards for ip address octets or ports. Thi...
[ "def", "match_host", "(", "host", ",", "pattern", ")", ":", "if", "':'", "in", "host", ":", "host", ",", "host_port", "=", "host", ".", "rsplit", "(", "':'", ",", "1", ")", "else", ":", "host_port", "=", "None", "if", "':'", "in", "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 wildcards for ip address octets or ports. This function will return ``True`` if the ...
[ "Match", "a", "host", "string", "against", "a", "pattern" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/util.py#L164-L240
30,321
bokeh/bokeh
bokeh/io/state.py
State.notebook_type
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_types): raise ValueError("Noteboo...
python
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_types): raise ValueError("Noteboo...
[ "def", "notebook_type", "(", "self", ",", "notebook_type", ")", ":", "if", "notebook_type", "is", "None", "or", "not", "isinstance", "(", "notebook_type", ",", "string_types", ")", ":", "raise", "ValueError", "(", "\"Notebook type must be a string\"", ")", "self",...
Notebook type, acceptable values are 'jupyter' as well as any names defined by external notebook hooks that have been installed.
[ "Notebook", "type", "acceptable", "values", "are", "jupyter", "as", "well", "as", "any", "names", "defined", "by", "external", "notebook", "hooks", "that", "have", "been", "installed", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/io/state.py#L124-L131
30,322
bokeh/bokeh
bokeh/io/state.py
State.output_file
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 destination (publishing to HTML file...
python
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 destination (publishing to HTML file...
[ "def", "output_file", "(", "self", ",", "filename", ",", "title", "=", "\"Bokeh Plot\"", ",", "mode", "=", "\"cdn\"", ",", "root_dir", "=", "None", ")", ":", "self", ".", "_file", "=", "{", "'filename'", ":", "filename", ",", "'resources'", ":", "Resourc...
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 destination (publishing to HTML files). Any other active output modes continue to be active. Args: ...
[ "Configure", "output", "to", "a", "standalone", "HTML", "file", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/io/state.py#L135-L171
30,323
bokeh/bokeh
bokeh/io/saving.py
save
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 ``filename``, ``resources``, or ``title`` if they ...
python
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 ``filename``, ``resources``, or ``title`` if they ...
[ "def", "save", "(", "obj", ",", "filename", "=", "None", ",", "resources", "=", "None", ",", "title", "=", "None", ",", "template", "=", "None", ",", "state", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "state", "is", "None", ":", "stat...
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 ``filename``, ``resources``, or ``title`` if they are not provided. If the filename is not given and not provided via output state, it is derived fr...
[ "Save", "an", "HTML", "file", "with", "the", "data", "for", "the", "current", "document", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/io/saving.py#L50-L87
30,324
bokeh/bokeh
bokeh/sphinxext/bokeh_sitemap.py
html_page_context
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 + '/' + pagename + ".html")
python
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 + '/' + pagename + ".html")
[ "def", "html_page_context", "(", "app", ",", "pagename", ",", "templatename", ",", "context", ",", "doctree", ")", ":", "site", "=", "context", "[", "'SITEMAP_BASE_URL'", "]", "version", "=", "context", "[", "'version'", "]", "app", ".", "sitemap_links", "."...
Collect page names for the sitemap as HTML pages are built.
[ "Collect", "page", "names", "for", "the", "sitemap", "as", "HTML", "pages", "are", "built", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/sphinxext/bokeh_sitemap.py#L58-L64
30,325
bokeh/bokeh
bokeh/sphinxext/bokeh_sitemap.py
build_finished
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 sitemap... ', ...
python
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 sitemap... ', ...
[ "def", "build_finished", "(", "app", ",", "exception", ")", ":", "filename", "=", "join", "(", "app", ".", "outdir", ",", "\"sitemap.txt\"", ")", "links_iter", "=", "status_iterator", "(", "sorted", "(", "app", ".", "sitemap_links", ")", ",", "'adding links ...
Generate a ``sitemap.txt`` from the collected HTML page links.
[ "Generate", "a", "sitemap", ".", "txt", "from", "the", "collected", "HTML", "page", "links", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/sphinxext/bokeh_sitemap.py#L66-L83
30,326
bokeh/bokeh
bokeh/server/tornado.py
BokehTornado.initialize
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 = set() self._stats_job = PeriodicC...
python
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 = set() self._stats_job = PeriodicC...
[ "def", "initialize", "(", "self", ",", "io_loop", ")", ":", "self", ".", "_loop", "=", "io_loop", "for", "app_context", "in", "self", ".", "_applications", ".", "values", "(", ")", ":", "app_context", ".", "_loop", "=", "self", ".", "_loop", "self", "....
Start a Bokeh Server Tornado Application on a given Tornado IOLoop.
[ "Start", "a", "Bokeh", "Server", "Tornado", "Application", "on", "a", "given", "Tornado", "IOLoop", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/tornado.py#L319-L346
30,327
bokeh/bokeh
bokeh/server/tornado.py
BokehTornado.start
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 applications will be run. ''' sel...
python
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 applications will be run. ''' sel...
[ "def", "start", "(", "self", ")", ":", "self", ".", "_stats_job", ".", "start", "(", ")", "if", "self", ".", "_mem_job", "is", "not", "None", ":", "self", ".", "_mem_job", ".", "start", "(", ")", "self", ".", "_cleanup_job", ".", "start", "(", ")",...
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 applications will be run.
[ "Start", "the", "Bokeh", "Server", "application", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/tornado.py#L425-L441
30,328
bokeh/bokeh
bokeh/server/tornado.py
BokehTornado.stop
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 shut down all sessions here for context ...
python
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 shut down all sessions here for context ...
[ "def", "stop", "(", "self", ",", "wait", "=", "True", ")", ":", "# TODO should probably close all connections and shut down all sessions here", "for", "context", "in", "self", ".", "_applications", ".", "values", "(", ")", ":", "context", ".", "run_unload_hook", "("...
Stop the Bokeh Server application. Args: wait (bool): whether to wait for orderly cleanup (default: True) Returns: None
[ "Stop", "the", "Bokeh", "Server", "application", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/tornado.py#L443-L465
30,329
bokeh/bokeh
bokeh/server/tornado.py
BokehTornado.get_session
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. session_id (str) : ...
python
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. session_id (str) : ...
[ "def", "get_session", "(", "self", ",", "app_path", ",", "session_id", ")", ":", "if", "app_path", "not", "in", "self", ".", "_applications", ":", "raise", "ValueError", "(", "\"Application %s does not exist on this server\"", "%", "app_path", ")", "return", "self...
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. session_id (str) : The session ID of the session to retrieve. Re...
[ "Get", "an", "active", "a", "session", "by", "name", "application", "path", "and", "session", "ID", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/tornado.py#L476-L493
30,330
bokeh/bokeh
bokeh/server/tornado.py
BokehTornado.get_sessions
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: list[ServerSession] ''' ...
python
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: list[ServerSession] ''' ...
[ "def", "get_sessions", "(", "self", ",", "app_path", ")", ":", "if", "app_path", "not", "in", "self", ".", "_applications", ":", "raise", "ValueError", "(", "\"Application %s does not exist on this server\"", "%", "app_path", ")", "return", "list", "(", "self", ...
Gets all currently active sessions for an application. Args: app_path (str) : The configured application path for the application to return sessions for. Returns: list[ServerSession]
[ "Gets", "all", "currently", "active", "sessions", "for", "an", "application", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/tornado.py#L495-L509
30,331
bokeh/bokeh
bokeh/core/validation/decorators.py
_validator
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 "error" or "warning" Returns: validat...
python
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 "error" or "warning" Returns: validat...
[ "def", "_validator", "(", "code_or_name", ",", "validator_type", ")", ":", "if", "validator_type", "==", "\"error\"", ":", "from", ".", "errors", "import", "codes", "from", ".", "errors", "import", "EXT", "elif", "validator_type", "==", "\"warning\"", ":", "fr...
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 "error" or "warning" Returns: validation decorator
[ "Internal", "shared", "implementation", "to", "handle", "both", "error", "and", "warning", "validation", "checks", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/validation/decorators.py#L44-L80
30,332
bokeh/bokeh
bokeh/core/query.py
find
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 query attributes Yields: Model : o...
python
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 query attributes Yields: Model : o...
[ "def", "find", "(", "objs", ",", "selector", ",", "context", "=", "None", ")", ":", "return", "(", "obj", "for", "obj", "in", "objs", "if", "match", "(", "obj", ",", "selector", ",", "context", ")", ")" ]
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 query attributes Yields: Model : objects that match the query Queries are spe...
[ "Query", "a", "collection", "of", "Bokeh", "models", "and", "yield", "any", "that", "match", "the", "a", "selector", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/query.py#L52-L87
30,333
bokeh/bokeh
bokeh/core/query.py
match
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 Returns: bool : True if the object mat...
python
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 Returns: bool : True if the object mat...
[ "def", "match", "(", "obj", ",", "selector", ",", "context", "=", "None", ")", ":", "context", "=", "context", "or", "{", "}", "for", "key", ",", "val", "in", "selector", ".", "items", "(", ")", ":", "# test attributes", "if", "isinstance", "(", "key...
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 Returns: bool : True if the object matches, False otherwise In general, the selec...
[ "Test", "whether", "a", "given", "Bokeh", "model", "matches", "a", "given", "selector", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/query.py#L89-L211
30,334
bokeh/bokeh
bokeh/io/util.py
default_filename
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 temporary file with the given extension is returned...
python
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 temporary file with the given extension is returned...
[ "def", "default_filename", "(", "ext", ")", ":", "if", "ext", "==", "\"py\"", ":", "raise", "RuntimeError", "(", "\"asked for a default filename with 'py' extension\"", ")", "filename", "=", "detect_current_filename", "(", ")", "if", "filename", "is", "None", ":", ...
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 temporary file with the given extension is returned. Args: ext (str) : th...
[ "Generate", "a", "default", "filename", "with", "a", "given", "extension", "attempting", "to", "use", "the", "filename", "of", "the", "currently", "running", "process", "if", "possible", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/io/util.py#L50-L82
30,335
bokeh/bokeh
bokeh/io/util.py
detect_current_filename
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.f_back and frame.f_globals.get('name') != '_...
python
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.f_back and frame.f_globals.get('name') != '_...
[ "def", "detect_current_filename", "(", ")", ":", "import", "inspect", "filename", "=", "None", "frame", "=", "inspect", ".", "currentframe", "(", ")", "try", ":", "while", "frame", ".", "f_back", "and", "frame", ".", "f_globals", ".", "get", "(", "'name'",...
Attempt to return the filename of the currently running Python process Returns None if the filename cannot be detected.
[ "Attempt", "to", "return", "the", "filename", "of", "the", "currently", "running", "Python", "process" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/io/util.py#L84-L101
30,336
bokeh/bokeh
bokeh/io/util.py
_no_access
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)
python
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)
[ "def", "_no_access", "(", "basedir", ")", ":", "import", "os", "return", "not", "os", ".", "access", "(", "basedir", ",", "os", ".", "W_OK", "|", "os", ".", "X_OK", ")" ]
Return True if the given base dir is not accessible or writeable
[ "Return", "True", "if", "the", "given", "base", "dir", "is", "not", "accessible", "or", "writeable" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/io/util.py#L113-L118
30,337
bokeh/bokeh
bokeh/io/util.py
_shares_exec_prefix
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))
python
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))
[ "def", "_shares_exec_prefix", "(", "basedir", ")", ":", "import", "sys", "prefix", "=", "sys", ".", "exec_prefix", "return", "(", "prefix", "is", "not", "None", "and", "basedir", ".", "startswith", "(", "prefix", ")", ")" ]
Whether a give base directory is on the system exex prefix
[ "Whether", "a", "give", "base", "directory", "is", "on", "the", "system", "exex", "prefix" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/io/util.py#L120-L126
30,338
bokeh/bokeh
bokeh/plotting/helpers.py
_pop_colors_and_alpha
def _pop_colors_and_alpha(glyphclass, kwargs, prefix="", default_alpha=1.0): """ Given a kwargs dict, a prefix, and a default value, looks for different color and alpha fields of the given prefix, and fills in the default value if it doesn't exist. """ result = dict() # TODO: The need to do...
python
def _pop_colors_and_alpha(glyphclass, kwargs, prefix="", default_alpha=1.0): """ Given a kwargs dict, a prefix, and a default value, looks for different color and alpha fields of the given prefix, and fills in the default value if it doesn't exist. """ result = dict() # TODO: The need to do...
[ "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 co...
Given a kwargs dict, a prefix, and a default value, looks for different color and alpha fields of the given prefix, and fills in the default value if it doesn't exist.
[ "Given", "a", "kwargs", "dict", "a", "prefix", "and", "a", "default", "value", "looks", "for", "different", "color", "and", "alpha", "fields", "of", "the", "given", "prefix", "and", "fills", "in", "the", "default", "value", "if", "it", "doesn", "t", "exi...
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/plotting/helpers.py#L286-L315
30,339
bokeh/bokeh
bokeh/plotting/helpers.py
_tool_from_string
def _tool_from_string(name): """ Takes a string and returns a corresponding `Tool` instance. """ 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 ...
python
def _tool_from_string(name): """ Takes a string and returns a corresponding `Tool` instance. """ 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 ...
[ "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", ...
Takes a string and returns a corresponding `Tool` instance.
[ "Takes", "a", "string", "and", "returns", "a", "corresponding", "Tool", "instance", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/plotting/helpers.py#L544-L561
30,340
bokeh/bokeh
bokeh/models/callbacks.py
CustomJS.from_py_func
def from_py_func(cls, func): """ Create a ``CustomJS`` instance from a Python function. The function is translated to JavaScript using PScript. """ from bokeh.util.deprecation import deprecated deprecated("'from_py_func' is deprecated and will be removed in an eventual 2.0 releas...
python
def from_py_func(cls, func): """ Create a ``CustomJS`` instance from a Python function. The function is translated to JavaScript using PScript. """ from bokeh.util.deprecation import deprecated deprecated("'from_py_func' is deprecated and will be removed in an eventual 2.0 releas...
[ "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.\"", ")...
Create a ``CustomJS`` instance from a Python function. The function is translated to JavaScript using PScript.
[ "Create", "a", "CustomJS", "instance", "from", "a", "Python", "function", ".", "The", "function", "is", "translated", "to", "JavaScript", "using", "PScript", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/models/callbacks.py#L85-L106
30,341
bokeh/bokeh
bokeh/client/websocket.py
WebSocketClientConnectionWrapper.write_message
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: # Tornado is maybe supposed to do this, ...
python
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: # Tornado is maybe supposed to do this, ...
[ "def", "write_message", "(", "self", ",", "message", ",", "binary", "=", "False", ",", "locked", "=", "True", ")", ":", "def", "write_message_unlocked", "(", ")", ":", "if", "self", ".", "_socket", ".", "protocol", "is", "None", ":", "# Tornado is maybe su...
Write a message to the websocket after obtaining the appropriate Bokeh Document lock.
[ "Write", "a", "message", "to", "the", "websocket", "after", "obtaining", "the", "appropriate", "Bokeh", "Document", "lock", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/client/websocket.py#L62-L86
30,342
bokeh/bokeh
bokeh/resources.py
BaseResources._collect_external_resources
def _collect_external_resources(self, resource_attr): """ Collect external resources set on resource_attr attribute of all models.""" external_resources = [] for _, cls in sorted(Model.model_class_reverse_map.items(), key=lambda arg: arg[0]): external = getattr(cls, resource_attr, ...
python
def _collect_external_resources(self, resource_attr): """ Collect external resources set on resource_attr attribute of all models.""" external_resources = [] for _, cls in sorted(Model.model_class_reverse_map.items(), key=lambda arg: arg[0]): external = getattr(cls, resource_attr, ...
[ "def", "_collect_external_resources", "(", "self", ",", "resource_attr", ")", ":", "external_resources", "=", "[", "]", "for", "_", ",", "cls", "in", "sorted", "(", "Model", ".", "model_class_reverse_map", ".", "items", "(", ")", ",", "key", "=", "lambda", ...
Collect external resources set on resource_attr attribute of all models.
[ "Collect", "external", "resources", "set", "on", "resource_attr", "attribute", "of", "all", "models", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/resources.py#L155-L171
30,343
bokeh/bokeh
bokeh/settings.py
_Settings.py_log_level
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, 'info' : logging.INFO, 'warn' ...
python
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, 'info' : logging.INFO, 'warn' ...
[ "def", "py_log_level", "(", "self", ",", "default", "=", "'none'", ")", ":", "level", "=", "self", ".", "_get_str", "(", "\"PY_LOG_LEVEL\"", ",", "default", ",", "\"debug\"", ")", "LEVELS", "=", "{", "'trace'", ":", "logging", ".", "TRACE", ",", "'debug'...
Set the log level for python Bokeh code.
[ "Set", "the", "log", "level", "for", "python", "Bokeh", "code", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/settings.py#L275-L287
30,344
bokeh/bokeh
bokeh/settings.py
_Settings.secret_key_bytes
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 else: self._secret_key_b...
python
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 else: self._secret_key_b...
[ "def", "secret_key_bytes", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_secret_key_bytes'", ")", ":", "key", "=", "self", ".", "secret_key", "(", ")", "if", "key", "is", "None", ":", "self", ".", "_secret_key_bytes", "=", "None", ...
Return the secret_key, converted to bytes and cached.
[ "Return", "the", "secret_key", "converted", "to", "bytes", "and", "cached", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/settings.py#L315-L325
30,345
bokeh/bokeh
bokeh/settings.py
_Settings.bokehjssrcdir
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 isdir(bokehjssrcdir): return bok...
python
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 isdir(bokehjssrcdir): return bok...
[ "def", "bokehjssrcdir", "(", "self", ")", ":", "if", "self", ".", "_is_dev", "or", "self", ".", "debugjs", ":", "bokehjssrcdir", "=", "abspath", "(", "join", "(", "ROOT_DIR", ",", "'..'", ",", "'bokehjs'", ",", "'src'", ")", ")", "if", "isdir", "(", ...
The absolute path of the BokehJS source code in the installed Bokeh source tree.
[ "The", "absolute", "path", "of", "the", "BokehJS", "source", "code", "in", "the", "installed", "Bokeh", "source", "tree", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/settings.py#L344-L355
30,346
bokeh/bokeh
bokeh/settings.py
_Settings.css_files
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(".css"): js_files.append(join...
python
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(".css"): js_files.append(join...
[ "def", "css_files", "(", "self", ")", ":", "bokehjsdir", "=", "self", ".", "bokehjsdir", "(", ")", "js_files", "=", "[", "]", "for", "root", ",", "dirnames", ",", "files", "in", "os", ".", "walk", "(", "bokehjsdir", ")", ":", "for", "fname", "in", ...
The CSS files in the BokehJS directory.
[ "The", "CSS", "files", "in", "the", "BokehJS", "directory", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/settings.py#L375-L385
30,347
bokeh/bokeh
bokeh/core/json_encoder.py
serialize_json
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 particular, many datetime values are automatical...
python
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 particular, many datetime values are automatical...
[ "def", "serialize_json", "(", "obj", ",", "pretty", "=", "None", ",", "indent", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# these args to json.dumps are computed internally and should not be passed along", "for", "name", "in", "[", "'allow_nan'", ",", "'separ...
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 particular, many datetime values are automatically normalized to an expected format. Some Bokeh objects can also ...
[ "Return", "a", "serialized", "JSON", "representation", "of", "objects", "suitable", "to", "send", "to", "BokehJS", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/json_encoder.py#L85-L161
30,348
bokeh/bokeh
bokeh/core/json_encoder.py
BokehJSONEncoder.default
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 system JSON encoder. ''' from ....
python
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 system JSON encoder. ''' from ....
[ "def", "default", "(", "self", ",", "obj", ")", ":", "from", ".", ".", "model", "import", "Model", "from", ".", ".", "colors", "import", "Color", "from", ".", "has_props", "import", "HasProps", "# array types -- use force_list here, only binary", "# encoding CDS c...
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 system JSON encoder.
[ "The", "required", "default", "method", "for", "JSONEncoder", "subclasses", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/json_encoder.py#L221-L252
30,349
bokeh/bokeh
bokeh/application/application.py
Application.add
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) # make sure there is at most one stat...
python
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) # make sure there is at most one stat...
[ "def", "add", "(", "self", ",", "handler", ")", ":", "self", ".", "_handlers", ".", "append", "(", "handler", ")", "# make sure there is at most one static path", "static_paths", "=", "set", "(", "h", ".", "static_path", "(", ")", "for", "h", "in", "self", ...
Add a handler to the pipeline used to initialize new documents. Args: handler (Handler) : a handler for this Application to use to process Documents
[ "Add", "a", "handler", "to", "the", "pipeline", "used", "to", "initialize", "new", "documents", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/application/application.py#L142-L160
30,350
bokeh/bokeh
bokeh/application/application.py
Application.initialize_document
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 display. In develop mode, we want to ...
python
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 display. In develop mode, we want to ...
[ "def", "initialize_document", "(", "self", ",", "doc", ")", ":", "for", "h", "in", "self", ".", "_handlers", ":", "# TODO (havocp) we need to check the 'failed' flag on each handler", "# and build a composite error display. In develop mode, we want to", "# somehow get these errors ...
Fills in a new document using the Application's handlers.
[ "Fills", "in", "a", "new", "document", "using", "the", "Application", "s", "handlers", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/application/application.py#L170-L183
30,351
bokeh/bokeh
bokeh/application/application.py
Application.on_session_created
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 ``Future`` which will delay session creation ...
python
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 ``Future`` which will delay session creation ...
[ "def", "on_session_created", "(", "self", ",", "session_context", ")", ":", "for", "h", "in", "self", ".", "_handlers", ":", "result", "=", "h", ".", "on_session_created", "(", "session_context", ")", "yield", "yield_for_all_futures", "(", "result", ")", "rais...
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 ``Future`` which will delay session creation until the ``Future`` completes.
[ "Invoked", "to", "execute", "code", "when", "a", "new", "session", "is", "created", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/application/application.py#L211-L224
30,352
bokeh/bokeh
bokeh/models/plots.py
_select_helper
def _select_helper(args, kwargs): """ Allow flexible selector syntax. Returns: dict """ 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, ...
python
def _select_helper(args, kwargs): """ Allow flexible selector syntax. Returns: dict """ 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, ...
[ "def", "_select_helper", "(", "args", ",", "kwargs", ")", ":", "if", "len", "(", "args", ")", ">", "1", ":", "raise", "TypeError", "(", "\"select accepts at most ONE positional argument.\"", ")", "if", "len", "(", "args", ")", ">", "0", "and", "len", "(", ...
Allow flexible selector syntax. Returns: dict
[ "Allow", "flexible", "selector", "syntax", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/models/plots.py#L759-L795
30,353
bokeh/bokeh
bokeh/models/plots.py
Plot.select
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 dictionary as the single argument or as key...
python
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 dictionary as the single argument or as key...
[ "def", "select", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "selector", "=", "_select_helper", "(", "args", ",", "kwargs", ")", "# Want to pass selector that is a dictionary", "return", "_list_attr_splat", "(", "find", "(", "self", ".", ...
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 dictionary as the single argument or as keyword arguments: Args: sele...
[ "Query", "this", "object", "and", "all", "of", "its", "references", "for", "objects", "that", "match", "the", "given", "selector", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/models/plots.py#L69-L124
30,354
bokeh/bokeh
bokeh/models/plots.py
Plot.add_layout
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') Valid places are: 'left', 'right', 'above', 'b...
python
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') Valid places are: 'left', 'right', 'above', 'b...
[ "def", "add_layout", "(", "self", ",", "obj", ",", "place", "=", "'center'", ")", ":", "valid_places", "=", "[", "'left'", ",", "'right'", ",", "'above'", ",", "'below'", ",", "'center'", "]", "if", "place", "not", "in", "valid_places", ":", "raise", "...
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') Valid places are: 'left', 'right', 'above', 'below', 'center'. Returns: None
[ "Adds", "an", "object", "to", "the", "plot", "in", "a", "specified", "place", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/models/plots.py#L230-L248
30,355
bokeh/bokeh
bokeh/models/plots.py
Plot.add_tools
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): raise ValueError("All arguments to add_tool must ...
python
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): raise ValueError("All arguments to add_tool must ...
[ "def", "add_tools", "(", "self", ",", "*", "tools", ")", ":", "for", "tool", "in", "tools", ":", "if", "not", "isinstance", "(", "tool", ",", "Tool", ")", ":", "raise", "ValueError", "(", "\"All arguments to add_tool must be Tool subclasses.\"", ")", "self", ...
Adds tools to the plot. Args: *tools (Tool) : the tools to add to the Plot Returns: None
[ "Adds", "tools", "to", "the", "plot", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/models/plots.py#L250-L264
30,356
bokeh/bokeh
bokeh/models/plots.py
Plot.add_glyph
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. Args: source (DataSource) ...
python
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. Args: source (DataSource) ...
[ "def", "add_glyph", "(", "self", ",", "source_or_glyph", ",", "glyph", "=", "None", ",", "*", "*", "kw", ")", ":", "if", "glyph", "is", "not", "None", ":", "source", "=", "source_or_glyph", "else", ":", "source", ",", "glyph", "=", "ColumnDataSource", ...
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. Args: source (DataSource) : a data source for the glyphs to all use glyph (Glyph) ...
[ "Adds", "a", "glyph", "to", "the", "plot", "with", "associated", "data", "sources", "and", "ranges", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/models/plots.py#L266-L298
30,357
bokeh/bokeh
bokeh/models/plots.py
Plot.add_tile
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 arguments are passed on as-is to the tile rende...
python
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 arguments are passed on as-is to the tile rende...
[ "def", "add_tile", "(", "self", ",", "tile_source", ",", "*", "*", "kw", ")", ":", "tile_renderer", "=", "TileRenderer", "(", "tile_source", "=", "tile_source", ",", "*", "*", "kw", ")", "self", ".", "renderers", ".", "append", "(", "tile_renderer", ")",...
Adds new ``TileRenderer`` into ``Plot.renderers`` Args: tile_source (TileSource) : a tile source instance which contain tileset configuration Keyword Arguments: Additional keyword arguments are passed on as-is to the tile renderer Returns: TileRenderer : Ti...
[ "Adds", "new", "TileRenderer", "into", "Plot", ".", "renderers" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/models/plots.py#L300-L315
30,358
bokeh/bokeh
bokeh/layouts.py
layout
def layout(*args, **kwargs): """ Create a grid-based arrangement of Bokeh Layout objects. Args: children (list of lists of :class:`~bokeh.models.layouts.LayoutDOM` ): A list of lists of instances for a grid layout. Can be any of the following - :class:`~bokeh.models.plots.Plot`, ...
python
def layout(*args, **kwargs): """ Create a grid-based arrangement of Bokeh Layout objects. Args: children (list of lists of :class:`~bokeh.models.layouts.LayoutDOM` ): A list of lists of instances for a grid layout. Can be any of the following - :class:`~bokeh.models.plots.Plot`, ...
[ "def", "layout", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "sizing_mode", "=", "kwargs", ".", "pop", "(", "'sizing_mode'", ",", "None", ")", "children", "=", "kwargs", ".", "pop", "(", "'children'", ",", "None", ")", "children", "=", "_han...
Create a grid-based arrangement of Bokeh Layout objects. Args: children (list of lists of :class:`~bokeh.models.layouts.LayoutDOM` ): A list of lists of instances for a grid layout. Can be any of the following - :class:`~bokeh.models.plots.Plot`, :class:`~bokeh.models.widgets.widget...
[ "Create", "a", "grid", "-", "based", "arrangement", "of", "Bokeh", "Layout", "objects", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/layouts.py#L182-L222
30,359
bokeh/bokeh
bokeh/layouts.py
gridplot
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 single toolbar for all the plots in the grid. ...
python
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 single toolbar for all the plots in the grid. ...
[ "def", "gridplot", "(", "children", ",", "sizing_mode", "=", "None", ",", "toolbar_location", "=", "'above'", ",", "ncols", "=", "None", ",", "plot_width", "=", "None", ",", "plot_height", "=", "None", ",", "toolbar_options", "=", "None", ",", "merge_tools",...
Create a grid of plots rendered on separate canvases. The ``gridplot`` function builds a single toolbar for all the plots in the grid. ``gridplot`` is designed to layout a set of plots. For general grid layout, use the :func:`~bokeh.layouts.layout` function. Args: children (list of lists of :c...
[ "Create", "a", "grid", "of", "plots", "rendered", "on", "separate", "canvases", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/layouts.py#L224-L340
30,360
bokeh/bokeh
bokeh/layouts.py
_chunks
def _chunks(l, ncols): """Yield successive n-sized chunks from list, l.""" assert isinstance(ncols, int), "ncols must be an integer" for i in range(0, len(l), ncols): yield l[i: i+ncols]
python
def _chunks(l, ncols): """Yield successive n-sized chunks from list, l.""" assert isinstance(ncols, int), "ncols must be an integer" for i in range(0, len(l), ncols): yield l[i: i+ncols]
[ "def", "_chunks", "(", "l", ",", "ncols", ")", ":", "assert", "isinstance", "(", "ncols", ",", "int", ")", ",", "\"ncols must be an integer\"", "for", "i", "in", "range", "(", "0", ",", "len", "(", "l", ")", ",", "ncols", ")", ":", "yield", "l", "[...
Yield successive n-sized chunks from list, l.
[ "Yield", "successive", "n", "-", "sized", "chunks", "from", "list", "l", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/layouts.py#L613-L617
30,361
bokeh/bokeh
bokeh/document/locking.py
without_document_lock
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. While inside an unlocked callback, it is co...
python
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. While inside an unlocked callback, it is co...
[ "def", "without_document_lock", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kw", ")", ":", "return", "func", "(", "*", "args", ",", "*", "*", "kw", ")", "wrapper", ".", "nolock", "=",...
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. While inside an unlocked callback, it is completely *unsafe* to modify ``curdoc(...
[ "Wrap", "a", "callback", "function", "to", "execute", "without", "first", "obtaining", "the", "document", "lock", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/locking.py#L43-L73
30,362
bokeh/bokeh
bokeh/embed/server.py
server_document
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, optional) : A URL to a Bokeh app...
python
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, optional) : A URL to a Bokeh app...
[ "def", "server_document", "(", "url", "=", "\"default\"", ",", "relative_urls", "=", "False", ",", "resources", "=", "\"default\"", ",", "arguments", "=", "None", ")", ":", "url", "=", "_clean_url", "(", "url", ")", "app_path", "=", "_get_app_path", "(", "...
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, optional) : A URL to a Bokeh application on a Bokeh server (default: "default") If ``"default"`` the default URL ``{DEFAU...
[ "Return", "a", "script", "tag", "that", "embeds", "content", "from", "a", "Bokeh", "server", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/embed/server.py#L51-L110
30,363
bokeh/bokeh
bokeh/embed/server.py
server_session
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 specific session that was previously crea...
python
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 specific session that was previously crea...
[ "def", "server_session", "(", "model", "=", "None", ",", "session_id", "=", "None", ",", "url", "=", "\"default\"", ",", "relative_urls", "=", "False", ",", "resources", "=", "\"default\"", ")", ":", "if", "session_id", "is", "None", ":", "raise", "ValueEr...
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 specific session that was previously created using the ``bokeh.client`` API. Bokeh apps embedded using these methods will NOT set the browser window t...
[ "Return", "a", "script", "tag", "that", "embeds", "content", "from", "a", "specific", "existing", "session", "on", "a", "Bokeh", "server", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/embed/server.py#L112-L194
30,364
bokeh/bokeh
bokeh/embed/server.py
_clean_url
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': url = DEFAULT_SERVER_HTTP_URL i...
python
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': url = DEFAULT_SERVER_HTTP_URL i...
[ "def", "_clean_url", "(", "url", ")", ":", "if", "url", "==", "'default'", ":", "url", "=", "DEFAULT_SERVER_HTTP_URL", "if", "url", ".", "startswith", "(", "\"ws\"", ")", ":", "raise", "ValueError", "(", "\"url should be the http or https URL for the server, not the...
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
[ "Produce", "a", "canonical", "Bokeh", "server", "URL", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/embed/server.py#L236-L254
30,365
bokeh/bokeh
bokeh/embed/server.py
_get_app_path
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_path
python
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_path
[ "def", "_get_app_path", "(", "url", ")", ":", "app_path", "=", "urlparse", "(", "url", ")", ".", "path", ".", "rstrip", "(", "\"/\"", ")", "if", "not", "app_path", ".", "startswith", "(", "\"/\"", ")", ":", "app_path", "=", "\"/\"", "+", "app_path", ...
Extract the app path from a Bokeh server URL Args: url (str) : Returns: str
[ "Extract", "the", "app", "path", "from", "a", "Bokeh", "server", "URL" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/embed/server.py#L256-L269
30,366
bokeh/bokeh
bokeh/embed/server.py
_process_arguments
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 "" result = "" for key, value in argum...
python
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 "" result = "" for key, value in argum...
[ "def", "_process_arguments", "(", "arguments", ")", ":", "if", "arguments", "is", "None", ":", "return", "\"\"", "result", "=", "\"\"", "for", "key", ",", "value", "in", "arguments", ".", "items", "(", ")", ":", "if", "not", "key", ".", "startswith", "...
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
[ "Return", "user", "-", "supplied", "HTML", "arguments", "to", "add", "to", "a", "Bokeh", "server", "URL", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/embed/server.py#L271-L287
30,367
bokeh/bokeh
bokeh/server/views/ws.py
WSHandler.check_origin
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. Args: origin (str) : ...
python
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. Args: origin (str) : ...
[ "def", "check_origin", "(", "self", ",", "origin", ")", ":", "from", ".", ".", "util", "import", "check_whitelist", "parsed_origin", "=", "urlparse", "(", "origin", ")", "origin_host", "=", "parsed_origin", ".", "netloc", ".", "lower", "(", ")", "allowed_hos...
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. Args: origin (str) : The URL of the connection origin ...
[ "Implement", "a", "check_origin", "policy", "for", "Tornado", "to", "call", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/views/ws.py#L79-L108
30,368
bokeh/bokeh
bokeh/server/views/ws.py
WSHandler.open
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 None: self.close() raise...
python
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 None: self.close() raise...
[ "def", "open", "(", "self", ")", ":", "log", ".", "info", "(", "'WebSocket connection opened'", ")", "proto_version", "=", "self", ".", "get_argument", "(", "\"bokeh-protocol-version\"", ",", "default", "=", "None", ")", "if", "proto_version", "is", "None", ":...
Initialize a connection to a client. Returns: None
[ "Initialize", "a", "connection", "to", "a", "client", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/views/ws.py#L110-L144
30,369
bokeh/bokeh
bokeh/server/views/ws.py
WSHandler._async_open
def _async_open(self, session_id, proto_version): ''' Perform the specific steps needed to open a connection to a Bokeh session Specifically, this method coordinates: * Getting a session for a session ID (creating a new one if needed) * Creating a protocol receiver and hander *...
python
def _async_open(self, session_id, proto_version): ''' Perform the specific steps needed to open a connection to a Bokeh session Specifically, this method coordinates: * Getting a session for a session ID (creating a new one if needed) * Creating a protocol receiver and hander *...
[ "def", "_async_open", "(", "self", ",", "session_id", ",", "proto_version", ")", ":", "try", ":", "yield", "self", ".", "application_context", ".", "create_session_if_needed", "(", "session_id", ",", "self", ".", "request", ")", "session", "=", "self", ".", ...
Perform the specific steps needed to open a connection to a Bokeh session Specifically, this method coordinates: * Getting a session for a session ID (creating a new one if needed) * Creating a protocol receiver and hander * Opening a new ServerConnection and sending it an ACK ...
[ "Perform", "the", "specific", "steps", "needed", "to", "open", "a", "connection", "to", "a", "Bokeh", "session" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/views/ws.py#L147-L191
30,370
bokeh/bokeh
bokeh/server/views/ws.py
WSHandler.on_message
def on_message(self, fragment): ''' Process an individual wire protocol fragment. The websocket RFC specifies opcodes for distinguishing text frames from binary frames. Tornado passes us either a text or binary string depending on that opcode, we have to look at the type of the fragment...
python
def on_message(self, fragment): ''' Process an individual wire protocol fragment. The websocket RFC specifies opcodes for distinguishing text frames from binary frames. Tornado passes us either a text or binary string depending on that opcode, we have to look at the type of the fragment...
[ "def", "on_message", "(", "self", ",", "fragment", ")", ":", "# We shouldn't throw exceptions from on_message because the caller is", "# just Tornado and it doesn't know what to do with them other than", "# report them as an unhandled Future", "try", ":", "message", "=", "yield", "se...
Process an individual wire protocol fragment. The websocket RFC specifies opcodes for distinguishing text frames from binary frames. Tornado passes us either a text or binary string depending on that opcode, we have to look at the type of the fragment to see what we got. Args: ...
[ "Process", "an", "individual", "wire", "protocol", "fragment", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/views/ws.py#L194-L230
30,371
bokeh/bokeh
bokeh/server/views/ws.py
WSHandler.send_message
def send_message(self, message): ''' Send a Bokeh Server protocol message to the connected client. Args: message (Message) : a message to send ''' try: if _message_test_port is not None: _message_test_port.sent.append(message) yield m...
python
def send_message(self, message): ''' Send a Bokeh Server protocol message to the connected client. Args: message (Message) : a message to send ''' try: if _message_test_port is not None: _message_test_port.sent.append(message) yield m...
[ "def", "send_message", "(", "self", ",", "message", ")", ":", "try", ":", "if", "_message_test_port", "is", "not", "None", ":", "_message_test_port", ".", "sent", ".", "append", "(", "message", ")", "yield", "message", ".", "send", "(", "self", ")", "exc...
Send a Bokeh Server protocol message to the connected client. Args: message (Message) : a message to send
[ "Send", "a", "Bokeh", "Server", "protocol", "message", "to", "the", "connected", "client", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/views/ws.py#L243-L257
30,372
bokeh/bokeh
bokeh/server/views/ws.py
WSHandler.write_message
def write_message(self, message, binary=False, locked=True): ''' Override parent write_message with a version that acquires a write lock before writing. ''' if locked: with (yield self.write_lock.acquire()): yield super(WSHandler, self).write_message(message,...
python
def write_message(self, message, binary=False, locked=True): ''' Override parent write_message with a version that acquires a write lock before writing. ''' if locked: with (yield self.write_lock.acquire()): yield super(WSHandler, self).write_message(message,...
[ "def", "write_message", "(", "self", ",", "message", ",", "binary", "=", "False", ",", "locked", "=", "True", ")", ":", "if", "locked", ":", "with", "(", "yield", "self", ".", "write_lock", ".", "acquire", "(", ")", ")", ":", "yield", "super", "(", ...
Override parent write_message with a version that acquires a write lock before writing.
[ "Override", "parent", "write_message", "with", "a", "version", "that", "acquires", "a", "write", "lock", "before", "writing", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/views/ws.py#L260-L269
30,373
bokeh/bokeh
bokeh/server/views/ws.py
WSHandler.on_close
def on_close(self): ''' Clean up when the connection is closed. ''' log.info('WebSocket connection closed: code=%s, reason=%r', self.close_code, self.close_reason) if self.connection is not None: self.application.client_lost(self.connection)
python
def on_close(self): ''' Clean up when the connection is closed. ''' log.info('WebSocket connection closed: code=%s, reason=%r', self.close_code, self.close_reason) if self.connection is not None: self.application.client_lost(self.connection)
[ "def", "on_close", "(", "self", ")", ":", "log", ".", "info", "(", "'WebSocket connection closed: code=%s, reason=%r'", ",", "self", ".", "close_code", ",", "self", ".", "close_reason", ")", "if", "self", ".", "connection", "is", "not", "None", ":", "self", ...
Clean up when the connection is closed.
[ "Clean", "up", "when", "the", "connection", "is", "closed", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/views/ws.py#L271-L277
30,374
bokeh/bokeh
bokeh/embed/bundle.py
bundle_for_objs_and_resources
def bundle_for_objs_and_resources(objs, resources): ''' Generate rendered CSS and JS resources suitable for the given collection of Bokeh objects Args: objs (seq[Model or Document]) : resources (BaseResources or tuple[BaseResources]) Returns: tuple ''' if isinstance(r...
python
def bundle_for_objs_and_resources(objs, resources): ''' Generate rendered CSS and JS resources suitable for the given collection of Bokeh objects Args: objs (seq[Model or Document]) : resources (BaseResources or tuple[BaseResources]) Returns: tuple ''' if isinstance(r...
[ "def", "bundle_for_objs_and_resources", "(", "objs", ",", "resources", ")", ":", "if", "isinstance", "(", "resources", ",", "BaseResources", ")", ":", "js_resources", "=", "css_resources", "=", "resources", "elif", "isinstance", "(", "resources", ",", "tuple", "...
Generate rendered CSS and JS resources suitable for the given collection of Bokeh objects Args: objs (seq[Model or Document]) : resources (BaseResources or tuple[BaseResources]) Returns: tuple
[ "Generate", "rendered", "CSS", "and", "JS", "resources", "suitable", "for", "the", "given", "collection", "of", "Bokeh", "objects" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/embed/bundle.py#L50-L116
30,375
bokeh/bokeh
bokeh/embed/bundle.py
_any
def _any(objs, query): ''' Whether any of a collection of objects satisfies a given query predicate Args: objs (seq[Model or Document]) : query (callable) Returns: True, if ``query(obj)`` is True for some object in ``objs``, else False ''' for obj in objs: if isin...
python
def _any(objs, query): ''' Whether any of a collection of objects satisfies a given query predicate Args: objs (seq[Model or Document]) : query (callable) Returns: True, if ``query(obj)`` is True for some object in ``objs``, else False ''' for obj in objs: if isin...
[ "def", "_any", "(", "objs", ",", "query", ")", ":", "for", "obj", "in", "objs", ":", "if", "isinstance", "(", "obj", ",", "Document", ")", ":", "if", "_any", "(", "obj", ".", "roots", ",", "query", ")", ":", "return", "True", "else", ":", "if", ...
Whether any of a collection of objects satisfies a given query predicate Args: objs (seq[Model or Document]) : query (callable) Returns: True, if ``query(obj)`` is True for some object in ``objs``, else False
[ "Whether", "any", "of", "a", "collection", "of", "objects", "satisfies", "a", "given", "query", "predicate" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/embed/bundle.py#L134-L154
30,376
bokeh/bokeh
bokeh/embed/bundle.py
_use_gl
def _use_gl(objs): ''' Whether a collection of Bokeh objects contains a plot requesting WebGL Args: objs (seq[Model or Document]) : Returns: bool ''' from ..models.plots import Plot return _any(objs, lambda obj: isinstance(obj, Plot) and obj.output_backend == "webgl")
python
def _use_gl(objs): ''' Whether a collection of Bokeh objects contains a plot requesting WebGL Args: objs (seq[Model or Document]) : Returns: bool ''' from ..models.plots import Plot return _any(objs, lambda obj: isinstance(obj, Plot) and obj.output_backend == "webgl")
[ "def", "_use_gl", "(", "objs", ")", ":", "from", ".", ".", "models", ".", "plots", "import", "Plot", "return", "_any", "(", "objs", ",", "lambda", "obj", ":", "isinstance", "(", "obj", ",", "Plot", ")", "and", "obj", ".", "output_backend", "==", "\"w...
Whether a collection of Bokeh objects contains a plot requesting WebGL Args: objs (seq[Model or Document]) : Returns: bool
[ "Whether", "a", "collection", "of", "Bokeh", "objects", "contains", "a", "plot", "requesting", "WebGL" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/embed/bundle.py#L156-L167
30,377
bokeh/bokeh
bokeh/embed/bundle.py
_use_tables
def _use_tables(objs): ''' Whether a collection of Bokeh objects contains a TableWidget Args: objs (seq[Model or Document]) : Returns: bool ''' from ..models.widgets import TableWidget return _any(objs, lambda obj: isinstance(obj, TableWidget))
python
def _use_tables(objs): ''' Whether a collection of Bokeh objects contains a TableWidget Args: objs (seq[Model or Document]) : Returns: bool ''' from ..models.widgets import TableWidget return _any(objs, lambda obj: isinstance(obj, TableWidget))
[ "def", "_use_tables", "(", "objs", ")", ":", "from", ".", ".", "models", ".", "widgets", "import", "TableWidget", "return", "_any", "(", "objs", ",", "lambda", "obj", ":", "isinstance", "(", "obj", ",", "TableWidget", ")", ")" ]
Whether a collection of Bokeh objects contains a TableWidget Args: objs (seq[Model or Document]) : Returns: bool
[ "Whether", "a", "collection", "of", "Bokeh", "objects", "contains", "a", "TableWidget" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/embed/bundle.py#L169-L180
30,378
bokeh/bokeh
bokeh/embed/bundle.py
_use_widgets
def _use_widgets(objs): ''' Whether a collection of Bokeh objects contains a any Widget Args: objs (seq[Model or Document]) : Returns: bool ''' from ..models.widgets import Widget return _any(objs, lambda obj: isinstance(obj, Widget))
python
def _use_widgets(objs): ''' Whether a collection of Bokeh objects contains a any Widget Args: objs (seq[Model or Document]) : Returns: bool ''' from ..models.widgets import Widget return _any(objs, lambda obj: isinstance(obj, Widget))
[ "def", "_use_widgets", "(", "objs", ")", ":", "from", ".", ".", "models", ".", "widgets", "import", "Widget", "return", "_any", "(", "objs", ",", "lambda", "obj", ":", "isinstance", "(", "obj", ",", "Widget", ")", ")" ]
Whether a collection of Bokeh objects contains a any Widget Args: objs (seq[Model or Document]) : Returns: bool
[ "Whether", "a", "collection", "of", "Bokeh", "objects", "contains", "a", "any", "Widget" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/embed/bundle.py#L182-L193
30,379
bokeh/bokeh
bokeh/core/property/descriptors.py
PropertyDescriptor.add_prop_descriptor_to_class
def add_prop_descriptor_to_class(self, class_name, new_class_attrs, names_with_refs, container_names, dataspecs): ''' ``MetaHasProps`` calls this during class creation as it iterates over properties to add, to update its registry of new properties. The parameters passed in are mutable and this ...
python
def add_prop_descriptor_to_class(self, class_name, new_class_attrs, names_with_refs, container_names, dataspecs): ''' ``MetaHasProps`` calls this during class creation as it iterates over properties to add, to update its registry of new properties. The parameters passed in are mutable and this ...
[ "def", "add_prop_descriptor_to_class", "(", "self", ",", "class_name", ",", "new_class_attrs", ",", "names_with_refs", ",", "container_names", ",", "dataspecs", ")", ":", "from", ".", "bases", "import", "ContainerProperty", "from", ".", "dataspec", "import", "DataSp...
``MetaHasProps`` calls this during class creation as it iterates over properties to add, to update its registry of new properties. The parameters passed in are mutable and this function is expected to update them accordingly. Args: class_name (str) : name of...
[ "MetaHasProps", "calls", "this", "during", "class", "creation", "as", "it", "iterates", "over", "properties", "to", "add", "to", "update", "its", "registry", "of", "new", "properties", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/property/descriptors.py#L221-L267
30,380
bokeh/bokeh
bokeh/core/property/descriptors.py
PropertyDescriptor.serializable_value
def serializable_value(self, obj): ''' Produce the value as it should be serialized. Sometimes it is desirable for the serialized value to differ from the ``__get__`` in order for the ``__get__`` value to appear simpler for user or developer convenience. Args: obj (...
python
def serializable_value(self, obj): ''' Produce the value as it should be serialized. Sometimes it is desirable for the serialized value to differ from the ``__get__`` in order for the ``__get__`` value to appear simpler for user or developer convenience. Args: obj (...
[ "def", "serializable_value", "(", "self", ",", "obj", ")", ":", "value", "=", "self", ".", "__get__", "(", "obj", ",", "obj", ".", "__class__", ")", "return", "self", ".", "property", ".", "serialize_value", "(", "value", ")" ]
Produce the value as it should be serialized. Sometimes it is desirable for the serialized value to differ from the ``__get__`` in order for the ``__get__`` value to appear simpler for user or developer convenience. Args: obj (HasProps) : the object to get the serialized at...
[ "Produce", "the", "value", "as", "it", "should", "be", "serialized", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/property/descriptors.py#L281-L296
30,381
bokeh/bokeh
bokeh/core/property/descriptors.py
BasicPropertyDescriptor.instance_default
def instance_default(self, obj): ''' Get the default value that will be used for a specific instance. Args: obj (HasProps) : The instance to get the default value for. Returns: object ''' return self.property.themed_default(obj.__class__, self.name, obj...
python
def instance_default(self, obj): ''' Get the default value that will be used for a specific instance. Args: obj (HasProps) : The instance to get the default value for. Returns: object ''' return self.property.themed_default(obj.__class__, self.name, obj...
[ "def", "instance_default", "(", "self", ",", "obj", ")", ":", "return", "self", ".", "property", ".", "themed_default", "(", "obj", ".", "__class__", ",", "self", ".", "name", ",", "obj", ".", "themed_values", "(", ")", ")" ]
Get the default value that will be used for a specific instance. Args: obj (HasProps) : The instance to get the default value for. Returns: object
[ "Get", "the", "default", "value", "that", "will", "be", "used", "for", "a", "specific", "instance", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/property/descriptors.py#L577-L587
30,382
bokeh/bokeh
bokeh/core/property/descriptors.py
BasicPropertyDescriptor.trigger_if_changed
def trigger_if_changed(self, obj, old): ''' Send a change event notification if the property is set to a value is not equal to ``old``. Args: obj (HasProps) The object the property is being set on. old (obj) : The previous value of the pr...
python
def trigger_if_changed(self, obj, old): ''' Send a change event notification if the property is set to a value is not equal to ``old``. Args: obj (HasProps) The object the property is being set on. old (obj) : The previous value of the pr...
[ "def", "trigger_if_changed", "(", "self", ",", "obj", ",", "old", ")", ":", "new_value", "=", "self", ".", "__get__", "(", "obj", ",", "obj", ".", "__class__", ")", "if", "not", "self", ".", "property", ".", "matches", "(", "old", ",", "new_value", "...
Send a change event notification if the property is set to a value is not equal to ``old``. Args: obj (HasProps) The object the property is being set on. old (obj) : The previous value of the property to compare Returns: None
[ "Send", "a", "change", "event", "notification", "if", "the", "property", "is", "set", "to", "a", "value", "is", "not", "equal", "to", "old", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/property/descriptors.py#L620-L637
30,383
bokeh/bokeh
bokeh/core/property/descriptors.py
BasicPropertyDescriptor._get
def _get(self, obj): ''' Internal implementation of instance attribute access for the ``BasicPropertyDescriptor`` getter. If the value has not been explicitly set by a user, return that value. Otherwise, return the default. Args: obj (HasProps) : the instance to get...
python
def _get(self, obj): ''' Internal implementation of instance attribute access for the ``BasicPropertyDescriptor`` getter. If the value has not been explicitly set by a user, return that value. Otherwise, return the default. Args: obj (HasProps) : the instance to get...
[ "def", "_get", "(", "self", ",", "obj", ")", ":", "if", "not", "hasattr", "(", "obj", ",", "'_property_values'", ")", ":", "raise", "RuntimeError", "(", "\"Cannot get a property value '%s' from a %s instance before HasProps.__init__\"", "%", "(", "self", ".", "name"...
Internal implementation of instance attribute access for the ``BasicPropertyDescriptor`` getter. If the value has not been explicitly set by a user, return that value. Otherwise, return the default. Args: obj (HasProps) : the instance to get a value of this property for ...
[ "Internal", "implementation", "of", "instance", "attribute", "access", "for", "the", "BasicPropertyDescriptor", "getter", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/property/descriptors.py#L671-L697
30,384
bokeh/bokeh
bokeh/core/property/descriptors.py
BasicPropertyDescriptor._get_default
def _get_default(self, obj): ''' Internal implementation of instance attribute access for default values. Handles bookeeping around |PropertyContainer| value, etc. ''' if self.name in obj._property_values: # this shouldn't happen because we should have checked befor...
python
def _get_default(self, obj): ''' Internal implementation of instance attribute access for default values. Handles bookeeping around |PropertyContainer| value, etc. ''' if self.name in obj._property_values: # this shouldn't happen because we should have checked befor...
[ "def", "_get_default", "(", "self", ",", "obj", ")", ":", "if", "self", ".", "name", "in", "obj", ".", "_property_values", ":", "# this shouldn't happen because we should have checked before _get_default()", "raise", "RuntimeError", "(", "\"Bokeh internal error, does not ha...
Internal implementation of instance attribute access for default values. Handles bookeeping around |PropertyContainer| value, etc.
[ "Internal", "implementation", "of", "instance", "attribute", "access", "for", "default", "values", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/property/descriptors.py#L699-L727
30,385
bokeh/bokeh
bokeh/core/property/descriptors.py
BasicPropertyDescriptor._real_set
def _real_set(self, obj, old, value, hint=None, setter=None): ''' Internal implementation helper to set property values. This function handles bookkeeping around noting whether values have been explicitly set, etc. Args: obj (HasProps) The object the propert...
python
def _real_set(self, obj, old, value, hint=None, setter=None): ''' Internal implementation helper to set property values. This function handles bookkeeping around noting whether values have been explicitly set, etc. Args: obj (HasProps) The object the propert...
[ "def", "_real_set", "(", "self", ",", "obj", ",", "old", ",", "value", ",", "hint", "=", "None", ",", "setter", "=", "None", ")", ":", "# Normally we want a \"no-op\" if the new value and old value are identical", "# but some hinted events are in-place. This check will allo...
Internal implementation helper to set property values. This function handles bookkeeping around noting whether values have been explicitly set, etc. Args: obj (HasProps) The object the property is being set on. old (obj) : The previous v...
[ "Internal", "implementation", "helper", "to", "set", "property", "values", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/property/descriptors.py#L771-L838
30,386
bokeh/bokeh
bokeh/core/property/descriptors.py
BasicPropertyDescriptor._notify_mutated
def _notify_mutated(self, obj, old, hint=None): ''' A method to call when a container is mutated "behind our back" and we detect it with our |PropertyContainer| wrappers. Args: obj (HasProps) : The object who's container value was mutated old (object) : ...
python
def _notify_mutated(self, obj, old, hint=None): ''' A method to call when a container is mutated "behind our back" and we detect it with our |PropertyContainer| wrappers. Args: obj (HasProps) : The object who's container value was mutated old (object) : ...
[ "def", "_notify_mutated", "(", "self", ",", "obj", ",", "old", ",", "hint", "=", "None", ")", ":", "value", "=", "self", ".", "__get__", "(", "obj", ",", "obj", ".", "__class__", ")", "# re-validate because the contents of 'old' have changed,", "# in some cases ...
A method to call when a container is mutated "behind our back" and we detect it with our |PropertyContainer| wrappers. Args: obj (HasProps) : The object who's container value was mutated old (object) : The "old" value of the container ...
[ "A", "method", "to", "call", "when", "a", "container", "is", "mutated", "behind", "our", "back", "and", "we", "detect", "it", "with", "our", "|PropertyContainer|", "wrappers", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/property/descriptors.py#L842-L875
30,387
bokeh/bokeh
bokeh/core/property/descriptors.py
BasicPropertyDescriptor._trigger
def _trigger(self, obj, old, value, hint=None, setter=None): ''' Unconditionally send a change event notification for the property. Args: obj (HasProps) The object the property is being set on. old (obj) : The previous value of the property ...
python
def _trigger(self, obj, old, value, hint=None, setter=None): ''' Unconditionally send a change event notification for the property. Args: obj (HasProps) The object the property is being set on. old (obj) : The previous value of the property ...
[ "def", "_trigger", "(", "self", ",", "obj", ",", "old", ",", "value", ",", "hint", "=", "None", ",", "setter", "=", "None", ")", ":", "if", "hasattr", "(", "obj", ",", "'trigger'", ")", ":", "obj", ".", "trigger", "(", "self", ".", "name", ",", ...
Unconditionally send a change event notification for the property. Args: obj (HasProps) The object the property is being set on. old (obj) : The previous value of the property new (obj) : The new value of the property ...
[ "Unconditionally", "send", "a", "change", "event", "notification", "for", "the", "property", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/property/descriptors.py#L877-L915
30,388
bokeh/bokeh
bokeh/core/property/descriptors.py
UnitsSpecPropertyDescriptor._extract_units
def _extract_units(self, obj, value): ''' Internal helper for dealing with units associated units properties when setting values on |UnitsSpec| properties. When ``value`` is a dict, this function may mutate the value of the associated units property. Args: obj (HasP...
python
def _extract_units(self, obj, value): ''' Internal helper for dealing with units associated units properties when setting values on |UnitsSpec| properties. When ``value`` is a dict, this function may mutate the value of the associated units property. Args: obj (HasP...
[ "def", "_extract_units", "(", "self", ",", "obj", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "dict", ")", ":", "if", "'units'", "in", "value", ":", "value", "=", "copy", "(", "value", ")", "# so we can modify it", "units", "=", "val...
Internal helper for dealing with units associated units properties when setting values on |UnitsSpec| properties. When ``value`` is a dict, this function may mutate the value of the associated units property. Args: obj (HasProps) : instance to update units spec property val...
[ "Internal", "helper", "for", "dealing", "with", "units", "associated", "units", "properties", "when", "setting", "values", "on", "|UnitsSpec|", "properties", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/property/descriptors.py#L1128-L1150
30,389
bokeh/bokeh
bokeh/io/notebook.py
install_notebook_hook
def install_notebook_hook(notebook_type, load, show_doc, show_app, overwrite=False): ''' Install a new notebook display hook. Bokeh comes with support for Jupyter notebooks built-in. However, there are other kinds of notebooks in use by different communities. This function provides a mechanism for othe...
python
def install_notebook_hook(notebook_type, load, show_doc, show_app, overwrite=False): ''' Install a new notebook display hook. Bokeh comes with support for Jupyter notebooks built-in. However, there are other kinds of notebooks in use by different communities. This function provides a mechanism for othe...
[ "def", "install_notebook_hook", "(", "notebook_type", ",", "load", ",", "show_doc", ",", "show_app", ",", "overwrite", "=", "False", ")", ":", "if", "notebook_type", "in", "_HOOKS", "and", "not", "overwrite", ":", "raise", "RuntimeError", "(", "\"hook for notebo...
Install a new notebook display hook. Bokeh comes with support for Jupyter notebooks built-in. However, there are other kinds of notebooks in use by different communities. This function provides a mechanism for other projects to instruct Bokeh how to display content in other notebooks. This functio...
[ "Install", "a", "new", "notebook", "display", "hook", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/io/notebook.py#L112-L189
30,390
bokeh/bokeh
bokeh/io/notebook.py
push_notebook
def push_notebook(document=None, state=None, handle=None): ''' Update Bokeh plots in a Jupyter notebook output cells with new data or property values. When working the the notebook, the ``show`` function can be passed the argument ``notebook_handle=True``, which will cause it to return a handle obj...
python
def push_notebook(document=None, state=None, handle=None): ''' Update Bokeh plots in a Jupyter notebook output cells with new data or property values. When working the the notebook, the ``show`` function can be passed the argument ``notebook_handle=True``, which will cause it to return a handle obj...
[ "def", "push_notebook", "(", "document", "=", "None", ",", "state", "=", "None", ",", "handle", "=", "None", ")", ":", "from", ".", ".", "protocol", "import", "Protocol", "if", "state", "is", "None", ":", "state", "=", "curstate", "(", ")", "if", "no...
Update Bokeh plots in a Jupyter notebook output cells with new data or property values. When working the the notebook, the ``show`` function can be passed the argument ``notebook_handle=True``, which will cause it to return a handle object that can be used to update the Bokeh output later. When ``p...
[ "Update", "Bokeh", "plots", "in", "a", "Jupyter", "notebook", "output", "cells", "with", "new", "data", "or", "property", "values", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/io/notebook.py#L191-L275
30,391
bokeh/bokeh
bokeh/io/notebook.py
run_notebook_hook
def run_notebook_hook(notebook_type, action, *args, **kw): ''' Run an installed notebook hook with supplied arguments. Args: noteboook_type (str) : Name of an existing installed notebook hook actions (str) : Name of the hook action to execute, ``'doc'`` or ``'app'`` ...
python
def run_notebook_hook(notebook_type, action, *args, **kw): ''' Run an installed notebook hook with supplied arguments. Args: noteboook_type (str) : Name of an existing installed notebook hook actions (str) : Name of the hook action to execute, ``'doc'`` or ``'app'`` ...
[ "def", "run_notebook_hook", "(", "notebook_type", ",", "action", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "if", "notebook_type", "not", "in", "_HOOKS", ":", "raise", "RuntimeError", "(", "\"no display hook installed for notebook type %r\"", "%", "notebook_...
Run an installed notebook hook with supplied arguments. Args: noteboook_type (str) : Name of an existing installed notebook hook actions (str) : Name of the hook action to execute, ``'doc'`` or ``'app'`` All other arguments and keyword arguments are passed to the hook ...
[ "Run", "an", "installed", "notebook", "hook", "with", "supplied", "arguments", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/io/notebook.py#L277-L302
30,392
bokeh/bokeh
bokeh/io/notebook.py
destroy_server
def destroy_server(server_id): ''' Given a UUID id of a div removed or replaced in the Jupyter notebook, destroy the corresponding server sessions and stop it. ''' server = curstate().uuid_to_server.get(server_id, None) if server is None: log.debug("No server instance found for uuid: %r" % ...
python
def destroy_server(server_id): ''' Given a UUID id of a div removed or replaced in the Jupyter notebook, destroy the corresponding server sessions and stop it. ''' server = curstate().uuid_to_server.get(server_id, None) if server is None: log.debug("No server instance found for uuid: %r" % ...
[ "def", "destroy_server", "(", "server_id", ")", ":", "server", "=", "curstate", "(", ")", ".", "uuid_to_server", ".", "get", "(", "server_id", ",", "None", ")", "if", "server", "is", "None", ":", "log", ".", "debug", "(", "\"No server instance found for uuid...
Given a UUID id of a div removed or replaced in the Jupyter notebook, destroy the corresponding server sessions and stop it.
[ "Given", "a", "UUID", "id", "of", "a", "div", "removed", "or", "replaced", "in", "the", "Jupyter", "notebook", "destroy", "the", "corresponding", "server", "sessions", "and", "stop", "it", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/io/notebook.py#L308-L325
30,393
bokeh/bokeh
bokeh/io/notebook.py
load_notebook
def load_notebook(resources=None, verbose=False, hide_banner=False, load_timeout=5000): ''' Prepare the IPython notebook for displaying Bokeh plots. Args: resources (Resource, optional) : how and where to load BokehJS from (default: CDN) verbose (bool, optional) : wheth...
python
def load_notebook(resources=None, verbose=False, hide_banner=False, load_timeout=5000): ''' Prepare the IPython notebook for displaying Bokeh plots. Args: resources (Resource, optional) : how and where to load BokehJS from (default: CDN) verbose (bool, optional) : wheth...
[ "def", "load_notebook", "(", "resources", "=", "None", ",", "verbose", "=", "False", ",", "hide_banner", "=", "False", ",", "load_timeout", "=", "5000", ")", ":", "global", "_NOTEBOOK_LOADED", "from", ".", ".", "import", "__version__", "from", ".", ".", "c...
Prepare the IPython notebook for displaying Bokeh plots. Args: resources (Resource, optional) : how and where to load BokehJS from (default: CDN) verbose (bool, optional) : whether to report detailed settings (default: False) hide_banner (bool, optional): ...
[ "Prepare", "the", "IPython", "notebook", "for", "displaying", "Bokeh", "plots", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/io/notebook.py#L348-L423
30,394
bokeh/bokeh
bokeh/io/notebook.py
show_app
def show_app(app, state, notebook_url, port=0, **kw): ''' Embed a Bokeh server application in a Jupyter Notebook output cell. Args: app (Application or callable) : A Bokeh Application to embed inline in a Jupyter notebook. state (State) : ** Unused ** notebook_...
python
def show_app(app, state, notebook_url, port=0, **kw): ''' Embed a Bokeh server application in a Jupyter Notebook output cell. Args: app (Application or callable) : A Bokeh Application to embed inline in a Jupyter notebook. state (State) : ** Unused ** notebook_...
[ "def", "show_app", "(", "app", ",", "state", ",", "notebook_url", ",", "port", "=", "0", ",", "*", "*", "kw", ")", ":", "logging", ".", "basicConfig", "(", ")", "from", "tornado", ".", "ioloop", "import", "IOLoop", "from", ".", ".", "server", ".", ...
Embed a Bokeh server application in a Jupyter Notebook output cell. Args: app (Application or callable) : A Bokeh Application to embed inline in a Jupyter notebook. state (State) : ** Unused ** notebook_url (str or callable) : The URL of the notebook se...
[ "Embed", "a", "Bokeh", "server", "application", "in", "a", "Jupyter", "Notebook", "output", "cell", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/io/notebook.py#L433-L501
30,395
bokeh/bokeh
bokeh/colors/color.py
Color.clamp
def clamp(value, maximum=None): ''' Clamp numeric values to be non-negative, an optionally, less than a given maximum. Args: value (float) : A number to clamp. maximum (float, optional) : A max bound to to clamp to. If None, there is no u...
python
def clamp(value, maximum=None): ''' Clamp numeric values to be non-negative, an optionally, less than a given maximum. Args: value (float) : A number to clamp. maximum (float, optional) : A max bound to to clamp to. If None, there is no u...
[ "def", "clamp", "(", "value", ",", "maximum", "=", "None", ")", ":", "value", "=", "max", "(", "value", ",", "0", ")", "if", "maximum", "is", "not", "None", ":", "return", "min", "(", "value", ",", "maximum", ")", "else", ":", "return", "value" ]
Clamp numeric values to be non-negative, an optionally, less than a given maximum. Args: value (float) : A number to clamp. maximum (float, optional) : A max bound to to clamp to. If None, there is no upper bound, and values are o...
[ "Clamp", "numeric", "values", "to", "be", "non", "-", "negative", "an", "optionally", "less", "than", "a", "given", "maximum", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/colors/color.py#L50-L71
30,396
bokeh/bokeh
bokeh/models/widgets/buttons.py
Dropdown.on_click
def on_click(self, handler): ''' Set up a handler for button or menu item clicks. Args: handler (func) : handler function to call when button is activated. Returns: None ''' self.on_event(ButtonClick, handler) self.on_event(MenuItemClick, handle...
python
def on_click(self, handler): ''' Set up a handler for button or menu item clicks. Args: handler (func) : handler function to call when button is activated. Returns: None ''' self.on_event(ButtonClick, handler) self.on_event(MenuItemClick, handle...
[ "def", "on_click", "(", "self", ",", "handler", ")", ":", "self", ".", "on_event", "(", "ButtonClick", ",", "handler", ")", "self", ".", "on_event", "(", "MenuItemClick", ",", "handler", ")" ]
Set up a handler for button or menu item clicks. Args: handler (func) : handler function to call when button is activated. Returns: None
[ "Set", "up", "a", "handler", "for", "button", "or", "menu", "item", "clicks", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/models/widgets/buttons.py#L160-L171
30,397
bokeh/bokeh
bokeh/models/widgets/buttons.py
Dropdown.js_on_click
def js_on_click(self, handler): ''' Set up a JavaScript handler for button or menu item clicks. ''' self.js_on_event(ButtonClick, handler) self.js_on_event(MenuItemClick, handler)
python
def js_on_click(self, handler): ''' Set up a JavaScript handler for button or menu item clicks. ''' self.js_on_event(ButtonClick, handler) self.js_on_event(MenuItemClick, handler)
[ "def", "js_on_click", "(", "self", ",", "handler", ")", ":", "self", ".", "js_on_event", "(", "ButtonClick", ",", "handler", ")", "self", ".", "js_on_event", "(", "MenuItemClick", ",", "handler", ")" ]
Set up a JavaScript handler for button or menu item clicks.
[ "Set", "up", "a", "JavaScript", "handler", "for", "button", "or", "menu", "item", "clicks", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/models/widgets/buttons.py#L173-L176
30,398
bokeh/bokeh
bokeh/util/dependencies.py
import_optional
def import_optional(mod_name): ''' Attempt to import an optional dependency. Silently returns None if the requested module is not available. Args: mod_name (str) : name of the optional module to try to import Returns: imported module or None, if import fails ''' try: ...
python
def import_optional(mod_name): ''' Attempt to import an optional dependency. Silently returns None if the requested module is not available. Args: mod_name (str) : name of the optional module to try to import Returns: imported module or None, if import fails ''' try: ...
[ "def", "import_optional", "(", "mod_name", ")", ":", "try", ":", "return", "import_module", "(", "mod_name", ")", "except", "ImportError", ":", "pass", "except", "Exception", ":", "msg", "=", "\"Failed to import optional module `{}`\"", ".", "format", "(", "mod_na...
Attempt to import an optional dependency. Silently returns None if the requested module is not available. Args: mod_name (str) : name of the optional module to try to import Returns: imported module or None, if import fails
[ "Attempt", "to", "import", "an", "optional", "dependency", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/dependencies.py#L50-L68
30,399
bokeh/bokeh
bokeh/util/dependencies.py
detect_phantomjs
def detect_phantomjs(version='2.1'): ''' Detect if PhantomJS is avaiable in PATH, at a minimum version. Args: version (str, optional) : Required minimum version for PhantomJS (mostly for testing) Returns: str, path to PhantomJS ''' if settings.phantomjs_path() is not N...
python
def detect_phantomjs(version='2.1'): ''' Detect if PhantomJS is avaiable in PATH, at a minimum version. Args: version (str, optional) : Required minimum version for PhantomJS (mostly for testing) Returns: str, path to PhantomJS ''' if settings.phantomjs_path() is not N...
[ "def", "detect_phantomjs", "(", "version", "=", "'2.1'", ")", ":", "if", "settings", ".", "phantomjs_path", "(", ")", "is", "not", "None", ":", "phantomjs_path", "=", "settings", ".", "phantomjs_path", "(", ")", "else", ":", "if", "hasattr", "(", "shutil",...
Detect if PhantomJS is avaiable in PATH, at a minimum version. Args: version (str, optional) : Required minimum version for PhantomJS (mostly for testing) Returns: str, path to PhantomJS
[ "Detect", "if", "PhantomJS", "is", "avaiable", "in", "PATH", "at", "a", "minimum", "version", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/dependencies.py#L91-L128