repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
bokeh/bokeh
bokeh/driving.py
sine
def sine(w, A=1, phi=0, offset=0): ''' Return a driver function that can advance a sequence of sine values. .. code-block:: none value = A * sin(w*i + phi) + offset Args: w (float) : a frequency for the sine driver A (float) : an amplitude for the sine driver phi (float) :...
python
def sine(w, A=1, phi=0, offset=0): ''' Return a driver function that can advance a sequence of sine values. .. code-block:: none value = A * sin(w*i + phi) + offset Args: w (float) : a frequency for the sine driver A (float) : an amplitude for the sine driver phi (float) :...
[ "def", "sine", "(", "w", ",", "A", "=", "1", ",", "phi", "=", "0", ",", "offset", "=", "0", ")", ":", "from", "math", "import", "sin", "def", "f", "(", "i", ")", ":", "return", "A", "*", "sin", "(", "w", "*", "i", "+", "phi", ")", "+", ...
Return a driver function that can advance a sequence of sine values. .. code-block:: none value = A * sin(w*i + phi) + offset Args: w (float) : a frequency for the sine driver A (float) : an amplitude for the sine driver phi (float) : a phase offset to start the sine driver wi...
[ "Return", "a", "driver", "function", "that", "can", "advance", "a", "sequence", "of", "sine", "values", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/driving.py#L171-L188
train
bokeh/bokeh
bokeh/sphinxext/collapsible_code_block.py
setup
def setup(app): ''' Required Sphinx extension setup function. ''' app.add_node( collapsible_code_block, html=( html_visit_collapsible_code_block, html_depart_collapsible_code_block ) ) app.add_directive('collapsible-code-block', CollapsibleCodeBlock)
python
def setup(app): ''' Required Sphinx extension setup function. ''' app.add_node( collapsible_code_block, html=( html_visit_collapsible_code_block, html_depart_collapsible_code_block ) ) app.add_directive('collapsible-code-block', CollapsibleCodeBlock)
[ "def", "setup", "(", "app", ")", ":", "app", ".", "add_node", "(", "collapsible_code_block", ",", "html", "=", "(", "html_visit_collapsible_code_block", ",", "html_depart_collapsible_code_block", ")", ")", "app", ".", "add_directive", "(", "'collapsible-code-block'", ...
Required Sphinx extension setup function.
[ "Required", "Sphinx", "extension", "setup", "function", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/sphinxext/collapsible_code_block.py#L125-L134
train
bokeh/bokeh
bokeh/model.py
collect_filtered_models
def collect_filtered_models(discard, *input_values): ''' Collect a duplicate-free list of all other Bokeh models referred to by this model, or by any of its references, etc, unless filtered-out by the provided callable. Iterate over ``input_values`` and descend through their structure collecting al...
python
def collect_filtered_models(discard, *input_values): ''' Collect a duplicate-free list of all other Bokeh models referred to by this model, or by any of its references, etc, unless filtered-out by the provided callable. Iterate over ``input_values`` and descend through their structure collecting al...
[ "def", "collect_filtered_models", "(", "discard", ",", "*", "input_values", ")", ":", "ids", "=", "set", "(", "[", "]", ")", "collected", "=", "[", "]", "queued", "=", "[", "]", "def", "queue_one", "(", "obj", ")", ":", "if", "obj", ".", "id", "not...
Collect a duplicate-free list of all other Bokeh models referred to by this model, or by any of its references, etc, unless filtered-out by the provided callable. Iterate over ``input_values`` and descend through their structure collecting all nested ``Models`` on the go. Args: *discard (C...
[ "Collect", "a", "duplicate", "-", "free", "list", "of", "all", "other", "Bokeh", "models", "referred", "to", "by", "this", "model", "or", "by", "any", "of", "its", "references", "etc", "unless", "filtered", "-", "out", "by", "the", "provided", "callable", ...
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/model.py#L62-L103
train
bokeh/bokeh
bokeh/model.py
get_class
def get_class(view_model_name): ''' Look up a Bokeh model class, given its view model name. Args: view_model_name (str) : A view model name for a Bokeh model to look up Returns: Model: the model class corresponding to ``view_model_name`` Raises: KeyError, if the mo...
python
def get_class(view_model_name): ''' Look up a Bokeh model class, given its view model name. Args: view_model_name (str) : A view model name for a Bokeh model to look up Returns: Model: the model class corresponding to ``view_model_name`` Raises: KeyError, if the mo...
[ "def", "get_class", "(", "view_model_name", ")", ":", "# in order to look up from the model catalog that MetaModel maintains, it", "# has to be creates first. These imports ensure that all built-in Bokeh", "# models are represented in the catalog.", "from", ".", "import", "models", "models...
Look up a Bokeh model class, given its view model name. Args: view_model_name (str) : A view model name for a Bokeh model to look up Returns: Model: the model class corresponding to ``view_model_name`` Raises: KeyError, if the model cannot be found Example: ...
[ "Look", "up", "a", "Bokeh", "model", "class", "given", "its", "view", "model", "name", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/model.py#L123-L156
train
bokeh/bokeh
bokeh/model.py
_visit_immediate_value_references
def _visit_immediate_value_references(value, visitor): ''' Visit all references to another Model without recursing into any of the child Model; may visit the same Model more than once if it's referenced more than once. Does not visit the passed-in value. ''' if isinstance(value, HasProps): ...
python
def _visit_immediate_value_references(value, visitor): ''' Visit all references to another Model without recursing into any of the child Model; may visit the same Model more than once if it's referenced more than once. Does not visit the passed-in value. ''' if isinstance(value, HasProps): ...
[ "def", "_visit_immediate_value_references", "(", "value", ",", "visitor", ")", ":", "if", "isinstance", "(", "value", ",", "HasProps", ")", ":", "for", "attr", "in", "value", ".", "properties_with_refs", "(", ")", ":", "child", "=", "getattr", "(", "value", ...
Visit all references to another Model without recursing into any of the child Model; may visit the same Model more than once if it's referenced more than once. Does not visit the passed-in value.
[ "Visit", "all", "references", "to", "another", "Model", "without", "recursing", "into", "any", "of", "the", "child", "Model", ";", "may", "visit", "the", "same", "Model", "more", "than", "once", "if", "it", "s", "referenced", "more", "than", "once", ".", ...
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/model.py#L822-L833
train
bokeh/bokeh
bokeh/model.py
_visit_value_and_its_immediate_references
def _visit_value_and_its_immediate_references(obj, visitor): ''' Recurse down Models, HasProps, and Python containers The ordering in this function is to optimize performance. We check the most comomn types (int, float, str) first so that we can quickly return in the common case. We avoid isinstance ...
python
def _visit_value_and_its_immediate_references(obj, visitor): ''' Recurse down Models, HasProps, and Python containers The ordering in this function is to optimize performance. We check the most comomn types (int, float, str) first so that we can quickly return in the common case. We avoid isinstance ...
[ "def", "_visit_value_and_its_immediate_references", "(", "obj", ",", "visitor", ")", ":", "typ", "=", "type", "(", "obj", ")", "if", "typ", "in", "_common_types", ":", "# short circuit on common base types", "return", "if", "typ", "is", "list", "or", "issubclass",...
Recurse down Models, HasProps, and Python containers The ordering in this function is to optimize performance. We check the most comomn types (int, float, str) first so that we can quickly return in the common case. We avoid isinstance and issubclass checks in a couple places with `type` checks becau...
[ "Recurse", "down", "Models", "HasProps", "and", "Python", "containers" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/model.py#L838-L861
train
bokeh/bokeh
bokeh/model.py
Model.ref
def ref(self): ''' A Bokeh protocol "reference" to this model, i.e. a dict of the form: .. code-block:: python { 'type' : << view model name >> 'id' : << unique model id >> } Additionally there may be a `subtype` field if this ...
python
def ref(self): ''' A Bokeh protocol "reference" to this model, i.e. a dict of the form: .. code-block:: python { 'type' : << view model name >> 'id' : << unique model id >> } Additionally there may be a `subtype` field if this ...
[ "def", "ref", "(", "self", ")", ":", "if", "\"__subtype__\"", "in", "self", ".", "__class__", ".", "__dict__", ":", "return", "{", "'type'", ":", "self", ".", "__view_model__", ",", "'subtype'", ":", "self", ".", "__subtype__", ",", "'id'", ":", "self", ...
A Bokeh protocol "reference" to this model, i.e. a dict of the form: .. code-block:: python { 'type' : << view model name >> 'id' : << unique model id >> } Additionally there may be a `subtype` field if this model is a subtype.
[ "A", "Bokeh", "protocol", "reference", "to", "this", "model", "i", ".", "e", ".", "a", "dict", "of", "the", "form", ":" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/model.py#L407-L431
train
bokeh/bokeh
bokeh/model.py
Model.js_link
def js_link(self, attr, other, other_attr): ''' Link two Bokeh model properties using JavaScript. This is a convenience method that simplifies adding a CustomJS callback to update one Bokeh model property whenever another changes value. Args: attr (str) : T...
python
def js_link(self, attr, other, other_attr): ''' Link two Bokeh model properties using JavaScript. This is a convenience method that simplifies adding a CustomJS callback to update one Bokeh model property whenever another changes value. Args: attr (str) : T...
[ "def", "js_link", "(", "self", ",", "attr", ",", "other", ",", "other_attr", ")", ":", "if", "attr", "not", "in", "self", ".", "properties", "(", ")", ":", "raise", "ValueError", "(", "\"%r is not a property of self (%r)\"", "%", "(", "attr", ",", "self", ...
Link two Bokeh model properties using JavaScript. This is a convenience method that simplifies adding a CustomJS callback to update one Bokeh model property whenever another changes value. Args: attr (str) : The name of a Bokeh property on this model o...
[ "Link", "two", "Bokeh", "model", "properties", "using", "JavaScript", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/model.py#L449-L504
train
bokeh/bokeh
bokeh/model.py
Model.js_on_change
def js_on_change(self, event, *callbacks): ''' Attach a ``CustomJS`` callback to an arbitrary BokehJS model event. On the BokehJS side, change events for model properties have the form ``"change:property_name"``. As a convenience, if the event name passed to this method is also the name...
python
def js_on_change(self, event, *callbacks): ''' Attach a ``CustomJS`` callback to an arbitrary BokehJS model event. On the BokehJS side, change events for model properties have the form ``"change:property_name"``. As a convenience, if the event name passed to this method is also the name...
[ "def", "js_on_change", "(", "self", ",", "event", ",", "*", "callbacks", ")", ":", "if", "len", "(", "callbacks", ")", "==", "0", ":", "raise", "ValueError", "(", "\"js_on_change takes an event name and one or more callbacks, got only one parameter\"", ")", "# handle ...
Attach a ``CustomJS`` callback to an arbitrary BokehJS model event. On the BokehJS side, change events for model properties have the form ``"change:property_name"``. As a convenience, if the event name passed to this method is also the name of a property on the model, then it will be pr...
[ "Attach", "a", "CustomJS", "callback", "to", "an", "arbitrary", "BokehJS", "model", "event", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/model.py#L506-L546
train
bokeh/bokeh
bokeh/model.py
Model.on_change
def on_change(self, attr, *callbacks): ''' Add a callback on this object to trigger when ``attr`` changes. Args: attr (str) : an attribute name on this object *callbacks (callable) : callback functions to register Returns: None Example: .. ...
python
def on_change(self, attr, *callbacks): ''' Add a callback on this object to trigger when ``attr`` changes. Args: attr (str) : an attribute name on this object *callbacks (callable) : callback functions to register Returns: None Example: .. ...
[ "def", "on_change", "(", "self", ",", "attr", ",", "*", "callbacks", ")", ":", "if", "attr", "not", "in", "self", ".", "properties", "(", ")", ":", "raise", "ValueError", "(", "\"attempted to add a callback on nonexistent %s.%s property\"", "%", "(", "self", "...
Add a callback on this object to trigger when ``attr`` changes. Args: attr (str) : an attribute name on this object *callbacks (callable) : callback functions to register Returns: None Example: .. code-block:: python widget.on_change('...
[ "Add", "a", "callback", "on", "this", "object", "to", "trigger", "when", "attr", "changes", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/model.py#L557-L576
train
bokeh/bokeh
bokeh/model.py
Model.set_select
def set_select(self, selector, updates): ''' Update objects that match a given selector with the specified attribute/value updates. Args: selector (JSON-like) : updates (dict) : Returns: None ''' for obj in self.select(selector): ...
python
def set_select(self, selector, updates): ''' Update objects that match a given selector with the specified attribute/value updates. Args: selector (JSON-like) : updates (dict) : Returns: None ''' for obj in self.select(selector): ...
[ "def", "set_select", "(", "self", ",", "selector", ",", "updates", ")", ":", "for", "obj", "in", "self", ".", "select", "(", "selector", ")", ":", "for", "key", ",", "val", "in", "updates", ".", "items", "(", ")", ":", "setattr", "(", "obj", ",", ...
Update objects that match a given selector with the specified attribute/value updates. Args: selector (JSON-like) : updates (dict) : Returns: None
[ "Update", "objects", "that", "match", "a", "given", "selector", "with", "the", "specified", "attribute", "/", "value", "updates", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/model.py#L614-L628
train
bokeh/bokeh
bokeh/model.py
Model.to_json_string
def to_json_string(self, include_defaults): ''' Returns a JSON string encoding the attributes of this object. References to other objects are serialized as references (just the object ID and type info), so the deserializer will need to separately have the full attributes of those ...
python
def to_json_string(self, include_defaults): ''' Returns a JSON string encoding the attributes of this object. References to other objects are serialized as references (just the object ID and type info), so the deserializer will need to separately have the full attributes of those ...
[ "def", "to_json_string", "(", "self", ",", "include_defaults", ")", ":", "json_like", "=", "self", ".", "_to_json_like", "(", "include_defaults", "=", "include_defaults", ")", "json_like", "[", "'id'", "]", "=", "self", ".", "id", "# serialize_json \"fixes\" the J...
Returns a JSON string encoding the attributes of this object. References to other objects are serialized as references (just the object ID and type info), so the deserializer will need to separately have the full attributes of those other objects. There's no corresponding ``fro...
[ "Returns", "a", "JSON", "string", "encoding", "the", "attributes", "of", "this", "object", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/model.py#L654-L679
train
bokeh/bokeh
bokeh/model.py
Model._attach_document
def _attach_document(self, doc): ''' Attach a model to a Bokeh |Document|. This private interface should only ever called by the Document implementation to set the private ._document field properly ''' if self._document is not None and self._document is not doc: rai...
python
def _attach_document(self, doc): ''' Attach a model to a Bokeh |Document|. This private interface should only ever called by the Document implementation to set the private ._document field properly ''' if self._document is not None and self._document is not doc: rai...
[ "def", "_attach_document", "(", "self", ",", "doc", ")", ":", "if", "self", ".", "_document", "is", "not", "None", "and", "self", ".", "_document", "is", "not", "doc", ":", "raise", "RuntimeError", "(", "\"Models must be owned by only a single document, %r is alre...
Attach a model to a Bokeh |Document|. This private interface should only ever called by the Document implementation to set the private ._document field properly
[ "Attach", "a", "model", "to", "a", "Bokeh", "|Document|", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/model.py#L704-L715
train
bokeh/bokeh
bokeh/model.py
Model._to_json_like
def _to_json_like(self, include_defaults): ''' Returns a dictionary of the attributes of this object, in a layout corresponding to what BokehJS expects at unmarshalling time. This method does not convert "Bokeh types" into "plain JSON types," for example each child Model will still be a...
python
def _to_json_like(self, include_defaults): ''' Returns a dictionary of the attributes of this object, in a layout corresponding to what BokehJS expects at unmarshalling time. This method does not convert "Bokeh types" into "plain JSON types," for example each child Model will still be a...
[ "def", "_to_json_like", "(", "self", ",", "include_defaults", ")", ":", "all_attrs", "=", "self", ".", "properties_with_values", "(", "include_defaults", "=", "include_defaults", ")", "# If __subtype__ is defined, then this model may introduce properties", "# that don't exist o...
Returns a dictionary of the attributes of this object, in a layout corresponding to what BokehJS expects at unmarshalling time. This method does not convert "Bokeh types" into "plain JSON types," for example each child Model will still be a Model, rather than turning into a reference, n...
[ "Returns", "a", "dictionary", "of", "the", "attributes", "of", "this", "object", "in", "a", "layout", "corresponding", "to", "what", "BokehJS", "expects", "at", "unmarshalling", "time", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/model.py#L734-L777
train
bokeh/bokeh
bokeh/plotting/gmap.py
gmap
def gmap(google_api_key, map_options, **kwargs): ''' Create a new :class:`~bokeh.plotting.gmap.GMap` for plotting. Args: google_api_key (str): Google requires an API key be supplied for maps to function. See: https://developers.google.com/maps/documentation/javascript/get-api-k...
python
def gmap(google_api_key, map_options, **kwargs): ''' Create a new :class:`~bokeh.plotting.gmap.GMap` for plotting. Args: google_api_key (str): Google requires an API key be supplied for maps to function. See: https://developers.google.com/maps/documentation/javascript/get-api-k...
[ "def", "gmap", "(", "google_api_key", ",", "map_options", ",", "*", "*", "kwargs", ")", ":", "return", "GMap", "(", "api_key", "=", "google_api_key", ",", "map_options", "=", "map_options", ",", "*", "*", "kwargs", ")" ]
Create a new :class:`~bokeh.plotting.gmap.GMap` for plotting. Args: google_api_key (str): Google requires an API key be supplied for maps to function. See: https://developers.google.com/maps/documentation/javascript/get-api-key map_options: (GMapOptions) Config...
[ "Create", "a", "new", ":", "class", ":", "~bokeh", ".", "plotting", ".", "gmap", ".", "GMap", "for", "plotting", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/plotting/gmap.py#L180-L204
train
bokeh/bokeh
bokeh/colors/hsl.py
HSL.copy
def copy(self): ''' Return a copy of this color value. Returns: HSL ''' return HSL(self.h, self.s, self.l, self.a)
python
def copy(self): ''' Return a copy of this color value. Returns: HSL ''' return HSL(self.h, self.s, self.l, self.a)
[ "def", "copy", "(", "self", ")", ":", "return", "HSL", "(", "self", ".", "h", ",", "self", ".", "s", ",", "self", ".", "l", ",", "self", ".", "a", ")" ]
Return a copy of this color value. Returns: HSL
[ "Return", "a", "copy", "of", "this", "color", "value", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/colors/hsl.py#L73-L80
train
bokeh/bokeh
bokeh/colors/hsl.py
HSL.to_css
def to_css(self): ''' Generate the CSS representation of this HSL color. Returns: str, ``"hsl(...)"`` or ``"hsla(...)"`` ''' if self.a == 1.0: return "hsl(%d, %s%%, %s%%)" % (self.h, self.s*100, self.l*100) else: return "hsla(%d, %s%%, %s%%, ...
python
def to_css(self): ''' Generate the CSS representation of this HSL color. Returns: str, ``"hsl(...)"`` or ``"hsla(...)"`` ''' if self.a == 1.0: return "hsl(%d, %s%%, %s%%)" % (self.h, self.s*100, self.l*100) else: return "hsla(%d, %s%%, %s%%, ...
[ "def", "to_css", "(", "self", ")", ":", "if", "self", ".", "a", "==", "1.0", ":", "return", "\"hsl(%d, %s%%, %s%%)\"", "%", "(", "self", ".", "h", ",", "self", ".", "s", "*", "100", ",", "self", ".", "l", "*", "100", ")", "else", ":", "return", ...
Generate the CSS representation of this HSL color. Returns: str, ``"hsl(...)"`` or ``"hsla(...)"``
[ "Generate", "the", "CSS", "representation", "of", "this", "HSL", "color", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/colors/hsl.py#L110-L120
train
bokeh/bokeh
bokeh/colors/hsl.py
HSL.to_rgb
def to_rgb(self): ''' Return a corresponding :class:`~bokeh.colors.rgb.RGB` color for this HSL color. Returns: HSL ''' from .rgb import RGB # prevent circular import r, g, b = colorsys.hls_to_rgb(float(self.h)/360, self.l, self.s) return RGB(round(r*...
python
def to_rgb(self): ''' Return a corresponding :class:`~bokeh.colors.rgb.RGB` color for this HSL color. Returns: HSL ''' from .rgb import RGB # prevent circular import r, g, b = colorsys.hls_to_rgb(float(self.h)/360, self.l, self.s) return RGB(round(r*...
[ "def", "to_rgb", "(", "self", ")", ":", "from", ".", "rgb", "import", "RGB", "# prevent circular import", "r", ",", "g", ",", "b", "=", "colorsys", ".", "hls_to_rgb", "(", "float", "(", "self", ".", "h", ")", "/", "360", ",", "self", ".", "l", ",",...
Return a corresponding :class:`~bokeh.colors.rgb.RGB` color for this HSL color. Returns: HSL
[ "Return", "a", "corresponding", ":", "class", ":", "~bokeh", ".", "colors", ".", "rgb", ".", "RGB", "color", "for", "this", "HSL", "color", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/colors/hsl.py#L131-L141
train
bokeh/bokeh
bokeh/util/paths.py
serverdir
def serverdir(): """ Get the location of the server subpackage """ path = join(ROOT_DIR, 'server') path = normpath(path) if sys.platform == 'cygwin': path = realpath(path) return path
python
def serverdir(): """ Get the location of the server subpackage """ path = join(ROOT_DIR, 'server') path = normpath(path) if sys.platform == 'cygwin': path = realpath(path) return path
[ "def", "serverdir", "(", ")", ":", "path", "=", "join", "(", "ROOT_DIR", ",", "'server'", ")", "path", "=", "normpath", "(", "path", ")", "if", "sys", ".", "platform", "==", "'cygwin'", ":", "path", "=", "realpath", "(", "path", ")", "return", "path"...
Get the location of the server subpackage
[ "Get", "the", "location", "of", "the", "server", "subpackage" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/paths.py#L44-L50
train
bokeh/bokeh
bokeh/util/paths.py
bokehjsdir
def bokehjsdir(dev=False): """ Get the location of the bokehjs source files. If dev is True, the files in bokehjs/build are preferred. Otherwise uses the files in bokeh/server/static. """ dir1 = join(ROOT_DIR, '..', 'bokehjs', 'build') dir2 = join(serverdir(), 'static') if dev and isdir(dir1...
python
def bokehjsdir(dev=False): """ Get the location of the bokehjs source files. If dev is True, the files in bokehjs/build are preferred. Otherwise uses the files in bokeh/server/static. """ dir1 = join(ROOT_DIR, '..', 'bokehjs', 'build') dir2 = join(serverdir(), 'static') if dev and isdir(dir1...
[ "def", "bokehjsdir", "(", "dev", "=", "False", ")", ":", "dir1", "=", "join", "(", "ROOT_DIR", ",", "'..'", ",", "'bokehjs'", ",", "'build'", ")", "dir2", "=", "join", "(", "serverdir", "(", ")", ",", "'static'", ")", "if", "dev", "and", "isdir", "...
Get the location of the bokehjs source files. If dev is True, the files in bokehjs/build are preferred. Otherwise uses the files in bokeh/server/static.
[ "Get", "the", "location", "of", "the", "bokehjs", "source", "files", ".", "If", "dev", "is", "True", "the", "files", "in", "bokehjs", "/", "build", "are", "preferred", ".", "Otherwise", "uses", "the", "files", "in", "bokeh", "/", "server", "/", "static",...
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/paths.py#L53-L63
train
bokeh/bokeh
bokeh/server/server.py
BaseServer.start
def start(self): ''' Install the Bokeh Server and its background tasks on a Tornado ``IOLoop``. This method does *not* block and does *not* affect the state of the Tornado ``IOLoop`` You must start and stop the loop yourself, i.e. this method is typically useful when you are al...
python
def start(self): ''' Install the Bokeh Server and its background tasks on a Tornado ``IOLoop``. This method does *not* block and does *not* affect the state of the Tornado ``IOLoop`` You must start and stop the loop yourself, i.e. this method is typically useful when you are al...
[ "def", "start", "(", "self", ")", ":", "assert", "not", "self", ".", "_started", ",", "\"Already started\"", "self", ".", "_started", "=", "True", "self", ".", "_tornado", ".", "start", "(", ")" ]
Install the Bokeh Server and its background tasks on a Tornado ``IOLoop``. This method does *not* block and does *not* affect the state of the Tornado ``IOLoop`` You must start and stop the loop yourself, i.e. this method is typically useful when you are already explicitly mana...
[ "Install", "the", "Bokeh", "Server", "and", "its", "background", "tasks", "on", "a", "Tornado", "IOLoop", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/server.py#L120-L135
train
bokeh/bokeh
bokeh/server/server.py
BaseServer.stop
def stop(self, wait=True): ''' Stop the Bokeh Server. This stops and removes all Bokeh Server ``IOLoop`` callbacks, as well as stops the ``HTTPServer`` that this instance was configured with. Args: fast (bool): Whether to wait for orderly cleanup (default: T...
python
def stop(self, wait=True): ''' Stop the Bokeh Server. This stops and removes all Bokeh Server ``IOLoop`` callbacks, as well as stops the ``HTTPServer`` that this instance was configured with. Args: fast (bool): Whether to wait for orderly cleanup (default: T...
[ "def", "stop", "(", "self", ",", "wait", "=", "True", ")", ":", "assert", "not", "self", ".", "_stopped", ",", "\"Already stopped\"", "self", ".", "_stopped", "=", "True", "self", ".", "_tornado", ".", "stop", "(", "wait", ")", "self", ".", "_http", ...
Stop the Bokeh Server. This stops and removes all Bokeh Server ``IOLoop`` callbacks, as well as stops the ``HTTPServer`` that this instance was configured with. Args: fast (bool): Whether to wait for orderly cleanup (default: True) Returns: None
[ "Stop", "the", "Bokeh", "Server", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/server.py#L137-L154
train
bokeh/bokeh
bokeh/server/server.py
BaseServer.run_until_shutdown
def run_until_shutdown(self): ''' Run the Bokeh Server until shutdown is requested by the user, either via a Keyboard interrupt (Ctrl-C) or SIGTERM. Calling this method will start the Tornado ``IOLoop`` and block all execution in the calling process. Returns: None ...
python
def run_until_shutdown(self): ''' Run the Bokeh Server until shutdown is requested by the user, either via a Keyboard interrupt (Ctrl-C) or SIGTERM. Calling this method will start the Tornado ``IOLoop`` and block all execution in the calling process. Returns: None ...
[ "def", "run_until_shutdown", "(", "self", ")", ":", "if", "not", "self", ".", "_started", ":", "self", ".", "start", "(", ")", "# Install shutdown hooks", "atexit", ".", "register", "(", "self", ".", "_atexit", ")", "signal", ".", "signal", "(", "signal", ...
Run the Bokeh Server until shutdown is requested by the user, either via a Keyboard interrupt (Ctrl-C) or SIGTERM. Calling this method will start the Tornado ``IOLoop`` and block all execution in the calling process. Returns: None
[ "Run", "the", "Bokeh", "Server", "until", "shutdown", "is", "requested", "by", "the", "user", "either", "via", "a", "Keyboard", "interrupt", "(", "Ctrl", "-", "C", ")", "or", "SIGTERM", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/server.py#L167-L187
train
bokeh/bokeh
bokeh/server/server.py
BaseServer.get_sessions
def get_sessions(self, app_path=None): ''' Gets all currently active sessions for applications. Args: app_path (str, optional) : The configured application path for the application to return sessions for. If None, return active sessions for all ...
python
def get_sessions(self, app_path=None): ''' Gets all currently active sessions for applications. Args: app_path (str, optional) : The configured application path for the application to return sessions for. If None, return active sessions for all ...
[ "def", "get_sessions", "(", "self", ",", "app_path", "=", "None", ")", ":", "if", "app_path", "is", "not", "None", ":", "return", "self", ".", "_tornado", ".", "get_sessions", "(", "app_path", ")", "all_sessions", "=", "[", "]", "for", "path", "in", "s...
Gets all currently active sessions for applications. Args: app_path (str, optional) : The configured application path for the application to return sessions for. If None, return active sessions for all applications. (default: None) Returns: ...
[ "Gets", "all", "currently", "active", "sessions", "for", "applications", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/server.py#L206-L224
train
bokeh/bokeh
bokeh/server/server.py
BaseServer.show
def show(self, app_path, browser=None, new='tab'): ''' Opens an app in a browser window or tab. This method is useful for testing or running Bokeh server applications on a local machine but should not call when running Bokeh server for an actual deployment. Args: ap...
python
def show(self, app_path, browser=None, new='tab'): ''' Opens an app in a browser window or tab. This method is useful for testing or running Bokeh server applications on a local machine but should not call when running Bokeh server for an actual deployment. Args: ap...
[ "def", "show", "(", "self", ",", "app_path", ",", "browser", "=", "None", ",", "new", "=", "'tab'", ")", ":", "if", "not", "app_path", ".", "startswith", "(", "\"/\"", ")", ":", "raise", "ValueError", "(", "\"app_path must start with a /\"", ")", "address_...
Opens an app in a browser window or tab. This method is useful for testing or running Bokeh server applications on a local machine but should not call when running Bokeh server for an actual deployment. Args: app_path (str) : the app path to open The part of...
[ "Opens", "an", "app", "in", "a", "browser", "window", "or", "tab", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/server.py#L226-L261
train
bokeh/bokeh
bokeh/application/handlers/code_runner.py
CodeRunner.new_module
def new_module(self): ''' Make a fresh module to run in. Returns: Module ''' self.reset_run_errors() if self._code is None: return None module_name = 'bk_script_' + make_id().replace('-', '') module = ModuleType(str(module_name)) # str ...
python
def new_module(self): ''' Make a fresh module to run in. Returns: Module ''' self.reset_run_errors() if self._code is None: return None module_name = 'bk_script_' + make_id().replace('-', '') module = ModuleType(str(module_name)) # str ...
[ "def", "new_module", "(", "self", ")", ":", "self", ".", "reset_run_errors", "(", ")", "if", "self", ".", "_code", "is", "None", ":", "return", "None", "module_name", "=", "'bk_script_'", "+", "make_id", "(", ")", ".", "replace", "(", "'-'", ",", "''",...
Make a fresh module to run in. Returns: Module
[ "Make", "a", "fresh", "module", "to", "run", "in", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/application/handlers/code_runner.py#L129-L145
train
bokeh/bokeh
bokeh/application/handlers/code_runner.py
CodeRunner.run
def run(self, module, post_check): ''' Execute the configured source code in a module and run any post checks. Args: module (Module) : a module to execute the configured code in. post_check(callable) : a function that can raise an exception if expected p...
python
def run(self, module, post_check): ''' Execute the configured source code in a module and run any post checks. Args: module (Module) : a module to execute the configured code in. post_check(callable) : a function that can raise an exception if expected p...
[ "def", "run", "(", "self", ",", "module", ",", "post_check", ")", ":", "try", ":", "# Simulate the sys.path behaviour decribed here:", "#", "# https://docs.python.org/2/library/sys.html#sys.path", "_cwd", "=", "os", ".", "getcwd", "(", ")", "_sys_path", "=", "list", ...
Execute the configured source code in a module and run any post checks. Args: module (Module) : a module to execute the configured code in. post_check(callable) : a function that can raise an exception if expected post-conditions are not met after code execution...
[ "Execute", "the", "configured", "source", "code", "in", "a", "module", "and", "run", "any", "post", "checks", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/application/handlers/code_runner.py#L158-L196
train
bokeh/bokeh
bokeh/client/connection.py
ClientConnection.loop_until_closed
def loop_until_closed(self): ''' Execute a blocking loop that runs and executes event callbacks until the connection is closed (e.g. by hitting Ctrl-C). While this method can be used to run Bokeh application code "outside" the Bokeh server, this practice is HIGHLY DISCOURAGED for any re...
python
def loop_until_closed(self): ''' Execute a blocking loop that runs and executes event callbacks until the connection is closed (e.g. by hitting Ctrl-C). While this method can be used to run Bokeh application code "outside" the Bokeh server, this practice is HIGHLY DISCOURAGED for any re...
[ "def", "loop_until_closed", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "_state", ",", "NOT_YET_CONNECTED", ")", ":", "# we don't use self._transition_to_disconnected here", "# because _transition is a coroutine", "self", ".", "_tell_session_about_disconnect"...
Execute a blocking loop that runs and executes event callbacks until the connection is closed (e.g. by hitting Ctrl-C). While this method can be used to run Bokeh application code "outside" the Bokeh server, this practice is HIGHLY DISCOURAGED for any real use case.
[ "Execute", "a", "blocking", "loop", "that", "runs", "and", "executes", "event", "callbacks", "until", "the", "connection", "is", "closed", "(", "e", ".", "g", ".", "by", "hitting", "Ctrl", "-", "C", ")", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/client/connection.py#L134-L151
train
bokeh/bokeh
bokeh/client/connection.py
ClientConnection.pull_doc
def pull_doc(self, document): ''' Pull a document from the server, overwriting the passed-in document Args: document : (Document) The document to overwrite with server content. Returns: None ''' msg = self._protocol.create('PULL-DOC-REQ') ...
python
def pull_doc(self, document): ''' Pull a document from the server, overwriting the passed-in document Args: document : (Document) The document to overwrite with server content. Returns: None ''' msg = self._protocol.create('PULL-DOC-REQ') ...
[ "def", "pull_doc", "(", "self", ",", "document", ")", ":", "msg", "=", "self", ".", "_protocol", ".", "create", "(", "'PULL-DOC-REQ'", ")", "reply", "=", "self", ".", "_send_message_wait_for_reply", "(", "msg", ")", "if", "reply", "is", "None", ":", "rai...
Pull a document from the server, overwriting the passed-in document Args: document : (Document) The document to overwrite with server content. Returns: None
[ "Pull", "a", "document", "from", "the", "server", "overwriting", "the", "passed", "-", "in", "document" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/client/connection.py#L153-L171
train
bokeh/bokeh
bokeh/client/connection.py
ClientConnection.push_doc
def push_doc(self, document): ''' Push a document to the server, overwriting any existing server-side doc. Args: document : (Document) A Document to push to the server Returns: The server reply ''' msg = self._protocol.create('PUSH-DOC',...
python
def push_doc(self, document): ''' Push a document to the server, overwriting any existing server-side doc. Args: document : (Document) A Document to push to the server Returns: The server reply ''' msg = self._protocol.create('PUSH-DOC',...
[ "def", "push_doc", "(", "self", ",", "document", ")", ":", "msg", "=", "self", ".", "_protocol", ".", "create", "(", "'PUSH-DOC'", ",", "document", ")", "reply", "=", "self", ".", "_send_message_wait_for_reply", "(", "msg", ")", "if", "reply", "is", "Non...
Push a document to the server, overwriting any existing server-side doc. Args: document : (Document) A Document to push to the server Returns: The server reply
[ "Push", "a", "document", "to", "the", "server", "overwriting", "any", "existing", "server", "-", "side", "doc", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/client/connection.py#L173-L191
train
bokeh/bokeh
bokeh/client/connection.py
ClientConnection.request_server_info
def request_server_info(self): ''' Ask for information about the server. Returns: A dictionary of server attributes. ''' if self._server_info is None: self._server_info = self._send_request_server_info() return self._server_info
python
def request_server_info(self): ''' Ask for information about the server. Returns: A dictionary of server attributes. ''' if self._server_info is None: self._server_info = self._send_request_server_info() return self._server_info
[ "def", "request_server_info", "(", "self", ")", ":", "if", "self", ".", "_server_info", "is", "None", ":", "self", ".", "_server_info", "=", "self", ".", "_send_request_server_info", "(", ")", "return", "self", ".", "_server_info" ]
Ask for information about the server. Returns: A dictionary of server attributes.
[ "Ask", "for", "information", "about", "the", "server", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/client/connection.py#L193-L202
train
bokeh/bokeh
bokeh/io/export.py
export_png
def export_png(obj, filename=None, height=None, width=None, webdriver=None, timeout=5): ''' Export the ``LayoutDOM`` object or document as a PNG. If the filename is not given, it is derived from the script name (e.g. ``/foo/myplot.py`` will create ``/foo/myplot.png``) Args: obj (LayoutDOM or D...
python
def export_png(obj, filename=None, height=None, width=None, webdriver=None, timeout=5): ''' Export the ``LayoutDOM`` object or document as a PNG. If the filename is not given, it is derived from the script name (e.g. ``/foo/myplot.py`` will create ``/foo/myplot.png``) Args: obj (LayoutDOM or D...
[ "def", "export_png", "(", "obj", ",", "filename", "=", "None", ",", "height", "=", "None", ",", "width", "=", "None", ",", "webdriver", "=", "None", ",", "timeout", "=", "5", ")", ":", "image", "=", "get_screenshot_as_png", "(", "obj", ",", "height", ...
Export the ``LayoutDOM`` object or document as a PNG. If the filename is not given, it is derived from the script name (e.g. ``/foo/myplot.py`` will create ``/foo/myplot.png``) Args: obj (LayoutDOM or Document) : a Layout (Row/Column), Plot or Widget object or Document to export. ...
[ "Export", "the", "LayoutDOM", "object", "or", "document", "as", "a", "PNG", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/io/export.py#L59-L107
train
bokeh/bokeh
bokeh/io/export.py
export_svgs
def export_svgs(obj, filename=None, height=None, width=None, webdriver=None, timeout=5): ''' Export the SVG-enabled plots within a layout. Each plot will result in a distinct SVG file. If the filename is not given, it is derived from the script name (e.g. ``/foo/myplot.py`` will create ``/foo/myplot.sv...
python
def export_svgs(obj, filename=None, height=None, width=None, webdriver=None, timeout=5): ''' Export the SVG-enabled plots within a layout. Each plot will result in a distinct SVG file. If the filename is not given, it is derived from the script name (e.g. ``/foo/myplot.py`` will create ``/foo/myplot.sv...
[ "def", "export_svgs", "(", "obj", ",", "filename", "=", "None", ",", "height", "=", "None", ",", "width", "=", "None", ",", "webdriver", "=", "None", ",", "timeout", "=", "5", ")", ":", "svgs", "=", "get_svgs", "(", "obj", ",", "height", "=", "heig...
Export the SVG-enabled plots within a layout. Each plot will result in a distinct SVG file. If the filename is not given, it is derived from the script name (e.g. ``/foo/myplot.py`` will create ``/foo/myplot.svg``) Args: obj (LayoutDOM object) : a Layout (Row/Column), Plot or Widget object to ...
[ "Export", "the", "SVG", "-", "enabled", "plots", "within", "a", "layout", ".", "Each", "plot", "will", "result", "in", "a", "distinct", "SVG", "file", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/io/export.py#L109-L166
train
bokeh/bokeh
bokeh/io/export.py
get_screenshot_as_png
def get_screenshot_as_png(obj, driver=None, timeout=5, **kwargs): ''' Get a screenshot of a ``LayoutDOM`` object. Args: obj (LayoutDOM or Document) : a Layout (Row/Column), Plot or Widget object or Document to export. driver (selenium.webdriver) : a selenium webdriver instance to u...
python
def get_screenshot_as_png(obj, driver=None, timeout=5, **kwargs): ''' Get a screenshot of a ``LayoutDOM`` object. Args: obj (LayoutDOM or Document) : a Layout (Row/Column), Plot or Widget object or Document to export. driver (selenium.webdriver) : a selenium webdriver instance to u...
[ "def", "get_screenshot_as_png", "(", "obj", ",", "driver", "=", "None", ",", "timeout", "=", "5", ",", "*", "*", "kwargs", ")", ":", "Image", "=", "import_required", "(", "'PIL.Image'", ",", "'To use bokeh.io.export_png you need pillow '", "+", "'(\"conda install ...
Get a screenshot of a ``LayoutDOM`` object. Args: obj (LayoutDOM or Document) : a Layout (Row/Column), Plot or Widget object or Document to export. driver (selenium.webdriver) : a selenium webdriver instance to use to export the image. timeout (int) : the maximum a...
[ "Get", "a", "screenshot", "of", "a", "LayoutDOM", "object", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/io/export.py#L186-L234
train
bokeh/bokeh
bokeh/io/export.py
_crop_image
def _crop_image(image, left=0, top=0, right=0, bottom=0, **kwargs): ''' Crop the border from the layout ''' return image.crop((left, top, right, bottom))
python
def _crop_image(image, left=0, top=0, right=0, bottom=0, **kwargs): ''' Crop the border from the layout ''' return image.crop((left, top, right, bottom))
[ "def", "_crop_image", "(", "image", ",", "left", "=", "0", ",", "top", "=", "0", ",", "right", "=", "0", ",", "bottom", "=", "0", ",", "*", "*", "kwargs", ")", ":", "return", "image", ".", "crop", "(", "(", "left", ",", "top", ",", "right", "...
Crop the border from the layout
[ "Crop", "the", "border", "from", "the", "layout" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/io/export.py#L354-L358
train
bokeh/bokeh
bokeh/models/sources.py
ColumnDataSource._data_from_df
def _data_from_df(df): ''' Create a ``dict`` of columns from a Pandas ``DataFrame``, suitable for creating a ColumnDataSource. Args: df (DataFrame) : data to convert Returns: dict[str, np.array] ''' _df = df.copy() # Flatten columns ...
python
def _data_from_df(df): ''' Create a ``dict`` of columns from a Pandas ``DataFrame``, suitable for creating a ColumnDataSource. Args: df (DataFrame) : data to convert Returns: dict[str, np.array] ''' _df = df.copy() # Flatten columns ...
[ "def", "_data_from_df", "(", "df", ")", ":", "_df", "=", "df", ".", "copy", "(", ")", "# Flatten columns", "if", "isinstance", "(", "df", ".", "columns", ",", "pd", ".", "MultiIndex", ")", ":", "try", ":", "_df", ".", "columns", "=", "[", "'_'", "....
Create a ``dict`` of columns from a Pandas ``DataFrame``, suitable for creating a ColumnDataSource. Args: df (DataFrame) : data to convert Returns: dict[str, np.array]
[ "Create", "a", "dict", "of", "columns", "from", "a", "Pandas", "DataFrame", "suitable", "for", "creating", "a", "ColumnDataSource", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/models/sources.py#L195-L232
train
bokeh/bokeh
bokeh/models/sources.py
ColumnDataSource._df_index_name
def _df_index_name(df): ''' Return the Bokeh-appropriate column name for a ``DataFrame`` index If there is no named index, then `"index" is returned. If there is a single named index, then ``df.index.name`` is returned. If there is a multi-index, and the index names are all strings, t...
python
def _df_index_name(df): ''' Return the Bokeh-appropriate column name for a ``DataFrame`` index If there is no named index, then `"index" is returned. If there is a single named index, then ``df.index.name`` is returned. If there is a multi-index, and the index names are all strings, t...
[ "def", "_df_index_name", "(", "df", ")", ":", "if", "df", ".", "index", ".", "name", ":", "return", "df", ".", "index", ".", "name", "elif", "df", ".", "index", ".", "names", ":", "try", ":", "return", "\"_\"", ".", "join", "(", "df", ".", "index...
Return the Bokeh-appropriate column name for a ``DataFrame`` index If there is no named index, then `"index" is returned. If there is a single named index, then ``df.index.name`` is returned. If there is a multi-index, and the index names are all strings, then the names are joined wit...
[ "Return", "the", "Bokeh", "-", "appropriate", "column", "name", "for", "a", "DataFrame", "index" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/models/sources.py#L252-L280
train
bokeh/bokeh
bokeh/models/sources.py
ColumnDataSource.add
def add(self, data, name=None): ''' Appends a new column of data to the data source. Args: data (seq) : new data to add name (str, optional) : column name to use. If not supplied, generate a name of the form "Series ####" Returns: str: the c...
python
def add(self, data, name=None): ''' Appends a new column of data to the data source. Args: data (seq) : new data to add name (str, optional) : column name to use. If not supplied, generate a name of the form "Series ####" Returns: str: the c...
[ "def", "add", "(", "self", ",", "data", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "n", "=", "len", "(", "self", ".", "data", ")", "while", "\"Series %d\"", "%", "n", "in", "self", ".", "data", ":", "n", "+=", "1", "...
Appends a new column of data to the data source. Args: data (seq) : new data to add name (str, optional) : column name to use. If not supplied, generate a name of the form "Series ####" Returns: str: the column name used
[ "Appends", "a", "new", "column", "of", "data", "to", "the", "data", "source", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/models/sources.py#L325-L343
train
bokeh/bokeh
bokeh/models/sources.py
ColumnDataSource.remove
def remove(self, name): ''' Remove a column of data. Args: name (str) : name of the column to remove Returns: None .. note:: If the column name does not exist, a warning is issued. ''' try: del self.data[name] ex...
python
def remove(self, name): ''' Remove a column of data. Args: name (str) : name of the column to remove Returns: None .. note:: If the column name does not exist, a warning is issued. ''' try: del self.data[name] ex...
[ "def", "remove", "(", "self", ",", "name", ")", ":", "try", ":", "del", "self", ".", "data", "[", "name", "]", "except", "(", "ValueError", ",", "KeyError", ")", ":", "import", "warnings", "warnings", ".", "warn", "(", "\"Unable to find column '%s' in data...
Remove a column of data. Args: name (str) : name of the column to remove Returns: None .. note:: If the column name does not exist, a warning is issued.
[ "Remove", "a", "column", "of", "data", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/models/sources.py#L346-L363
train
bokeh/bokeh
bokeh/models/sources.py
ColumnDataSource._stream
def _stream(self, new_data, rollover=None, setter=None): ''' Internal implementation to efficiently update data source columns with new append-only data. The internal implementation adds the setter attribute. [https://github.com/bokeh/bokeh/issues/6577] In cases where it is necessary t...
python
def _stream(self, new_data, rollover=None, setter=None): ''' Internal implementation to efficiently update data source columns with new append-only data. The internal implementation adds the setter attribute. [https://github.com/bokeh/bokeh/issues/6577] In cases where it is necessary t...
[ "def", "_stream", "(", "self", ",", "new_data", ",", "rollover", "=", "None", ",", "setter", "=", "None", ")", ":", "needs_length_check", "=", "True", "if", "pd", "and", "isinstance", "(", "new_data", ",", "pd", ".", "Series", ")", ":", "new_data", "="...
Internal implementation to efficiently update data source columns with new append-only data. The internal implementation adds the setter attribute. [https://github.com/bokeh/bokeh/issues/6577] In cases where it is necessary to update data columns in, this method can efficiently send on...
[ "Internal", "implementation", "to", "efficiently", "update", "data", "source", "columns", "with", "new", "append", "-", "only", "data", ".", "The", "internal", "implementation", "adds", "the", "setter", "attribute", ".", "[", "https", ":", "//", "github", ".",...
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/models/sources.py#L407-L517
train
bokeh/bokeh
bokeh/models/sources.py
ColumnDataSource.patch
def patch(self, patches, setter=None): ''' Efficiently update data source columns at specific locations If it is only necessary to update a small subset of data in a ``ColumnDataSource``, this method can be used to efficiently update only the subset, instead of requiring the entire data...
python
def patch(self, patches, setter=None): ''' Efficiently update data source columns at specific locations If it is only necessary to update a small subset of data in a ``ColumnDataSource``, this method can be used to efficiently update only the subset, instead of requiring the entire data...
[ "def", "patch", "(", "self", ",", "patches", ",", "setter", "=", "None", ")", ":", "import", "numpy", "as", "np", "extra", "=", "set", "(", "patches", ".", "keys", "(", ")", ")", "-", "set", "(", "self", ".", "data", ".", "keys", "(", ")", ")",...
Efficiently update data source columns at specific locations If it is only necessary to update a small subset of data in a ``ColumnDataSource``, this method can be used to efficiently update only the subset, instead of requiring the entire data set to be sent. This method should be pas...
[ "Efficiently", "update", "data", "source", "columns", "at", "specific", "locations" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/models/sources.py#L519-L674
train
bokeh/bokeh
bokeh/core/validation/check.py
silence
def silence(warning, silence=True): ''' Silence a particular warning on all Bokeh models. Args: warning (Warning) : Bokeh warning to silence silence (bool) : Whether or not to silence the warning Returns: A set containing the all silenced warnings This function adds or removes...
python
def silence(warning, silence=True): ''' Silence a particular warning on all Bokeh models. Args: warning (Warning) : Bokeh warning to silence silence (bool) : Whether or not to silence the warning Returns: A set containing the all silenced warnings This function adds or removes...
[ "def", "silence", "(", "warning", ",", "silence", "=", "True", ")", ":", "if", "not", "isinstance", "(", "warning", ",", "int", ")", ":", "raise", "ValueError", "(", "'Input to silence should be a warning object '", "'- not of type {}'", ".", "format", "(", "typ...
Silence a particular warning on all Bokeh models. Args: warning (Warning) : Bokeh warning to silence silence (bool) : Whether or not to silence the warning Returns: A set containing the all silenced warnings This function adds or removes warnings from a set of silencers which ...
[ "Silence", "a", "particular", "warning", "on", "all", "Bokeh", "models", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/validation/check.py#L43-L79
train
bokeh/bokeh
bokeh/core/validation/check.py
check_integrity
def check_integrity(models): ''' Apply validation and integrity checks to a collection of Bokeh models. Args: models (seq[Model]) : a collection of Models to test Returns: None This function will emit log warning and error messages for all error or warning conditions that are dete...
python
def check_integrity(models): ''' Apply validation and integrity checks to a collection of Bokeh models. Args: models (seq[Model]) : a collection of Models to test Returns: None This function will emit log warning and error messages for all error or warning conditions that are dete...
[ "def", "check_integrity", "(", "models", ")", ":", "messages", "=", "dict", "(", "error", "=", "[", "]", ",", "warning", "=", "[", "]", ")", "for", "model", "in", "models", ":", "validators", "=", "[", "]", "for", "name", "in", "dir", "(", "model",...
Apply validation and integrity checks to a collection of Bokeh models. Args: models (seq[Model]) : a collection of Models to test Returns: None This function will emit log warning and error messages for all error or warning conditions that are detected. For example, layouts without an...
[ "Apply", "validation", "and", "integrity", "checks", "to", "a", "collection", "of", "Bokeh", "models", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/validation/check.py#L82-L121
train
bokeh/bokeh
bokeh/themes/theme.py
Theme.apply_to_model
def apply_to_model(self, model): ''' Apply this theme to a model. .. warning:: Typically, don't call this method directly. Instead, set the theme on the :class:`~bokeh.document.Document` the model is a part of. ''' model.apply_theme(self._for_class(model.__class...
python
def apply_to_model(self, model): ''' Apply this theme to a model. .. warning:: Typically, don't call this method directly. Instead, set the theme on the :class:`~bokeh.document.Document` the model is a part of. ''' model.apply_theme(self._for_class(model.__class...
[ "def", "apply_to_model", "(", "self", ",", "model", ")", ":", "model", ".", "apply_theme", "(", "self", ".", "_for_class", "(", "model", ".", "__class__", ")", ")", "# a little paranoia because it would be Bad(tm) to mess", "# this up... would be nicer if python had a way...
Apply this theme to a model. .. warning:: Typically, don't call this method directly. Instead, set the theme on the :class:`~bokeh.document.Document` the model is a part of.
[ "Apply", "this", "theme", "to", "a", "model", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/themes/theme.py#L186-L200
train
bokeh/bokeh
bokeh/embed/util.py
OutputDocumentFor
def OutputDocumentFor(objs, apply_theme=None, always_new=False): ''' Find or create a (possibly temporary) Document to use for serializing Bokeh content. Typical usage is similar to: .. code-block:: python with OutputDocumentFor(models): (docs_json, [render_item]) = standalone_do...
python
def OutputDocumentFor(objs, apply_theme=None, always_new=False): ''' Find or create a (possibly temporary) Document to use for serializing Bokeh content. Typical usage is similar to: .. code-block:: python with OutputDocumentFor(models): (docs_json, [render_item]) = standalone_do...
[ "def", "OutputDocumentFor", "(", "objs", ",", "apply_theme", "=", "None", ",", "always_new", "=", "False", ")", ":", "# Note: Comms handling relies on the fact that the new_doc returned", "# has models with the same IDs as they were started with", "if", "not", "isinstance", "("...
Find or create a (possibly temporary) Document to use for serializing Bokeh content. Typical usage is similar to: .. code-block:: python with OutputDocumentFor(models): (docs_json, [render_item]) = standalone_docs_json_and_render_items(models) Inside the context manager, the mod...
[ "Find", "or", "create", "a", "(", "possibly", "temporary", ")", "Document", "to", "use", "for", "serializing", "Bokeh", "content", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/embed/util.py#L67-L168
train
bokeh/bokeh
bokeh/embed/util.py
submodel_has_python_callbacks
def submodel_has_python_callbacks(models): ''' Traverses submodels to check for Python (event) callbacks ''' has_python_callback = False for model in collect_models(models): if len(model._callbacks) > 0 or len(model._event_callbacks) > 0: has_python_callback = True break...
python
def submodel_has_python_callbacks(models): ''' Traverses submodels to check for Python (event) callbacks ''' has_python_callback = False for model in collect_models(models): if len(model._callbacks) > 0 or len(model._event_callbacks) > 0: has_python_callback = True break...
[ "def", "submodel_has_python_callbacks", "(", "models", ")", ":", "has_python_callback", "=", "False", "for", "model", "in", "collect_models", "(", "models", ")", ":", "if", "len", "(", "model", ".", "_callbacks", ")", ">", "0", "or", "len", "(", "model", "...
Traverses submodels to check for Python (event) callbacks
[ "Traverses", "submodels", "to", "check", "for", "Python", "(", "event", ")", "callbacks" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/embed/util.py#L305-L315
train
bokeh/bokeh
bokeh/models/graphs.py
from_networkx
def from_networkx(graph, layout_function, **kwargs): ''' Generate a ``GraphRenderer`` from a ``networkx.Graph`` object and networkx layout function. Any keyword arguments will be passed to the layout function. Only two dimensional layouts are supported. Args: ...
python
def from_networkx(graph, layout_function, **kwargs): ''' Generate a ``GraphRenderer`` from a ``networkx.Graph`` object and networkx layout function. Any keyword arguments will be passed to the layout function. Only two dimensional layouts are supported. Args: ...
[ "def", "from_networkx", "(", "graph", ",", "layout_function", ",", "*", "*", "kwargs", ")", ":", "# inline import to prevent circular imports", "from", ".", ".", "models", ".", "renderers", "import", "GraphRenderer", "from", ".", ".", "models", ".", "graphs", "i...
Generate a ``GraphRenderer`` from a ``networkx.Graph`` object and networkx layout function. Any keyword arguments will be passed to the layout function. Only two dimensional layouts are supported. Args: graph (networkx.Graph) : a networkx graph to render layout_...
[ "Generate", "a", "GraphRenderer", "from", "a", "networkx", ".", "Graph", "object", "and", "networkx", "layout", "function", ".", "Any", "keyword", "arguments", "will", "be", "passed", "to", "the", "layout", "function", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/models/graphs.py#L71-L169
train
bokeh/bokeh
bokeh/core/enums.py
enumeration
def enumeration(*values, **kwargs): ''' Create an |Enumeration| object from a sequence of values. Call ``enumeration`` with a sequence of (unique) strings to create an Enumeration object: .. code-block:: python #: Specify the horizontal alignment for rendering text TextAlign = enumera...
python
def enumeration(*values, **kwargs): ''' Create an |Enumeration| object from a sequence of values. Call ``enumeration`` with a sequence of (unique) strings to create an Enumeration object: .. code-block:: python #: Specify the horizontal alignment for rendering text TextAlign = enumera...
[ "def", "enumeration", "(", "*", "values", ",", "*", "*", "kwargs", ")", ":", "if", "not", "(", "values", "and", "all", "(", "isinstance", "(", "value", ",", "string_types", ")", "and", "value", "for", "value", "in", "values", ")", ")", ":", "raise", ...
Create an |Enumeration| object from a sequence of values. Call ``enumeration`` with a sequence of (unique) strings to create an Enumeration object: .. code-block:: python #: Specify the horizontal alignment for rendering text TextAlign = enumeration("left", "right", "center") Args: ...
[ "Create", "an", "|Enumeration|", "object", "from", "a", "sequence", "of", "values", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/enums.py#L176-L223
train
bokeh/bokeh
bokeh/util/session_id.py
generate_session_id
def generate_session_id(secret_key=settings.secret_key_bytes(), signed=settings.sign_sessions()): """Generate a random session ID. Typically, each browser tab connected to a Bokeh application has its own session ID. In production deployments of a Bokeh app, session IDs should be random and unguessable...
python
def generate_session_id(secret_key=settings.secret_key_bytes(), signed=settings.sign_sessions()): """Generate a random session ID. Typically, each browser tab connected to a Bokeh application has its own session ID. In production deployments of a Bokeh app, session IDs should be random and unguessable...
[ "def", "generate_session_id", "(", "secret_key", "=", "settings", ".", "secret_key_bytes", "(", ")", ",", "signed", "=", "settings", ".", "sign_sessions", "(", ")", ")", ":", "secret_key", "=", "_ensure_bytes", "(", "secret_key", ")", "if", "signed", ":", "#...
Generate a random session ID. Typically, each browser tab connected to a Bokeh application has its own session ID. In production deployments of a Bokeh app, session IDs should be random and unguessable - otherwise users of the app could interfere with one another. If session IDs are signed with a...
[ "Generate", "a", "random", "session", "ID", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/session_id.py#L63-L91
train
bokeh/bokeh
bokeh/util/session_id.py
check_session_id_signature
def check_session_id_signature(session_id, secret_key=settings.secret_key_bytes(), signed=settings.sign_sessions()): """Check the signature of a session ID, returning True if it's valid. The server uses this function to check whether a session ID was generated with the correc...
python
def check_session_id_signature(session_id, secret_key=settings.secret_key_bytes(), signed=settings.sign_sessions()): """Check the signature of a session ID, returning True if it's valid. The server uses this function to check whether a session ID was generated with the correc...
[ "def", "check_session_id_signature", "(", "session_id", ",", "secret_key", "=", "settings", ".", "secret_key_bytes", "(", ")", ",", "signed", "=", "settings", ".", "sign_sessions", "(", ")", ")", ":", "secret_key", "=", "_ensure_bytes", "(", "secret_key", ")", ...
Check the signature of a session ID, returning True if it's valid. The server uses this function to check whether a session ID was generated with the correct secret key. If signed sessions are disabled, this function always returns True. Args: session_id (str) : The session ID to check ...
[ "Check", "the", "signature", "of", "a", "session", "ID", "returning", "True", "if", "it", "s", "valid", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/session_id.py#L93-L121
train
bokeh/bokeh
bokeh/util/session_id.py
_get_random_string
def _get_random_string(length=44, allowed_chars='abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', secret_key=settings.secret_key_bytes()): """ Return a securely generated random string. With the a-z, A-Z, 0-9 character s...
python
def _get_random_string(length=44, allowed_chars='abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', secret_key=settings.secret_key_bytes()): """ Return a securely generated random string. With the a-z, A-Z, 0-9 character s...
[ "def", "_get_random_string", "(", "length", "=", "44", ",", "allowed_chars", "=", "'abcdefghijklmnopqrstuvwxyz'", "'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'", ",", "secret_key", "=", "settings", ".", "secret_key_bytes", "(", ")", ")", ":", "secret_key", "=", "_ensure_bytes...
Return a securely generated random string. With the a-z, A-Z, 0-9 character set: Length 12 is a 71-bit value. log_2((26+26+10)^12) =~ 71 Length 44 is a 261-bit value. log_2((26+26+10)^44) = 261
[ "Return", "a", "securely", "generated", "random", "string", ".", "With", "the", "a", "-", "z", "A", "-", "Z", "0", "-", "9", "character", "set", ":", "Length", "12", "is", "a", "71", "-", "bit", "value", ".", "log_2", "((", "26", "+", "26", "+", ...
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/session_id.py#L192-L204
train
bokeh/bokeh
bokeh/embed/notebook.py
notebook_content
def notebook_content(model, notebook_comms_target=None, theme=FromCurdoc): ''' Return script and div that will display a Bokeh plot in a Jupyter Notebook. The data for the plot is stored directly in the returned HTML. Args: model (Model) : Bokeh object to render notebook_comms_target ...
python
def notebook_content(model, notebook_comms_target=None, theme=FromCurdoc): ''' Return script and div that will display a Bokeh plot in a Jupyter Notebook. The data for the plot is stored directly in the returned HTML. Args: model (Model) : Bokeh object to render notebook_comms_target ...
[ "def", "notebook_content", "(", "model", ",", "notebook_comms_target", "=", "None", ",", "theme", "=", "FromCurdoc", ")", ":", "if", "not", "isinstance", "(", "model", ",", "Model", ")", ":", "raise", "ValueError", "(", "\"notebook_content expects a single Model i...
Return script and div that will display a Bokeh plot in a Jupyter Notebook. The data for the plot is stored directly in the returned HTML. Args: model (Model) : Bokeh object to render notebook_comms_target (str, optional) : A target name for a Jupyter Comms object that can upd...
[ "Return", "script", "and", "div", "that", "will", "display", "a", "Bokeh", "plot", "in", "a", "Jupyter", "Notebook", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/embed/notebook.py#L51-L98
train
bokeh/bokeh
bokeh/models/transforms.py
CustomJSTransform.from_py_func
def from_py_func(cls, func, v_func): ''' Create a ``CustomJSTransform`` instance from a pair of Python functions. The function is translated to JavaScript using PScript. The python functions must have no positional arguments. It's possible to pass Bokeh models (e.g. a ``ColumnDataSource...
python
def from_py_func(cls, func, v_func): ''' Create a ``CustomJSTransform`` instance from a pair of Python functions. The function is translated to JavaScript using PScript. The python functions must have no positional arguments. It's possible to pass Bokeh models (e.g. a ``ColumnDataSource...
[ "def", "from_py_func", "(", "cls", ",", "func", ",", "v_func", ")", ":", "from", "bokeh", ".", "util", ".", "deprecation", "import", "deprecated", "deprecated", "(", "\"'from_py_func' is deprecated and will be removed in an eventual 2.0 release. \"", "\"Use CustomJSTransfor...
Create a ``CustomJSTransform`` instance from a pair of Python functions. The function is translated to JavaScript using PScript. The python functions must have no positional arguments. It's possible to pass Bokeh models (e.g. a ``ColumnDataSource``) as keyword arguments to the functions...
[ "Create", "a", "CustomJSTransform", "instance", "from", "a", "pair", "of", "Python", "functions", ".", "The", "function", "is", "translated", "to", "JavaScript", "using", "PScript", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/models/transforms.py#L89-L167
train
bokeh/bokeh
bokeh/models/transforms.py
CustomJSTransform.from_coffeescript
def from_coffeescript(cls, func, v_func, args={}): ''' Create a ``CustomJSTransform`` instance from a pair of CoffeeScript snippets. The function bodies are translated to JavaScript functions using node and therefore require return statements. The ``func`` snippet namespace will contain...
python
def from_coffeescript(cls, func, v_func, args={}): ''' Create a ``CustomJSTransform`` instance from a pair of CoffeeScript snippets. The function bodies are translated to JavaScript functions using node and therefore require return statements. The ``func`` snippet namespace will contain...
[ "def", "from_coffeescript", "(", "cls", ",", "func", ",", "v_func", ",", "args", "=", "{", "}", ")", ":", "compiled", "=", "nodejs_compile", "(", "func", ",", "lang", "=", "\"coffeescript\"", ",", "file", "=", "\"???\"", ")", "if", "\"error\"", "in", "...
Create a ``CustomJSTransform`` instance from a pair of CoffeeScript snippets. The function bodies are translated to JavaScript functions using node and therefore require return statements. The ``func`` snippet namespace will contain the variable ``x`` (the untransformed value) at render...
[ "Create", "a", "CustomJSTransform", "instance", "from", "a", "pair", "of", "CoffeeScript", "snippets", ".", "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/transforms.py#L170-L206
train
bokeh/bokeh
bokeh/core/has_props.py
abstract
def abstract(cls): ''' A decorator to mark abstract base classes derived from |HasProps|. ''' if not issubclass(cls, HasProps): raise TypeError("%s is not a subclass of HasProps" % cls.__name__) # running python with -OO will discard docstrings -> __doc__ is None if cls.__doc__ is not None...
python
def abstract(cls): ''' A decorator to mark abstract base classes derived from |HasProps|. ''' if not issubclass(cls, HasProps): raise TypeError("%s is not a subclass of HasProps" % cls.__name__) # running python with -OO will discard docstrings -> __doc__ is None if cls.__doc__ is not None...
[ "def", "abstract", "(", "cls", ")", ":", "if", "not", "issubclass", "(", "cls", ",", "HasProps", ")", ":", "raise", "TypeError", "(", "\"%s is not a subclass of HasProps\"", "%", "cls", ".", "__name__", ")", "# running python with -OO will discard docstrings -> __doc_...
A decorator to mark abstract base classes derived from |HasProps|.
[ "A", "decorator", "to", "mark", "abstract", "base", "classes", "derived", "from", "|HasProps|", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/has_props.py#L65-L76
train
bokeh/bokeh
bokeh/core/has_props.py
accumulate_from_superclasses
def accumulate_from_superclasses(cls, propname): ''' Traverse the class hierarchy and accumulate the special sets of names ``MetaHasProps`` stores on classes: Args: name (str) : name of the special attribute to collect. Typically meaningful values are: ``__container_props__``, ...
python
def accumulate_from_superclasses(cls, propname): ''' Traverse the class hierarchy and accumulate the special sets of names ``MetaHasProps`` stores on classes: Args: name (str) : name of the special attribute to collect. Typically meaningful values are: ``__container_props__``, ...
[ "def", "accumulate_from_superclasses", "(", "cls", ",", "propname", ")", ":", "cachename", "=", "\"__cached_all\"", "+", "propname", "# we MUST use cls.__dict__ NOT hasattr(). hasattr() would also look at base", "# classes, and the cache must be separate for each class", "if", "cache...
Traverse the class hierarchy and accumulate the special sets of names ``MetaHasProps`` stores on classes: Args: name (str) : name of the special attribute to collect. Typically meaningful values are: ``__container_props__``, ``__properties__``, ``__properties_with_refs__``
[ "Traverse", "the", "class", "hierarchy", "and", "accumulate", "the", "special", "sets", "of", "names", "MetaHasProps", "stores", "on", "classes", ":" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/has_props.py#L191-L212
train
bokeh/bokeh
bokeh/core/has_props.py
accumulate_dict_from_superclasses
def accumulate_dict_from_superclasses(cls, propname): ''' Traverse the class hierarchy and accumulate the special dicts ``MetaHasProps`` stores on classes: Args: name (str) : name of the special attribute to collect. Typically meaningful values are: ``__dataspecs__``, ``__o...
python
def accumulate_dict_from_superclasses(cls, propname): ''' Traverse the class hierarchy and accumulate the special dicts ``MetaHasProps`` stores on classes: Args: name (str) : name of the special attribute to collect. Typically meaningful values are: ``__dataspecs__``, ``__o...
[ "def", "accumulate_dict_from_superclasses", "(", "cls", ",", "propname", ")", ":", "cachename", "=", "\"__cached_all\"", "+", "propname", "# we MUST use cls.__dict__ NOT hasattr(). hasattr() would also look at base", "# classes, and the cache must be separate for each class", "if", "...
Traverse the class hierarchy and accumulate the special dicts ``MetaHasProps`` stores on classes: Args: name (str) : name of the special attribute to collect. Typically meaningful values are: ``__dataspecs__``, ``__overridden_defaults__``
[ "Traverse", "the", "class", "hierarchy", "and", "accumulate", "the", "special", "dicts", "MetaHasProps", "stores", "on", "classes", ":" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/has_props.py#L214-L237
train
bokeh/bokeh
bokeh/core/has_props.py
HasProps.equals
def equals(self, other): ''' Structural equality of models. Args: other (HasProps) : the other instance to compare to Returns: True, if properties are structurally equal, otherwise False ''' # NOTE: don't try to use this to implement __eq__. Because th...
python
def equals(self, other): ''' Structural equality of models. Args: other (HasProps) : the other instance to compare to Returns: True, if properties are structurally equal, otherwise False ''' # NOTE: don't try to use this to implement __eq__. Because th...
[ "def", "equals", "(", "self", ",", "other", ")", ":", "# NOTE: don't try to use this to implement __eq__. Because then", "# you will be tempted to implement __hash__, which would interfere", "# with mutability of models. However, not implementing __hash__", "# will make bokeh unusable in Pytho...
Structural equality of models. Args: other (HasProps) : the other instance to compare to Returns: True, if properties are structurally equal, otherwise False
[ "Structural", "equality", "of", "models", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/has_props.py#L295-L314
train
bokeh/bokeh
bokeh/core/has_props.py
HasProps.set_from_json
def set_from_json(self, name, json, models=None, setter=None): ''' Set a property value on this object from JSON. Args: name: (str) : name of the attribute to set json: (JSON-value) : value to set to the attribute to models (dict or None, optional) : ...
python
def set_from_json(self, name, json, models=None, setter=None): ''' Set a property value on this object from JSON. Args: name: (str) : name of the attribute to set json: (JSON-value) : value to set to the attribute to models (dict or None, optional) : ...
[ "def", "set_from_json", "(", "self", ",", "name", ",", "json", ",", "models", "=", "None", ",", "setter", "=", "None", ")", ":", "if", "name", "in", "self", ".", "properties", "(", ")", ":", "log", ".", "trace", "(", "\"Patching attribute %r of %r with %...
Set a property value on this object from JSON. Args: name: (str) : name of the attribute to set json: (JSON-value) : value to set to the attribute to models (dict or None, optional) : Mapping of model ids to models (default: None) This is n...
[ "Set", "a", "property", "value", "on", "this", "object", "from", "JSON", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/has_props.py#L316-L349
train
bokeh/bokeh
bokeh/core/has_props.py
HasProps.update_from_json
def update_from_json(self, json_attributes, models=None, setter=None): ''' Updates the object's properties from a JSON attributes dictionary. Args: json_attributes: (JSON-dict) : attributes and values to update models (dict or None, optional) : Mapping of model ...
python
def update_from_json(self, json_attributes, models=None, setter=None): ''' Updates the object's properties from a JSON attributes dictionary. Args: json_attributes: (JSON-dict) : attributes and values to update models (dict or None, optional) : Mapping of model ...
[ "def", "update_from_json", "(", "self", ",", "json_attributes", ",", "models", "=", "None", ",", "setter", "=", "None", ")", ":", "for", "k", ",", "v", "in", "json_attributes", ".", "items", "(", ")", ":", "self", ".", "set_from_json", "(", "k", ",", ...
Updates the object's properties from a JSON attributes dictionary. Args: json_attributes: (JSON-dict) : attributes and values to update models (dict or None, optional) : Mapping of model ids to models (default: None) This is needed in cases where the at...
[ "Updates", "the", "object", "s", "properties", "from", "a", "JSON", "attributes", "dictionary", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/has_props.py#L378-L405
train
bokeh/bokeh
bokeh/core/has_props.py
HasProps.properties
def properties(cls, with_bases=True): ''' Collect the names of properties on this class. This method *optionally* traverses the class hierarchy and includes properties defined on any parent classes. Args: with_bases (bool, optional) : Whether to include prop...
python
def properties(cls, with_bases=True): ''' Collect the names of properties on this class. This method *optionally* traverses the class hierarchy and includes properties defined on any parent classes. Args: with_bases (bool, optional) : Whether to include prop...
[ "def", "properties", "(", "cls", ",", "with_bases", "=", "True", ")", ":", "if", "with_bases", ":", "return", "accumulate_from_superclasses", "(", "cls", ",", "\"__properties__\"", ")", "else", ":", "return", "set", "(", "cls", ".", "__properties__", ")" ]
Collect the names of properties on this class. This method *optionally* traverses the class hierarchy and includes properties defined on any parent classes. Args: with_bases (bool, optional) : Whether to include properties defined on parent classes in ...
[ "Collect", "the", "names", "of", "properties", "on", "this", "class", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/has_props.py#L449-L467
train
bokeh/bokeh
bokeh/core/has_props.py
HasProps.properties_with_values
def properties_with_values(self, include_defaults=True): ''' Collect a dict mapping property names to their values. This method *always* traverses the class hierarchy and includes properties defined on any parent classes. Non-serializable properties are skipped and property values are ...
python
def properties_with_values(self, include_defaults=True): ''' Collect a dict mapping property names to their values. This method *always* traverses the class hierarchy and includes properties defined on any parent classes. Non-serializable properties are skipped and property values are ...
[ "def", "properties_with_values", "(", "self", ",", "include_defaults", "=", "True", ")", ":", "return", "self", ".", "query_properties_with_values", "(", "lambda", "prop", ":", "prop", ".", "serialized", ",", "include_defaults", ")" ]
Collect a dict mapping property names to their values. This method *always* traverses the class hierarchy and includes properties defined on any parent classes. Non-serializable properties are skipped and property values are in "serialized" format which may be slightly different from t...
[ "Collect", "a", "dict", "mapping", "property", "names", "to", "their", "values", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/has_props.py#L496-L517
train
bokeh/bokeh
bokeh/core/has_props.py
HasProps.query_properties_with_values
def query_properties_with_values(self, query, include_defaults=True): ''' Query the properties values of |HasProps| instances with a predicate. Args: query (callable) : A callable that accepts property descriptors and returns True or False ...
python
def query_properties_with_values(self, query, include_defaults=True): ''' Query the properties values of |HasProps| instances with a predicate. Args: query (callable) : A callable that accepts property descriptors and returns True or False ...
[ "def", "query_properties_with_values", "(", "self", ",", "query", ",", "include_defaults", "=", "True", ")", ":", "themed_keys", "=", "set", "(", ")", "result", "=", "dict", "(", ")", "if", "include_defaults", ":", "keys", "=", "self", ".", "properties", "...
Query the properties values of |HasProps| instances with a predicate. Args: query (callable) : A callable that accepts property descriptors and returns True or False include_defaults (bool, optional) : Whether to include propertie...
[ "Query", "the", "properties", "values", "of", "|HasProps|", "instances", "with", "a", "predicate", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/has_props.py#L528-L570
train
bokeh/bokeh
bokeh/core/has_props.py
HasProps.apply_theme
def apply_theme(self, property_values): ''' Apply a set of theme values which will be used rather than defaults, but will not override application-set values. The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the ...
python
def apply_theme(self, property_values): ''' Apply a set of theme values which will be used rather than defaults, but will not override application-set values. The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the ...
[ "def", "apply_theme", "(", "self", ",", "property_values", ")", ":", "old_dict", "=", "self", ".", "themed_values", "(", ")", "# if the same theme is set again, it should reuse the same dict", "if", "old_dict", "is", "property_values", ":", "return", "removed", "=", "...
Apply a set of theme values which will be used rather than defaults, but will not override application-set values. The passed-in dictionary may be kept around as-is and shared with other instances to save memory (so neither the caller nor the |HasProps| instance should modify it). ...
[ "Apply", "a", "set", "of", "theme", "values", "which", "will", "be", "used", "rather", "than", "defaults", "but", "will", "not", "override", "application", "-", "set", "values", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/core/has_props.py#L584-L629
train
bokeh/bokeh
bokeh/util/string.py
indent
def indent(text, n=2, ch=" "): ''' Indent all the lines in a given block of text by a specified amount. Args: text (str) : The text to indent n (int, optional) : The amount to indent each line by (default: 2) ch (char, optional) : What character to ...
python
def indent(text, n=2, ch=" "): ''' Indent all the lines in a given block of text by a specified amount. Args: text (str) : The text to indent n (int, optional) : The amount to indent each line by (default: 2) ch (char, optional) : What character to ...
[ "def", "indent", "(", "text", ",", "n", "=", "2", ",", "ch", "=", "\" \"", ")", ":", "padding", "=", "ch", "*", "n", "return", "\"\\n\"", ".", "join", "(", "padding", "+", "line", "for", "line", "in", "text", ".", "split", "(", "\"\\n\"", ")", ...
Indent all the lines in a given block of text by a specified amount. Args: text (str) : The text to indent n (int, optional) : The amount to indent each line by (default: 2) ch (char, optional) : What character to fill the indentation with (default: " "...
[ "Indent", "all", "the", "lines", "in", "a", "given", "block", "of", "text", "by", "a", "specified", "amount", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/string.py#L105-L120
train
bokeh/bokeh
bokeh/util/string.py
nice_join
def nice_join(seq, sep=", ", conjuction="or"): ''' Join together sequences of strings into English-friendly phrases using the conjunction ``or`` when appropriate. Args: seq (seq[str]) : a sequence of strings to nicely join sep (str, optional) : a sequence delimiter to use (default: ", ") ...
python
def nice_join(seq, sep=", ", conjuction="or"): ''' Join together sequences of strings into English-friendly phrases using the conjunction ``or`` when appropriate. Args: seq (seq[str]) : a sequence of strings to nicely join sep (str, optional) : a sequence delimiter to use (default: ", ") ...
[ "def", "nice_join", "(", "seq", ",", "sep", "=", "\", \"", ",", "conjuction", "=", "\"or\"", ")", ":", "seq", "=", "[", "str", "(", "x", ")", "for", "x", "in", "seq", "]", "if", "len", "(", "seq", ")", "<=", "1", "or", "conjuction", "is", "None...
Join together sequences of strings into English-friendly phrases using the conjunction ``or`` when appropriate. Args: seq (seq[str]) : a sequence of strings to nicely join sep (str, optional) : a sequence delimiter to use (default: ", ") conjunction (str or None, optional) : a conjuctio...
[ "Join", "together", "sequences", "of", "strings", "into", "English", "-", "friendly", "phrases", "using", "the", "conjunction", "or", "when", "appropriate", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/string.py#L122-L145
train
bokeh/bokeh
bokeh/util/string.py
snakify
def snakify(name, sep='_'): ''' Convert CamelCase to snake_case. ''' name = re.sub("([A-Z]+)([A-Z][a-z])", r"\1%s\2" % sep, name) name = re.sub("([a-z\\d])([A-Z])", r"\1%s\2" % sep, name) return name.lower()
python
def snakify(name, sep='_'): ''' Convert CamelCase to snake_case. ''' name = re.sub("([A-Z]+)([A-Z][a-z])", r"\1%s\2" % sep, name) name = re.sub("([a-z\\d])([A-Z])", r"\1%s\2" % sep, name) return name.lower()
[ "def", "snakify", "(", "name", ",", "sep", "=", "'_'", ")", ":", "name", "=", "re", ".", "sub", "(", "\"([A-Z]+)([A-Z][a-z])\"", ",", "r\"\\1%s\\2\"", "%", "sep", ",", "name", ")", "name", "=", "re", ".", "sub", "(", "\"([a-z\\\\d])([A-Z])\"", ",", "r\...
Convert CamelCase to snake_case.
[ "Convert", "CamelCase", "to", "snake_case", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/string.py#L147-L151
train
bokeh/bokeh
bokeh/application/handlers/document_lifecycle.py
_on_session_destroyed
def _on_session_destroyed(session_context): ''' Calls any on_session_destroyed callbacks defined on the Document ''' callbacks = session_context._document.session_destroyed_callbacks session_context._document.session_destroyed_callbacks = set() for callback in callbacks: try: ...
python
def _on_session_destroyed(session_context): ''' Calls any on_session_destroyed callbacks defined on the Document ''' callbacks = session_context._document.session_destroyed_callbacks session_context._document.session_destroyed_callbacks = set() for callback in callbacks: try: ...
[ "def", "_on_session_destroyed", "(", "session_context", ")", ":", "callbacks", "=", "session_context", ".", "_document", ".", "session_destroyed_callbacks", "session_context", ".", "_document", ".", "session_destroyed_callbacks", "=", "set", "(", ")", "for", "callback",...
Calls any on_session_destroyed callbacks defined on the Document
[ "Calls", "any", "on_session_destroyed", "callbacks", "defined", "on", "the", "Document" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/application/handlers/document_lifecycle.py#L60-L79
train
bokeh/bokeh
bokeh/protocol/messages/__init__.py
register
def register(cls): ''' Decorator to add a Message (and its revision) to the Protocol index. Example: .. code-block:: python @register class some_msg_1(Message): msgtype = 'SOME-MSG' revision = 1 @classmethod de...
python
def register(cls): ''' Decorator to add a Message (and its revision) to the Protocol index. Example: .. code-block:: python @register class some_msg_1(Message): msgtype = 'SOME-MSG' revision = 1 @classmethod de...
[ "def", "register", "(", "cls", ")", ":", "key", "=", "(", "cls", ".", "msgtype", ",", "cls", ".", "revision", ")", "if", "key", "in", "index", ":", "raise", "ProtocolError", "(", "\"Duplicate message specification encountered: %r\"", "%", "key", ")", "index"...
Decorator to add a Message (and its revision) to the Protocol index. Example: .. code-block:: python @register class some_msg_1(Message): msgtype = 'SOME-MSG' revision = 1 @classmethod def create(cls, **metadata): ...
[ "Decorator", "to", "add", "a", "Message", "(", "and", "its", "revision", ")", "to", "the", "Protocol", "index", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/protocol/messages/__init__.py#L49-L73
train
bokeh/bokeh
bokeh/client/session.py
pull_session
def pull_session(session_id=None, url='default', io_loop=None, arguments=None): ''' Create a session by loading the current server-side document. ``session.document`` will be a fresh document loaded from the server. While the connection to the server is open, changes made on the server side will be app...
python
def pull_session(session_id=None, url='default', io_loop=None, arguments=None): ''' Create a session by loading the current server-side document. ``session.document`` will be a fresh document loaded from the server. While the connection to the server is open, changes made on the server side will be app...
[ "def", "pull_session", "(", "session_id", "=", "None", ",", "url", "=", "'default'", ",", "io_loop", "=", "None", ",", "arguments", "=", "None", ")", ":", "coords", "=", "_SessionCoordinates", "(", "session_id", "=", "session_id", ",", "url", "=", "url", ...
Create a session by loading the current server-side document. ``session.document`` will be a fresh document loaded from the server. While the connection to the server is open, changes made on the server side will be applied to this document, and changes made on the client side will be synced to the...
[ "Create", "a", "session", "by", "loading", "the", "current", "server", "-", "side", "document", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/client/session.py#L68-L125
train
bokeh/bokeh
bokeh/client/session.py
push_session
def push_session(document, session_id=None, url='default', io_loop=None): ''' Create a session by pushing the given document to the server, overwriting any existing server-side document. ``session.document`` in the returned session will be your supplied document. While the connection to the server is o...
python
def push_session(document, session_id=None, url='default', io_loop=None): ''' Create a session by pushing the given document to the server, overwriting any existing server-side document. ``session.document`` in the returned session will be your supplied document. While the connection to the server is o...
[ "def", "push_session", "(", "document", ",", "session_id", "=", "None", ",", "url", "=", "'default'", ",", "io_loop", "=", "None", ")", ":", "coords", "=", "_SessionCoordinates", "(", "session_id", "=", "session_id", ",", "url", "=", "url", ")", "session",...
Create a session by pushing the given document to the server, overwriting any existing server-side document. ``session.document`` in the returned session will be your supplied document. While the connection to the server is open, changes made on the server side will be applied to this document, and cha...
[ "Create", "a", "session", "by", "pushing", "the", "given", "document", "to", "the", "server", "overwriting", "any", "existing", "server", "-", "side", "document", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/client/session.py#L127-L169
train
bokeh/bokeh
bokeh/client/session.py
show_session
def show_session(session_id=None, url='default', session=None, browser=None, new="tab", controller=None): ''' Open a browser displaying a session document. If you have a session from ``pull_session()`` or ``push_session`` you can ``show_session(session=mysession)``. If you don't need to open a ...
python
def show_session(session_id=None, url='default', session=None, browser=None, new="tab", controller=None): ''' Open a browser displaying a session document. If you have a session from ``pull_session()`` or ``push_session`` you can ``show_session(session=mysession)``. If you don't need to open a ...
[ "def", "show_session", "(", "session_id", "=", "None", ",", "url", "=", "'default'", ",", "session", "=", "None", ",", "browser", "=", "None", ",", "new", "=", "\"tab\"", ",", "controller", "=", "None", ")", ":", "if", "session", "is", "not", "None", ...
Open a browser displaying a session document. If you have a session from ``pull_session()`` or ``push_session`` you can ``show_session(session=mysession)``. If you don't need to open a connection to the server yourself, you can show a new session in a browser by providing just the ``url...
[ "Open", "a", "browser", "displaying", "a", "session", "document", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/client/session.py#L171-L214
train
bokeh/bokeh
bokeh/client/session.py
ClientSession.loop_until_closed
def loop_until_closed(self, suppress_warning=False): ''' Execute a blocking loop that runs and executes event callbacks until the connection is closed (e.g. by hitting Ctrl-C). While this method can be used to run Bokeh application code "outside" the Bokeh server, this practice is HIGHL...
python
def loop_until_closed(self, suppress_warning=False): ''' Execute a blocking loop that runs and executes event callbacks until the connection is closed (e.g. by hitting Ctrl-C). While this method can be used to run Bokeh application code "outside" the Bokeh server, this practice is HIGHL...
[ "def", "loop_until_closed", "(", "self", ",", "suppress_warning", "=", "False", ")", ":", "suppress_warning", "# shut up flake", "from", "bokeh", ".", "util", ".", "deprecation", "import", "deprecated", "deprecated", "(", "\"ClientSession.loop_until_closed is deprecated, ...
Execute a blocking loop that runs and executes event callbacks until the connection is closed (e.g. by hitting Ctrl-C). While this method can be used to run Bokeh application code "outside" the Bokeh server, this practice is HIGHLY DISCOURAGED for any real use case. This function is int...
[ "Execute", "a", "blocking", "loop", "that", "runs", "and", "executes", "event", "callbacks", "until", "the", "connection", "is", "closed", "(", "e", ".", "g", ".", "by", "hitting", "Ctrl", "-", "C", ")", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/client/session.py#L337-L354
train
bokeh/bokeh
bokeh/client/session.py
ClientSession.pull
def pull(self): ''' Pull the server's state and set it as session.document. If this is called more than once, session.document will be the same object instance but its contents will be overwritten. Automatically calls :func:`connect` before pulling. ''' self.connect() ...
python
def pull(self): ''' Pull the server's state and set it as session.document. If this is called more than once, session.document will be the same object instance but its contents will be overwritten. Automatically calls :func:`connect` before pulling. ''' self.connect() ...
[ "def", "pull", "(", "self", ")", ":", "self", ".", "connect", "(", ")", "if", "not", "self", ".", "connected", ":", "raise", "IOError", "(", "\"Cannot pull session document because we failed to connect to the server (to start the server, try the 'bokeh serve' command)\"", "...
Pull the server's state and set it as session.document. If this is called more than once, session.document will be the same object instance but its contents will be overwritten. Automatically calls :func:`connect` before pulling.
[ "Pull", "the", "server", "s", "state", "and", "set", "it", "as", "session", ".", "document", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/client/session.py#L356-L375
train
bokeh/bokeh
bokeh/client/session.py
ClientSession.push
def push(self, document=None): ''' Push the given document to the server and record it as session.document. If this is called more than once, the Document has to be the same (or None to mean "session.document"). .. note:: Automatically calls :func:`~connect` before pushing....
python
def push(self, document=None): ''' Push the given document to the server and record it as session.document. If this is called more than once, the Document has to be the same (or None to mean "session.document"). .. note:: Automatically calls :func:`~connect` before pushing....
[ "def", "push", "(", "self", ",", "document", "=", "None", ")", ":", "if", "self", ".", "document", "is", "None", ":", "if", "document", "is", "None", ":", "doc", "=", "Document", "(", ")", "else", ":", "doc", "=", "document", "else", ":", "if", "...
Push the given document to the server and record it as session.document. If this is called more than once, the Document has to be the same (or None to mean "session.document"). .. note:: Automatically calls :func:`~connect` before pushing. Args: document (:clas...
[ "Push", "the", "given", "document", "to", "the", "server", "and", "record", "it", "as", "session", ".", "document", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/client/session.py#L377-L408
train
bokeh/bokeh
bokeh/client/session.py
ClientSession.show
def show(self, obj=None, browser=None, new="tab"): ''' Open a browser displaying this session. Args: obj (LayoutDOM object, optional) : a Layout (Row/Column), Plot or Widget object to display. The object will be added to the session's document. b...
python
def show(self, obj=None, browser=None, new="tab"): ''' Open a browser displaying this session. Args: obj (LayoutDOM object, optional) : a Layout (Row/Column), Plot or Widget object to display. The object will be added to the session's document. b...
[ "def", "show", "(", "self", ",", "obj", "=", "None", ",", "browser", "=", "None", ",", "new", "=", "\"tab\"", ")", ":", "if", "obj", "and", "obj", "not", "in", "self", ".", "document", ".", "roots", ":", "self", ".", "document", ".", "add_root", ...
Open a browser displaying this session. Args: obj (LayoutDOM object, optional) : a Layout (Row/Column), Plot or Widget object to display. The object will be added to the session's document. browser (str, optional) : browser to show with (default: None) ...
[ "Open", "a", "browser", "displaying", "this", "session", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/client/session.py#L419-L441
train
bokeh/bokeh
bokeh/client/session.py
ClientSession._notify_disconnected
def _notify_disconnected(self): ''' Called by the ClientConnection we are using to notify us of disconnect. ''' if self.document is not None: self.document.remove_on_change(self) self._callbacks.remove_all_callbacks()
python
def _notify_disconnected(self): ''' Called by the ClientConnection we are using to notify us of disconnect. ''' if self.document is not None: self.document.remove_on_change(self) self._callbacks.remove_all_callbacks()
[ "def", "_notify_disconnected", "(", "self", ")", ":", "if", "self", ".", "document", "is", "not", "None", ":", "self", ".", "document", ".", "remove_on_change", "(", "self", ")", "self", ".", "_callbacks", ".", "remove_all_callbacks", "(", ")" ]
Called by the ClientConnection we are using to notify us of disconnect.
[ "Called", "by", "the", "ClientConnection", "we", "are", "using", "to", "notify", "us", "of", "disconnect", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/client/session.py#L471-L477
train
bokeh/bokeh
bokeh/protocol/message.py
Message.assemble
def assemble(cls, header_json, metadata_json, content_json): ''' Creates a new message, assembled from JSON fragments. Args: header_json (``JSON``) : metadata_json (``JSON``) : content_json (``JSON``) : Returns: Message subclass Raises...
python
def assemble(cls, header_json, metadata_json, content_json): ''' Creates a new message, assembled from JSON fragments. Args: header_json (``JSON``) : metadata_json (``JSON``) : content_json (``JSON``) : Returns: Message subclass Raises...
[ "def", "assemble", "(", "cls", ",", "header_json", ",", "metadata_json", ",", "content_json", ")", ":", "try", ":", "header", "=", "json_decode", "(", "header_json", ")", "except", "ValueError", ":", "raise", "MessageError", "(", "\"header could not be decoded\"",...
Creates a new message, assembled from JSON fragments. Args: header_json (``JSON``) : metadata_json (``JSON``) : content_json (``JSON``) : Returns: Message subclass Raises: MessageError
[ "Creates", "a", "new", "message", "assembled", "from", "JSON", "fragments", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/protocol/message.py#L119-L158
train
bokeh/bokeh
bokeh/protocol/message.py
Message.add_buffer
def add_buffer(self, buf_header, buf_payload): ''' Associate a buffer header and payload with this message. Args: buf_header (``JSON``) : a buffer header buf_payload (``JSON`` or bytes) : a buffer payload Returns: None Raises: MessageErr...
python
def add_buffer(self, buf_header, buf_payload): ''' Associate a buffer header and payload with this message. Args: buf_header (``JSON``) : a buffer header buf_payload (``JSON`` or bytes) : a buffer payload Returns: None Raises: MessageErr...
[ "def", "add_buffer", "(", "self", ",", "buf_header", ",", "buf_payload", ")", ":", "if", "'num_buffers'", "in", "self", ".", "_header", ":", "self", ".", "_header", "[", "'num_buffers'", "]", "+=", "1", "else", ":", "self", ".", "_header", "[", "'num_buf...
Associate a buffer header and payload with this message. Args: buf_header (``JSON``) : a buffer header buf_payload (``JSON`` or bytes) : a buffer payload Returns: None Raises: MessageError
[ "Associate", "a", "buffer", "header", "and", "payload", "with", "this", "message", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/protocol/message.py#L160-L181
train
bokeh/bokeh
bokeh/protocol/message.py
Message.assemble_buffer
def assemble_buffer(self, buf_header, buf_payload): ''' Add a buffer header and payload that we read from the socket. This differs from add_buffer() because we're validating vs. the header's num_buffers, instead of filling in the header. Args: buf_header (``JSON``) : a buff...
python
def assemble_buffer(self, buf_header, buf_payload): ''' Add a buffer header and payload that we read from the socket. This differs from add_buffer() because we're validating vs. the header's num_buffers, instead of filling in the header. Args: buf_header (``JSON``) : a buff...
[ "def", "assemble_buffer", "(", "self", ",", "buf_header", ",", "buf_payload", ")", ":", "if", "self", ".", "header", ".", "get", "(", "'num_buffers'", ",", "0", ")", "<=", "len", "(", "self", ".", "_buffers", ")", ":", "raise", "ProtocolError", "(", "\...
Add a buffer header and payload that we read from the socket. This differs from add_buffer() because we're validating vs. the header's num_buffers, instead of filling in the header. Args: buf_header (``JSON``) : a buffer header buf_payload (``JSON`` or bytes) : a buffer...
[ "Add", "a", "buffer", "header", "and", "payload", "that", "we", "read", "from", "the", "socket", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/protocol/message.py#L183-L201
train
bokeh/bokeh
bokeh/protocol/message.py
Message.write_buffers
def write_buffers(self, conn, locked=True): ''' Write any buffer headers and payloads to the given connection. Args: conn (object) : May be any object with a ``write_message`` method. Typically, a Tornado ``WSHandler`` or ``WebSocketClientConnection`` ...
python
def write_buffers(self, conn, locked=True): ''' Write any buffer headers and payloads to the given connection. Args: conn (object) : May be any object with a ``write_message`` method. Typically, a Tornado ``WSHandler`` or ``WebSocketClientConnection`` ...
[ "def", "write_buffers", "(", "self", ",", "conn", ",", "locked", "=", "True", ")", ":", "if", "conn", "is", "None", ":", "raise", "ValueError", "(", "\"Cannot write_buffers to connection None\"", ")", "sent", "=", "0", "for", "header", ",", "payload", "in", ...
Write any buffer headers and payloads to the given connection. Args: conn (object) : May be any object with a ``write_message`` method. Typically, a Tornado ``WSHandler`` or ``WebSocketClientConnection`` locked (bool) : Returns: int ...
[ "Write", "any", "buffer", "headers", "and", "payloads", "to", "the", "given", "connection", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/protocol/message.py#L204-L225
train
bokeh/bokeh
bokeh/protocol/message.py
Message.create_header
def create_header(cls, request_id=None): ''' Return a message header fragment dict. Args: request_id (str or None) : Message ID of the message this message replies to Returns: dict : a message header ''' header = { 'msgid' ...
python
def create_header(cls, request_id=None): ''' Return a message header fragment dict. Args: request_id (str or None) : Message ID of the message this message replies to Returns: dict : a message header ''' header = { 'msgid' ...
[ "def", "create_header", "(", "cls", ",", "request_id", "=", "None", ")", ":", "header", "=", "{", "'msgid'", ":", "bkserial", ".", "make_id", "(", ")", ",", "'msgtype'", ":", "cls", ".", "msgtype", "}", "if", "request_id", "is", "not", "None", ":", "...
Return a message header fragment dict. Args: request_id (str or None) : Message ID of the message this message replies to Returns: dict : a message header
[ "Return", "a", "message", "header", "fragment", "dict", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/protocol/message.py#L228-L245
train
bokeh/bokeh
bokeh/protocol/message.py
Message.send
def send(self, conn): ''' Send the message on the given connection. Args: conn (WebSocketHandler) : a WebSocketHandler to send messages Returns: int : number of bytes sent ''' if conn is None: raise ValueError("Cannot send to connection None...
python
def send(self, conn): ''' Send the message on the given connection. Args: conn (WebSocketHandler) : a WebSocketHandler to send messages Returns: int : number of bytes sent ''' if conn is None: raise ValueError("Cannot send to connection None...
[ "def", "send", "(", "self", ",", "conn", ")", ":", "if", "conn", "is", "None", ":", "raise", "ValueError", "(", "\"Cannot send to connection None\"", ")", "with", "(", "yield", "conn", ".", "write_lock", ".", "acquire", "(", ")", ")", ":", "sent", "=", ...
Send the message on the given connection. Args: conn (WebSocketHandler) : a WebSocketHandler to send messages Returns: int : number of bytes sent
[ "Send", "the", "message", "on", "the", "given", "connection", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/protocol/message.py#L248-L281
train
bokeh/bokeh
bokeh/protocol/message.py
Message.complete
def complete(self): ''' Returns whether all required parts of a message are present. Returns: bool : True if the message is complete, False otherwise ''' return self.header is not None and \ self.metadata is not None and \ self.content is not None an...
python
def complete(self): ''' Returns whether all required parts of a message are present. Returns: bool : True if the message is complete, False otherwise ''' return self.header is not None and \ self.metadata is not None and \ self.content is not None an...
[ "def", "complete", "(", "self", ")", ":", "return", "self", ".", "header", "is", "not", "None", "and", "self", ".", "metadata", "is", "not", "None", "and", "self", ".", "content", "is", "not", "None", "and", "self", ".", "header", ".", "get", "(", ...
Returns whether all required parts of a message are present. Returns: bool : True if the message is complete, False otherwise
[ "Returns", "whether", "all", "required", "parts", "of", "a", "message", "are", "present", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/protocol/message.py#L284-L294
train
bokeh/bokeh
bokeh/util/logconfig.py
basicConfig
def basicConfig(*args, **kwargs): """ A logging.basicConfig() wrapper that also undoes the default Bokeh-specific configuration. """ if default_handler is not None: bokeh_logger.removeHandler(default_handler) bokeh_logger.propagate = True return logging.basicConfig(*args, **kwarg...
python
def basicConfig(*args, **kwargs): """ A logging.basicConfig() wrapper that also undoes the default Bokeh-specific configuration. """ if default_handler is not None: bokeh_logger.removeHandler(default_handler) bokeh_logger.propagate = True return logging.basicConfig(*args, **kwarg...
[ "def", "basicConfig", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "default_handler", "is", "not", "None", ":", "bokeh_logger", ".", "removeHandler", "(", "default_handler", ")", "bokeh_logger", ".", "propagate", "=", "True", "return", "logging...
A logging.basicConfig() wrapper that also undoes the default Bokeh-specific configuration.
[ "A", "logging", ".", "basicConfig", "()", "wrapper", "that", "also", "undoes", "the", "default", "Bokeh", "-", "specific", "configuration", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/logconfig.py#L57-L65
train
bokeh/bokeh
bokeh/util/deprecation.py
deprecated
def deprecated(since_or_msg, old=None, new=None, extra=None): """ Issue a nicely formatted deprecation warning. """ if isinstance(since_or_msg, tuple): if old is None or new is None: raise ValueError("deprecated entity and a replacement are required") if len(since_or_msg) != 3 or n...
python
def deprecated(since_or_msg, old=None, new=None, extra=None): """ Issue a nicely formatted deprecation warning. """ if isinstance(since_or_msg, tuple): if old is None or new is None: raise ValueError("deprecated entity and a replacement are required") if len(since_or_msg) != 3 or n...
[ "def", "deprecated", "(", "since_or_msg", ",", "old", "=", "None", ",", "new", "=", "None", ",", "extra", "=", "None", ")", ":", "if", "isinstance", "(", "since_or_msg", ",", "tuple", ")", ":", "if", "old", "is", "None", "or", "new", "is", "None", ...
Issue a nicely formatted deprecation warning.
[ "Issue", "a", "nicely", "formatted", "deprecation", "warning", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/deprecation.py#L45-L68
train
bokeh/bokeh
bokeh/__main__.py
main
def main(): ''' Execute the "bokeh" command line program. ''' import sys from bokeh.command.bootstrap import main as _main # Main entry point (see setup.py) _main(sys.argv)
python
def main(): ''' Execute the "bokeh" command line program. ''' import sys from bokeh.command.bootstrap import main as _main # Main entry point (see setup.py) _main(sys.argv)
[ "def", "main", "(", ")", ":", "import", "sys", "from", "bokeh", ".", "command", ".", "bootstrap", "import", "main", "as", "_main", "# Main entry point (see setup.py)", "_main", "(", "sys", ".", "argv", ")" ]
Execute the "bokeh" command line program.
[ "Execute", "the", "bokeh", "command", "line", "program", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/__main__.py#L56-L64
train
bokeh/bokeh
bokeh/server/connection.py
ServerConnection.detach_session
def detach_session(self): """Allow the session to be discarded and don't get change notifications from it anymore""" if self._session is not None: self._session.unsubscribe(self) self._session = None
python
def detach_session(self): """Allow the session to be discarded and don't get change notifications from it anymore""" if self._session is not None: self._session.unsubscribe(self) self._session = None
[ "def", "detach_session", "(", "self", ")", ":", "if", "self", ".", "_session", "is", "not", "None", ":", "self", ".", "_session", ".", "unsubscribe", "(", "self", ")", "self", ".", "_session", "=", "None" ]
Allow the session to be discarded and don't get change notifications from it anymore
[ "Allow", "the", "session", "to", "be", "discarded", "and", "don", "t", "get", "change", "notifications", "from", "it", "anymore" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/connection.py#L62-L66
train
bokeh/bokeh
bokeh/server/connection.py
ServerConnection.send_patch_document
def send_patch_document(self, event): """ Sends a PATCH-DOC message, returning a Future that's completed when it's written out. """ msg = self.protocol.create('PATCH-DOC', [event]) return self._socket.send_message(msg)
python
def send_patch_document(self, event): """ Sends a PATCH-DOC message, returning a Future that's completed when it's written out. """ msg = self.protocol.create('PATCH-DOC', [event]) return self._socket.send_message(msg)
[ "def", "send_patch_document", "(", "self", ",", "event", ")", ":", "msg", "=", "self", ".", "protocol", ".", "create", "(", "'PATCH-DOC'", ",", "[", "event", "]", ")", "return", "self", ".", "_socket", ".", "send_message", "(", "msg", ")" ]
Sends a PATCH-DOC message, returning a Future that's completed when it's written out.
[ "Sends", "a", "PATCH", "-", "DOC", "message", "returning", "a", "Future", "that", "s", "completed", "when", "it", "s", "written", "out", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/server/connection.py#L74-L77
train
bokeh/bokeh
bokeh/document/util.py
initialize_references_json
def initialize_references_json(references_json, references, setter=None): ''' Given a JSON representation of the models in a graph, and new model objects, set the properties on the models from the JSON Args: references_json (``JSON``) JSON specifying attributes and values to initialize ...
python
def initialize_references_json(references_json, references, setter=None): ''' Given a JSON representation of the models in a graph, and new model objects, set the properties on the models from the JSON Args: references_json (``JSON``) JSON specifying attributes and values to initialize ...
[ "def", "initialize_references_json", "(", "references_json", ",", "references", ",", "setter", "=", "None", ")", ":", "for", "obj", "in", "references_json", ":", "obj_id", "=", "obj", "[", "'id'", "]", "obj_attrs", "=", "obj", "[", "'attributes'", "]", "inst...
Given a JSON representation of the models in a graph, and new model objects, set the properties on the models from the JSON Args: references_json (``JSON``) JSON specifying attributes and values to initialize new model objects with. references (dict[str, Model]) ...
[ "Given", "a", "JSON", "representation", "of", "the", "models", "in", "a", "graph", "and", "new", "model", "objects", "set", "the", "properties", "on", "the", "models", "from", "the", "JSON" ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/util.py#L50-L90
train
bokeh/bokeh
bokeh/document/util.py
instantiate_references_json
def instantiate_references_json(references_json): ''' Given a JSON representation of all the models in a graph, return a dict of new model objects. Args: references_json (``JSON``) JSON specifying new Bokeh models to create Returns: dict[str, Model] ''' # Create a...
python
def instantiate_references_json(references_json): ''' Given a JSON representation of all the models in a graph, return a dict of new model objects. Args: references_json (``JSON``) JSON specifying new Bokeh models to create Returns: dict[str, Model] ''' # Create a...
[ "def", "instantiate_references_json", "(", "references_json", ")", ":", "# Create all instances, but without setting their props", "references", "=", "{", "}", "for", "obj", "in", "references_json", ":", "obj_id", "=", "obj", "[", "'id'", "]", "obj_type", "=", "obj", ...
Given a JSON representation of all the models in a graph, return a dict of new model objects. Args: references_json (``JSON``) JSON specifying new Bokeh models to create Returns: dict[str, Model]
[ "Given", "a", "JSON", "representation", "of", "all", "the", "models", "in", "a", "graph", "return", "a", "dict", "of", "new", "model", "objects", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/util.py#L92-L117
train
bokeh/bokeh
bokeh/document/util.py
references_json
def references_json(references): ''' Given a list of all models in a graph, return JSON representing them and their properties. Args: references (seq[Model]) : A list of models to convert to JSON Returns: list ''' references_json = [] for r in references: ...
python
def references_json(references): ''' Given a list of all models in a graph, return JSON representing them and their properties. Args: references (seq[Model]) : A list of models to convert to JSON Returns: list ''' references_json = [] for r in references: ...
[ "def", "references_json", "(", "references", ")", ":", "references_json", "=", "[", "]", "for", "r", "in", "references", ":", "ref", "=", "r", ".", "ref", "ref", "[", "'attributes'", "]", "=", "r", ".", "_to_json_like", "(", "include_defaults", "=", "Fal...
Given a list of all models in a graph, return JSON representing them and their properties. Args: references (seq[Model]) : A list of models to convert to JSON Returns: list
[ "Given", "a", "list", "of", "all", "models", "in", "a", "graph", "return", "JSON", "representing", "them", "and", "their", "properties", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/util.py#L119-L138
train
bokeh/bokeh
bokeh/events.py
Event.decode_json
def decode_json(cls, dct): ''' Custom JSON decoder for Events. Can be used as the ``object_hook`` argument of ``json.load`` or ``json.loads``. Args: dct (dict) : a JSON dictionary to decode The dictionary should have keys ``event_name`` and ``event_values`` ...
python
def decode_json(cls, dct): ''' Custom JSON decoder for Events. Can be used as the ``object_hook`` argument of ``json.load`` or ``json.loads``. Args: dct (dict) : a JSON dictionary to decode The dictionary should have keys ``event_name`` and ``event_values`` ...
[ "def", "decode_json", "(", "cls", ",", "dct", ")", ":", "if", "not", "(", "'event_name'", "in", "dct", "and", "'event_values'", "in", "dct", ")", ":", "return", "dct", "event_name", "=", "dct", "[", "'event_name'", "]", "if", "event_name", "not", "in", ...
Custom JSON decoder for Events. Can be used as the ``object_hook`` argument of ``json.load`` or ``json.loads``. Args: dct (dict) : a JSON dictionary to decode The dictionary should have keys ``event_name`` and ``event_values`` Raises: ValueError...
[ "Custom", "JSON", "decoder", "for", "Events", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/events.py#L150-L186
train
bokeh/bokeh
bokeh/sphinxext/bokeh_palette.py
bokeh_palette
def bokeh_palette(name, rawtext, text, lineno, inliner, options=None, content=None): ''' Generate an inline visual representations of a single color palette. This function evaluates the expression ``"palette = %s" % text``, in the context of a ``globals`` namespace that has previously imported all of `...
python
def bokeh_palette(name, rawtext, text, lineno, inliner, options=None, content=None): ''' Generate an inline visual representations of a single color palette. This function evaluates the expression ``"palette = %s" % text``, in the context of a ``globals`` namespace that has previously imported all of `...
[ "def", "bokeh_palette", "(", "name", ",", "rawtext", ",", "text", ",", "lineno", ",", "inliner", ",", "options", "=", "None", ",", "content", "=", "None", ")", ":", "try", ":", "exec", "(", "\"palette = %s\"", "%", "text", ",", "_globals", ")", "except...
Generate an inline visual representations of a single color palette. This function evaluates the expression ``"palette = %s" % text``, in the context of a ``globals`` namespace that has previously imported all of ``bokeh.plotting``. The resulting value for ``palette`` is used to construct a sequence of...
[ "Generate", "an", "inline", "visual", "representations", "of", "a", "single", "color", "palette", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/sphinxext/bokeh_palette.py#L89-L115
train
bokeh/bokeh
bokeh/transform.py
cumsum
def cumsum(field, include_zero=False): ''' Create a Create a ``DataSpec`` dict to generate a ``CumSum`` expression for a ``ColumnDataSource``. Examples: .. code-block:: python p.wedge(start_angle=cumsum('angle', include_zero=True), end_angle=cumsum('angle'), ...
python
def cumsum(field, include_zero=False): ''' Create a Create a ``DataSpec`` dict to generate a ``CumSum`` expression for a ``ColumnDataSource``. Examples: .. code-block:: python p.wedge(start_angle=cumsum('angle', include_zero=True), end_angle=cumsum('angle'), ...
[ "def", "cumsum", "(", "field", ",", "include_zero", "=", "False", ")", ":", "return", "expr", "(", "CumSum", "(", "field", "=", "field", ",", "include_zero", "=", "include_zero", ")", ")" ]
Create a Create a ``DataSpec`` dict to generate a ``CumSum`` expression for a ``ColumnDataSource``. Examples: .. code-block:: python p.wedge(start_angle=cumsum('angle', include_zero=True), end_angle=cumsum('angle'), ...) will generate a ``C...
[ "Create", "a", "Create", "a", "DataSpec", "dict", "to", "generate", "a", "CumSum", "expression", "for", "a", "ColumnDataSource", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/transform.py#L55-L74
train
bokeh/bokeh
bokeh/transform.py
dodge
def dodge(field_name, value, range=None): ''' Create a ``DataSpec`` dict that applies a client-side ``Jitter`` transformation to a ``ColumnDataSource`` column. Args: field_name (str) : a field name to configure ``DataSpec`` with value (float) : the fixed offset to add to column data ...
python
def dodge(field_name, value, range=None): ''' Create a ``DataSpec`` dict that applies a client-side ``Jitter`` transformation to a ``ColumnDataSource`` column. Args: field_name (str) : a field name to configure ``DataSpec`` with value (float) : the fixed offset to add to column data ...
[ "def", "dodge", "(", "field_name", ",", "value", ",", "range", "=", "None", ")", ":", "return", "field", "(", "field_name", ",", "Dodge", "(", "value", "=", "value", ",", "range", "=", "range", ")", ")" ]
Create a ``DataSpec`` dict that applies a client-side ``Jitter`` transformation to a ``ColumnDataSource`` column. Args: field_name (str) : a field name to configure ``DataSpec`` with value (float) : the fixed offset to add to column data range (Range, optional) : a range to use for co...
[ "Create", "a", "DataSpec", "dict", "that", "applies", "a", "client", "-", "side", "Jitter", "transformation", "to", "a", "ColumnDataSource", "column", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/transform.py#L76-L93
train
bokeh/bokeh
bokeh/transform.py
factor_cmap
def factor_cmap(field_name, palette, factors, start=0, end=None, nan_color="gray"): ''' Create a ``DataSpec`` dict that applies a client-side ``CategoricalColorMapper`` transformation to a ``ColumnDataSource`` column. Args: field_name (str) : a field name to configure ``DataSpec`` with ...
python
def factor_cmap(field_name, palette, factors, start=0, end=None, nan_color="gray"): ''' Create a ``DataSpec`` dict that applies a client-side ``CategoricalColorMapper`` transformation to a ``ColumnDataSource`` column. Args: field_name (str) : a field name to configure ``DataSpec`` with ...
[ "def", "factor_cmap", "(", "field_name", ",", "palette", ",", "factors", ",", "start", "=", "0", ",", "end", "=", "None", ",", "nan_color", "=", "\"gray\"", ")", ":", "return", "field", "(", "field_name", ",", "CategoricalColorMapper", "(", "palette", "=",...
Create a ``DataSpec`` dict that applies a client-side ``CategoricalColorMapper`` transformation to a ``ColumnDataSource`` column. Args: field_name (str) : a field name to configure ``DataSpec`` with palette (seq[color]) : a list of colors to use for colormapping factors (seq) : a ...
[ "Create", "a", "DataSpec", "dict", "that", "applies", "a", "client", "-", "side", "CategoricalColorMapper", "transformation", "to", "a", "ColumnDataSource", "column", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/transform.py#L95-L125
train
bokeh/bokeh
bokeh/transform.py
factor_hatch
def factor_hatch(field_name, patterns, factors, start=0, end=None): ''' Create a ``DataSpec`` dict that applies a client-side ``CategoricalPatternMapper`` transformation to a ``ColumnDataSource`` column. Args: field_name (str) : a field name to configure ``DataSpec`` with patterns (seq...
python
def factor_hatch(field_name, patterns, factors, start=0, end=None): ''' Create a ``DataSpec`` dict that applies a client-side ``CategoricalPatternMapper`` transformation to a ``ColumnDataSource`` column. Args: field_name (str) : a field name to configure ``DataSpec`` with patterns (seq...
[ "def", "factor_hatch", "(", "field_name", ",", "patterns", ",", "factors", ",", "start", "=", "0", ",", "end", "=", "None", ")", ":", "return", "field", "(", "field_name", ",", "CategoricalPatternMapper", "(", "patterns", "=", "patterns", ",", "factors", "...
Create a ``DataSpec`` dict that applies a client-side ``CategoricalPatternMapper`` transformation to a ``ColumnDataSource`` column. Args: field_name (str) : a field name to configure ``DataSpec`` with patterns (seq[string]) : a list of hatch patterns to use to map to factors (seq)...
[ "Create", "a", "DataSpec", "dict", "that", "applies", "a", "client", "-", "side", "CategoricalPatternMapper", "transformation", "to", "a", "ColumnDataSource", "column", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/transform.py#L127-L155
train
bokeh/bokeh
bokeh/transform.py
factor_mark
def factor_mark(field_name, markers, factors, start=0, end=None): ''' Create a ``DataSpec`` dict that applies a client-side ``CategoricalMarkerMapper`` transformation to a ``ColumnDataSource`` column. .. note:: This transform is primarily only useful with ``scatter``, which can be param...
python
def factor_mark(field_name, markers, factors, start=0, end=None): ''' Create a ``DataSpec`` dict that applies a client-side ``CategoricalMarkerMapper`` transformation to a ``ColumnDataSource`` column. .. note:: This transform is primarily only useful with ``scatter``, which can be param...
[ "def", "factor_mark", "(", "field_name", ",", "markers", ",", "factors", ",", "start", "=", "0", ",", "end", "=", "None", ")", ":", "return", "field", "(", "field_name", ",", "CategoricalMarkerMapper", "(", "markers", "=", "markers", ",", "factors", "=", ...
Create a ``DataSpec`` dict that applies a client-side ``CategoricalMarkerMapper`` transformation to a ``ColumnDataSource`` column. .. note:: This transform is primarily only useful with ``scatter``, which can be parameterized by glyph type. Args: field_name (str) : a field name...
[ "Create", "a", "DataSpec", "dict", "that", "applies", "a", "client", "-", "side", "CategoricalMarkerMapper", "transformation", "to", "a", "ColumnDataSource", "column", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/transform.py#L157-L187
train
bokeh/bokeh
bokeh/transform.py
jitter
def jitter(field_name, width, mean=0, distribution="uniform", range=None): ''' Create a ``DataSpec`` dict that applies a client-side ``Jitter`` transformation to a ``ColumnDataSource`` column. Args: field_name (str) : a field name to configure ``DataSpec`` with width (float) : the width of...
python
def jitter(field_name, width, mean=0, distribution="uniform", range=None): ''' Create a ``DataSpec`` dict that applies a client-side ``Jitter`` transformation to a ``ColumnDataSource`` column. Args: field_name (str) : a field name to configure ``DataSpec`` with width (float) : the width of...
[ "def", "jitter", "(", "field_name", ",", "width", ",", "mean", "=", "0", ",", "distribution", "=", "\"uniform\"", ",", "range", "=", "None", ")", ":", "return", "field", "(", "field_name", ",", "Jitter", "(", "mean", "=", "mean", ",", "width", "=", "...
Create a ``DataSpec`` dict that applies a client-side ``Jitter`` transformation to a ``ColumnDataSource`` column. Args: field_name (str) : a field name to configure ``DataSpec`` with width (float) : the width of the random distribution to apply mean (float, optional) : an offset to ap...
[ "Create", "a", "DataSpec", "dict", "that", "applies", "a", "client", "-", "side", "Jitter", "transformation", "to", "a", "ColumnDataSource", "column", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/transform.py#L189-L214
train