bokeh.util.serialization.make_id

Here are the examples of the python api bokeh.util.serialization.make_id taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4 Examples 7

3 Source : selenium.py
with BSD 3-Clause "New" or "Revised" License
from holzschu

    def __init__(self, label, callback):
        self.ref = "button-" + make_id()
        self.obj = Button(label=label, css_classes=[self.ref])
        self.obj.js_on_event('button_click', callback)

    def click(self, driver):

3 Source : test_serialization.py
with MIT License
from rthorst

    def test_simple_ids_no(self):
        os.environ["BOKEH_SIMPLE_IDS"] = "no"
        assert len(bus.make_id()) == 36
        assert isinstance(bus.make_id(), str)
        del os.environ["BOKEH_SIMPLE_IDS"]

class Test_make_globally_unique_id(object):

0 Source : notebook.py
with BSD 3-Clause "New" or "Revised" License
from holoviz

def html_for_render_items(docs_json, render_items, template=None, template_variables={}):
    json_id = make_id()
    json = escape(serialize_json(docs_json), quote=False)
    json = wrap_in_script_tag(json, "application/json", json_id)

    script = wrap_in_script_tag(script_for_render_items(json_id, render_items))

    context = template_variables.copy()

    context.update(dict(
        title = '',
        plot_script = json + script,
        docs = render_items,
        base = NB_TEMPLATE_BASE,
        macros = MACROS,
    ))

    if len(render_items) == 1:
        context["doc"] = context["docs"][0]
        context["roots"] = context["doc"].roots

    if template is None:
        template = NB_TEMPLATE_BASE
    elif isinstance(template, str):
        template = _env.from_string("{% extends base %}\n" + template)

    return template.render(context)


def render_template(document, comm=None, manager=None):

0 Source : message.py
with BSD 3-Clause "New" or "Revised" License
from holzschu

    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'   : bkserial.make_id(),
            'msgtype' : cls.msgtype
        }
        if request_id is not None:
            header['reqid'] = request_id
        return header

    @gen.coroutine