id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
30,400
bokeh/bokeh
bokeh/protocol/receiver.py
Receiver.consume
def consume(self, fragment): ''' Consume individual protocol message fragments. Args: fragment (``JSON``) : A message fragment to assemble. When a complete message is assembled, the receiver state will reset to begin consuming a new message. ...
python
def consume(self, fragment): ''' Consume individual protocol message fragments. Args: fragment (``JSON``) : A message fragment to assemble. When a complete message is assembled, the receiver state will reset to begin consuming a new message. ...
[ "def", "consume", "(", "self", ",", "fragment", ")", ":", "self", ".", "_current_consumer", "(", "fragment", ")", "raise", "gen", ".", "Return", "(", "self", ".", "_message", ")" ]
Consume individual protocol message fragments. Args: fragment (``JSON``) : A message fragment to assemble. When a complete message is assembled, the receiver state will reset to begin consuming a new message.
[ "Consume", "individual", "protocol", "message", "fragments", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/protocol/receiver.py#L108-L119
30,401
bokeh/bokeh
bokeh/driving.py
bounce
def bounce(sequence): ''' Return a driver function that can advance a "bounced" sequence of values. .. code-block:: none seq = [0, 1, 2, 3] # bounce(seq) => [0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, ...] Args: sequence (seq) : a sequence of values for the driver to bounce ''' ...
python
def bounce(sequence): ''' Return a driver function that can advance a "bounced" sequence of values. .. code-block:: none seq = [0, 1, 2, 3] # bounce(seq) => [0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, ...] Args: sequence (seq) : a sequence of values for the driver to bounce ''' ...
[ "def", "bounce", "(", "sequence", ")", ":", "N", "=", "len", "(", "sequence", ")", "def", "f", "(", "i", ")", ":", "div", ",", "mod", "=", "divmod", "(", "i", ",", "N", ")", "if", "div", "%", "2", "==", "0", ":", "return", "sequence", "[", ...
Return a driver function that can advance a "bounced" sequence of values. .. code-block:: none seq = [0, 1, 2, 3] # bounce(seq) => [0, 1, 2, 3, 3, 2, 1, 0, 0, 1, 2, ...] Args: sequence (seq) : a sequence of values for the driver to bounce
[ "Return", "a", "driver", "function", "that", "can", "advance", "a", "bounced", "sequence", "of", "values", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/driving.py#L73-L94
30,402
bokeh/bokeh
bokeh/driving.py
cosine
def cosine(w, A=1, phi=0, offset=0): ''' Return a driver function that can advance a sequence of cosine values. .. code-block:: none value = A * cos(w*i + phi) + offset Args: w (float) : a frequency for the cosine driver A (float) : an amplitude for the cosine driver phi (...
python
def cosine(w, A=1, phi=0, offset=0): ''' Return a driver function that can advance a sequence of cosine values. .. code-block:: none value = A * cos(w*i + phi) + offset Args: w (float) : a frequency for the cosine driver A (float) : an amplitude for the cosine driver phi (...
[ "def", "cosine", "(", "w", ",", "A", "=", "1", ",", "phi", "=", "0", ",", "offset", "=", "0", ")", ":", "from", "math", "import", "cos", "def", "f", "(", "i", ")", ":", "return", "A", "*", "cos", "(", "w", "*", "i", "+", "phi", ")", "+", ...
Return a driver function that can advance a sequence of cosine values. .. code-block:: none value = A * cos(w*i + phi) + offset Args: w (float) : a frequency for the cosine driver A (float) : an amplitude for the cosine driver phi (float) : a phase offset to start the cosine d...
[ "Return", "a", "driver", "function", "that", "can", "advance", "a", "sequence", "of", "cosine", "values", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/driving.py#L96-L113
30,403
bokeh/bokeh
bokeh/driving.py
linear
def linear(m=1, b=0): ''' Return a driver function that can advance a sequence of linear values. .. code-block:: none value = m * i + b Args: m (float) : a slope for the linear driver x (float) : an offset for the linear driver ''' def f(i): return m * i + b r...
python
def linear(m=1, b=0): ''' Return a driver function that can advance a sequence of linear values. .. code-block:: none value = m * i + b Args: m (float) : a slope for the linear driver x (float) : an offset for the linear driver ''' def f(i): return m * i + b r...
[ "def", "linear", "(", "m", "=", "1", ",", "b", "=", "0", ")", ":", "def", "f", "(", "i", ")", ":", "return", "m", "*", "i", "+", "b", "return", "partial", "(", "force", ",", "sequence", "=", "_advance", "(", "f", ")", ")" ]
Return a driver function that can advance a sequence of linear values. .. code-block:: none value = m * i + b Args: m (float) : a slope for the linear driver x (float) : an offset for the linear driver
[ "Return", "a", "driver", "function", "that", "can", "advance", "a", "sequence", "of", "linear", "values", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/driving.py#L137-L151
30,404
bokeh/bokeh
bokeh/driving.py
repeat
def repeat(sequence): ''' Return a driver function that can advance a repeated of values. .. code-block:: none seq = [0, 1, 2, 3] # repeat(seq) => [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, ...] Args: sequence (seq) : a sequence of values for the driver to bounce ''' N = len(sequenc...
python
def repeat(sequence): ''' Return a driver function that can advance a repeated of values. .. code-block:: none seq = [0, 1, 2, 3] # repeat(seq) => [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, ...] Args: sequence (seq) : a sequence of values for the driver to bounce ''' N = len(sequenc...
[ "def", "repeat", "(", "sequence", ")", ":", "N", "=", "len", "(", "sequence", ")", "def", "f", "(", "i", ")", ":", "return", "sequence", "[", "i", "%", "N", "]", "return", "partial", "(", "force", ",", "sequence", "=", "_advance", "(", "f", ")", ...
Return a driver function that can advance a repeated of values. .. code-block:: none seq = [0, 1, 2, 3] # repeat(seq) => [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, ...] Args: sequence (seq) : a sequence of values for the driver to bounce
[ "Return", "a", "driver", "function", "that", "can", "advance", "a", "repeated", "of", "values", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/driving.py#L153-L169
30,405
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
30,406
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
30,407
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
30,408
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
30,409
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
30,410
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
30,411
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
30,412
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
30,413
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
30,414
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
30,415
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
30,416
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
30,417
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
30,418
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
30,419
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
30,420
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
30,421
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
30,422
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
30,423
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
30,424
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
30,425
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
30,426
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
30,427
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
30,428
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
30,429
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
30,430
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
30,431
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
30,432
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
30,433
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
30,434
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
30,435
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
30,436
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
30,437
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
30,438
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
30,439
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
30,440
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
30,441
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
30,442
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
30,443
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
30,444
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
30,445
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
30,446
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
30,447
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
30,448
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
30,449
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
30,450
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
30,451
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
30,452
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
30,453
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
30,454
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
30,455
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
30,456
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
30,457
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
30,458
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
30,459
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
30,460
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
30,461
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
30,462
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
30,463
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
30,464
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
30,465
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
30,466
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
30,467
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
30,468
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
30,469
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
30,470
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
30,471
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
30,472
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
30,473
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
30,474
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
30,475
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
30,476
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
30,477
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
30,478
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
30,479
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
30,480
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
30,481
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
30,482
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
30,483
bokeh/bokeh
bokeh/transform.py
linear_cmap
def linear_cmap(field_name, palette, low, high, low_color=None, high_color=None, nan_color="gray"): ''' Create a ``DataSpec`` dict that applyies a client-side ``LinearColorMapper`` transformation to a ``ColumnDataSource`` column. Args: field_name (str) : a field name to configure ``DataSpec`` with ...
python
def linear_cmap(field_name, palette, low, high, low_color=None, high_color=None, nan_color="gray"): ''' Create a ``DataSpec`` dict that applyies a client-side ``LinearColorMapper`` transformation to a ``ColumnDataSource`` column. Args: field_name (str) : a field name to configure ``DataSpec`` with ...
[ "def", "linear_cmap", "(", "field_name", ",", "palette", ",", "low", ",", "high", ",", "low_color", "=", "None", ",", "high_color", "=", "None", ",", "nan_color", "=", "\"gray\"", ")", ":", "return", "field", "(", "field_name", ",", "LinearColorMapper", "(...
Create a ``DataSpec`` dict that applyies a client-side ``LinearColorMapper`` 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 low (float) : a minimum va...
[ "Create", "a", "DataSpec", "dict", "that", "applyies", "a", "client", "-", "side", "LinearColorMapper", "transformation", "to", "a", "ColumnDataSource", "column", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/transform.py#L216-L248
30,484
bokeh/bokeh
bokeh/transform.py
log_cmap
def log_cmap(field_name, palette, low, high, low_color=None, high_color=None, nan_color="gray"): ''' Create a ``DataSpec`` dict that applies a client-side ``LogColorMapper`` transformation to a ``ColumnDataSource`` column. Args: field_name (str) : a field name to configure ``DataSpec`` with ...
python
def log_cmap(field_name, palette, low, high, low_color=None, high_color=None, nan_color="gray"): ''' Create a ``DataSpec`` dict that applies a client-side ``LogColorMapper`` transformation to a ``ColumnDataSource`` column. Args: field_name (str) : a field name to configure ``DataSpec`` with ...
[ "def", "log_cmap", "(", "field_name", ",", "palette", ",", "low", ",", "high", ",", "low_color", "=", "None", ",", "high_color", "=", "None", ",", "nan_color", "=", "\"gray\"", ")", ":", "return", "field", "(", "field_name", ",", "LogColorMapper", "(", "...
Create a ``DataSpec`` dict that applies a client-side ``LogColorMapper`` 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 low (float) : a minimum value ...
[ "Create", "a", "DataSpec", "dict", "that", "applies", "a", "client", "-", "side", "LogColorMapper", "transformation", "to", "a", "ColumnDataSource", "column", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/transform.py#L250-L282
30,485
bokeh/bokeh
bokeh/util/browser.py
get_browser_controller
def get_browser_controller(browser=None): ''' Return a browser controller. Args: browser (str or None) : browser name, or ``None`` (default: ``None``) If passed the string ``'none'``, a dummy web browser controller is returned Otherwise, use the value to select an a...
python
def get_browser_controller(browser=None): ''' Return a browser controller. Args: browser (str or None) : browser name, or ``None`` (default: ``None``) If passed the string ``'none'``, a dummy web browser controller is returned Otherwise, use the value to select an a...
[ "def", "get_browser_controller", "(", "browser", "=", "None", ")", ":", "browser", "=", "settings", ".", "browser", "(", "browser", ")", "if", "browser", "is", "not", "None", ":", "if", "browser", "==", "'none'", ":", "controller", "=", "DummyWebBrowser", ...
Return a browser controller. Args: browser (str or None) : browser name, or ``None`` (default: ``None``) If passed the string ``'none'``, a dummy web browser controller is returned Otherwise, use the value to select an appropriate controller using the ``webb...
[ "Return", "a", "browser", "controller", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/browser.py#L56-L86
30,486
bokeh/bokeh
bokeh/util/browser.py
view
def view(location, browser=None, new="same", autoraise=True): ''' Open a browser to view the specified location. Args: location (str) : Location to open If location does not begin with "http:" it is assumed to be a file path on the local filesystem. ...
python
def view(location, browser=None, new="same", autoraise=True): ''' Open a browser to view the specified location. Args: location (str) : Location to open If location does not begin with "http:" it is assumed to be a file path on the local filesystem. ...
[ "def", "view", "(", "location", ",", "browser", "=", "None", ",", "new", "=", "\"same\"", ",", "autoraise", "=", "True", ")", ":", "try", ":", "new", "=", "{", "\"same\"", ":", "0", ",", "\"window\"", ":", "1", ",", "\"tab\"", ":", "2", "}", "[",...
Open a browser to view the specified location. Args: location (str) : Location to open If location does not begin with "http:" it is assumed to be a file path on the local filesystem. browser (str or None) : what browser to use (default: None) ...
[ "Open", "a", "browser", "to", "view", "the", "specified", "location", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/util/browser.py#L88-L127
30,487
bokeh/bokeh
bokeh/models/filters.py
CustomJSFilter.from_py_func
def from_py_func(cls, func): ''' Create a ``CustomJSFilter`` instance from a Python function. The function is translated to JavaScript using PScript. The ``func`` function namespace will contain the variable ``source`` at render time. This will be the data source associated with the ``C...
python
def from_py_func(cls, func): ''' Create a ``CustomJSFilter`` instance from a Python function. The function is translated to JavaScript using PScript. The ``func`` function namespace will contain the variable ``source`` at render time. This will be the data source associated with the ``C...
[ "def", "from_py_func", "(", "cls", ",", "func", ")", ":", "from", "bokeh", ".", "util", ".", "deprecation", "import", "deprecated", "deprecated", "(", "\"'from_py_func' is deprecated and will be removed in an eventual 2.0 release. \"", "\"Use CustomJSFilter directly instead.\""...
Create a ``CustomJSFilter`` instance from a Python function. The function is translated to JavaScript using PScript. The ``func`` function namespace will contain the variable ``source`` at render time. This will be the data source associated with the ``CDSView`` that this filter is adde...
[ "Create", "a", "CustomJSFilter", "instance", "from", "a", "Python", "function", ".", "The", "function", "is", "translated", "to", "JavaScript", "using", "PScript", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/models/filters.py#L125-L162
30,488
bokeh/bokeh
examples/howto/events_app.py
print_event
def print_event(attributes=[]): """ Function that returns a Python callback to pretty print the events. """ def python_callback(event): cls_name = event.__class__.__name__ attrs = ', '.join(['{attr}={val}'.format(attr=attr, val=event.__dict__[attr]) for attr in att...
python
def print_event(attributes=[]): """ Function that returns a Python callback to pretty print the events. """ def python_callback(event): cls_name = event.__class__.__name__ attrs = ', '.join(['{attr}={val}'.format(attr=attr, val=event.__dict__[attr]) for attr in att...
[ "def", "print_event", "(", "attributes", "=", "[", "]", ")", ":", "def", "python_callback", "(", "event", ")", ":", "cls_name", "=", "event", ".", "__class__", ".", "__name__", "attrs", "=", "', '", ".", "join", "(", "[", "'{attr}={val}'", ".", "format",...
Function that returns a Python callback to pretty print the events.
[ "Function", "that", "returns", "a", "Python", "callback", "to", "pretty", "print", "the", "events", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/examples/howto/events_app.py#L39-L48
30,489
bokeh/bokeh
bokeh/protocol/__init__.py
Protocol.create
def create(self, msgtype, *args, **kwargs): ''' Create a new Message instance for the given type. Args: msgtype (str) : ''' if msgtype not in self._messages: raise ProtocolError("Unknown message type %r for protocol version %s" % (msgtype, self._version)) ...
python
def create(self, msgtype, *args, **kwargs): ''' Create a new Message instance for the given type. Args: msgtype (str) : ''' if msgtype not in self._messages: raise ProtocolError("Unknown message type %r for protocol version %s" % (msgtype, self._version)) ...
[ "def", "create", "(", "self", ",", "msgtype", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "msgtype", "not", "in", "self", ".", "_messages", ":", "raise", "ProtocolError", "(", "\"Unknown message type %r for protocol version %s\"", "%", "(", "m...
Create a new Message instance for the given type. Args: msgtype (str) :
[ "Create", "a", "new", "Message", "instance", "for", "the", "given", "type", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/protocol/__init__.py#L71-L80
30,490
bokeh/bokeh
bokeh/protocol/__init__.py
Protocol.assemble
def assemble(self, header_json, metadata_json, content_json): ''' Create a Message instance assembled from json fragments. Args: header_json (``JSON``) : metadata_json (``JSON``) : content_json (``JSON``) : Returns: message ''' ...
python
def assemble(self, header_json, metadata_json, content_json): ''' Create a Message instance assembled from json fragments. Args: header_json (``JSON``) : metadata_json (``JSON``) : content_json (``JSON``) : Returns: message ''' ...
[ "def", "assemble", "(", "self", ",", "header_json", ",", "metadata_json", ",", "content_json", ")", ":", "header", "=", "json_decode", "(", "header_json", ")", "if", "'msgtype'", "not", "in", "header", ":", "log", ".", "error", "(", "\"Bad header with no msgty...
Create a Message instance assembled from json fragments. Args: header_json (``JSON``) : metadata_json (``JSON``) : content_json (``JSON``) : Returns: message
[ "Create", "a", "Message", "instance", "assembled", "from", "json", "fragments", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/protocol/__init__.py#L82-L102
30,491
bokeh/bokeh
bokeh/document/document.py
_combine_document_events
def _combine_document_events(new_event, old_events): ''' Attempt to combine a new event with a list of previous events. The ``old_event`` will be scanned in reverse, and ``.combine(new_event)`` will be called on each. If a combination can be made, the function will return immediately. Otherwise, ``new_...
python
def _combine_document_events(new_event, old_events): ''' Attempt to combine a new event with a list of previous events. The ``old_event`` will be scanned in reverse, and ``.combine(new_event)`` will be called on each. If a combination can be made, the function will return immediately. Otherwise, ``new_...
[ "def", "_combine_document_events", "(", "new_event", ",", "old_events", ")", ":", "for", "event", "in", "reversed", "(", "old_events", ")", ":", "if", "event", ".", "combine", "(", "new_event", ")", ":", "return", "# no combination was possible", "old_events", "...
Attempt to combine a new event with a list of previous events. The ``old_event`` will be scanned in reverse, and ``.combine(new_event)`` will be called on each. If a combination can be made, the function will return immediately. Otherwise, ``new_event`` will be appended to ``old_events``. Args: ...
[ "Attempt", "to", "combine", "a", "new", "event", "with", "a", "list", "of", "previous", "events", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/document.py#L1131-L1158
30,492
bokeh/bokeh
bokeh/document/document.py
Document.add_next_tick_callback
def add_next_tick_callback(self, callback): ''' Add callback to be invoked once on the next tick of the event loop. Args: callback (callable) : A callback function to execute on the next tick. Returns: NextTickCallback : can be used with ``remove_next_ti...
python
def add_next_tick_callback(self, callback): ''' Add callback to be invoked once on the next tick of the event loop. Args: callback (callable) : A callback function to execute on the next tick. Returns: NextTickCallback : can be used with ``remove_next_ti...
[ "def", "add_next_tick_callback", "(", "self", ",", "callback", ")", ":", "from", ".", ".", "server", ".", "callbacks", "import", "NextTickCallback", "cb", "=", "NextTickCallback", "(", "self", ",", "None", ")", "return", "self", ".", "_add_session_callback", "...
Add callback to be invoked once on the next tick of the event loop. Args: callback (callable) : A callback function to execute on the next tick. Returns: NextTickCallback : can be used with ``remove_next_tick_callback`` .. note:: Next tick c...
[ "Add", "callback", "to", "be", "invoked", "once", "on", "the", "next", "tick", "of", "the", "event", "loop", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/document.py#L226-L244
30,493
bokeh/bokeh
bokeh/document/document.py
Document.add_periodic_callback
def add_periodic_callback(self, callback, period_milliseconds): ''' Add a callback to be invoked on a session periodically. Args: callback (callable) : A callback function to execute periodically period_milliseconds (int) : Number of milliseconds...
python
def add_periodic_callback(self, callback, period_milliseconds): ''' Add a callback to be invoked on a session periodically. Args: callback (callable) : A callback function to execute periodically period_milliseconds (int) : Number of milliseconds...
[ "def", "add_periodic_callback", "(", "self", ",", "callback", ",", "period_milliseconds", ")", ":", "from", ".", ".", "server", ".", "callbacks", "import", "PeriodicCallback", "cb", "=", "PeriodicCallback", "(", "self", ",", "None", ",", "period_milliseconds", "...
Add a callback to be invoked on a session periodically. Args: callback (callable) : A callback function to execute periodically period_milliseconds (int) : Number of milliseconds between each callback execution. Returns: PeriodicCall...
[ "Add", "a", "callback", "to", "be", "invoked", "on", "a", "session", "periodically", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/document.py#L246-L269
30,494
bokeh/bokeh
bokeh/document/document.py
Document.add_root
def add_root(self, model, setter=None): ''' Add a model as a root of this Document. Any changes to this model (including to other models referred to by it) will trigger ``on_change`` callbacks registered on this document. Args: model (Model) : The mo...
python
def add_root(self, model, setter=None): ''' Add a model as a root of this Document. Any changes to this model (including to other models referred to by it) will trigger ``on_change`` callbacks registered on this document. Args: model (Model) : The mo...
[ "def", "add_root", "(", "self", ",", "model", ",", "setter", "=", "None", ")", ":", "if", "model", "in", "self", ".", "_roots", ":", "return", "self", ".", "_push_all_models_freeze", "(", ")", "# TODO (bird) Should we do some kind of reporting of how many", "# Lay...
Add a model as a root of this Document. Any changes to this model (including to other models referred to by it) will trigger ``on_change`` callbacks registered on this document. Args: model (Model) : The model to add as a root of this document. ...
[ "Add", "a", "model", "as", "a", "root", "of", "this", "Document", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/document.py#L271-L305
30,495
bokeh/bokeh
bokeh/document/document.py
Document.add_timeout_callback
def add_timeout_callback(self, callback, timeout_milliseconds): ''' Add callback to be invoked once, after a specified timeout passes. Args: callback (callable) : A callback function to execute after timeout timeout_milliseconds (int) : Number of...
python
def add_timeout_callback(self, callback, timeout_milliseconds): ''' Add callback to be invoked once, after a specified timeout passes. Args: callback (callable) : A callback function to execute after timeout timeout_milliseconds (int) : Number of...
[ "def", "add_timeout_callback", "(", "self", ",", "callback", ",", "timeout_milliseconds", ")", ":", "from", ".", ".", "server", ".", "callbacks", "import", "TimeoutCallback", "cb", "=", "TimeoutCallback", "(", "self", ",", "None", ",", "timeout_milliseconds", ")...
Add callback to be invoked once, after a specified timeout passes. Args: callback (callable) : A callback function to execute after timeout timeout_milliseconds (int) : Number of milliseconds before callback execution. Returns: Timeo...
[ "Add", "callback", "to", "be", "invoked", "once", "after", "a", "specified", "timeout", "passes", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/document.py#L307-L330
30,496
bokeh/bokeh
bokeh/document/document.py
Document.clear
def clear(self): ''' Remove all content from the document but do not reset title. Returns: None ''' self._push_all_models_freeze() try: while len(self._roots) > 0: r = next(iter(self._roots)) self.remove_root(r) fi...
python
def clear(self): ''' Remove all content from the document but do not reset title. Returns: None ''' self._push_all_models_freeze() try: while len(self._roots) > 0: r = next(iter(self._roots)) self.remove_root(r) fi...
[ "def", "clear", "(", "self", ")", ":", "self", ".", "_push_all_models_freeze", "(", ")", "try", ":", "while", "len", "(", "self", ".", "_roots", ")", ">", "0", ":", "r", "=", "next", "(", "iter", "(", "self", ".", "_roots", ")", ")", "self", ".",...
Remove all content from the document but do not reset title. Returns: None
[ "Remove", "all", "content", "from", "the", "document", "but", "do", "not", "reset", "title", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/document.py#L450-L463
30,497
bokeh/bokeh
bokeh/document/document.py
Document.delete_modules
def delete_modules(self): ''' Clean up after any modules created by this Document when its session is destroyed. ''' from gc import get_referrers from types import FrameType log.debug("Deleting %s modules for %s" % (len(self._modules), self)) for module in self...
python
def delete_modules(self): ''' Clean up after any modules created by this Document when its session is destroyed. ''' from gc import get_referrers from types import FrameType log.debug("Deleting %s modules for %s" % (len(self._modules), self)) for module in self...
[ "def", "delete_modules", "(", "self", ")", ":", "from", "gc", "import", "get_referrers", "from", "types", "import", "FrameType", "log", ".", "debug", "(", "\"Deleting %s modules for %s\"", "%", "(", "len", "(", "self", ".", "_modules", ")", ",", "self", ")",...
Clean up after any modules created by this Document when its session is destroyed.
[ "Clean", "up", "after", "any", "modules", "created", "by", "this", "Document", "when", "its", "session", "is", "destroyed", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/document.py#L485-L520
30,498
bokeh/bokeh
bokeh/document/document.py
Document.from_json
def from_json(cls, json): ''' Load a document from JSON. json (JSON-data) : A JSON-encoded document to create a new Document from. Returns: Document : ''' roots_json = json['roots'] root_ids = roots_json['root_ids'] references_json = roo...
python
def from_json(cls, json): ''' Load a document from JSON. json (JSON-data) : A JSON-encoded document to create a new Document from. Returns: Document : ''' roots_json = json['roots'] root_ids = roots_json['root_ids'] references_json = roo...
[ "def", "from_json", "(", "cls", ",", "json", ")", ":", "roots_json", "=", "json", "[", "'roots'", "]", "root_ids", "=", "roots_json", "[", "'root_ids'", "]", "references_json", "=", "roots_json", "[", "'references'", "]", "references", "=", "instantiate_refere...
Load a document from JSON. json (JSON-data) : A JSON-encoded document to create a new Document from. Returns: Document :
[ "Load", "a", "document", "from", "JSON", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/document.py#L525-L548
30,499
bokeh/bokeh
bokeh/document/document.py
Document.hold
def hold(self, policy="combine"): ''' Activate a document hold. While a hold is active, no model changes will be applied, or trigger callbacks. Once ``unhold`` is called, the events collected during the hold will be applied according to the hold policy. Args: hold (...
python
def hold(self, policy="combine"): ''' Activate a document hold. While a hold is active, no model changes will be applied, or trigger callbacks. Once ``unhold`` is called, the events collected during the hold will be applied according to the hold policy. Args: hold (...
[ "def", "hold", "(", "self", ",", "policy", "=", "\"combine\"", ")", ":", "if", "self", ".", "_hold", "is", "not", "None", "and", "self", ".", "_hold", "!=", "policy", ":", "log", ".", "warning", "(", "\"hold already active with '%s', ignoring '%s'\"", "%", ...
Activate a document hold. While a hold is active, no model changes will be applied, or trigger callbacks. Once ``unhold`` is called, the events collected during the hold will be applied according to the hold policy. Args: hold ('combine' or 'collect', optional) ...
[ "Activate", "a", "document", "hold", "." ]
dc8cf49e4e4302fd38537ad089ece81fbcca4737
https://github.com/bokeh/bokeh/blob/dc8cf49e4e4302fd38537ad089ece81fbcca4737/bokeh/document/document.py#L591-L635