def plotly(
        data: list = None,
        layout: dict = None,
        scale: float = 0.5,
        figure: dict = None,
        static: bool = False
) -> str:
    """

    :param data:
    :param layout:
    :param scale:
    :param figure:
    :param static:
    :return:
    """
    environ.abort_thread()

    try:
        import plotly as plotly_lib
    except ImportError:
        plotly_lib = None

    if plotly_lib is None:
        return templating.render_template(
            template_name='import-error.html',
            library_name='Plotly'
        )

    source = figure if figure else {'data': data, 'layout': layout}

    dom = plotly_lib.offline.plot(
        figure_or_data=source,
        output_type='div',
        include_plotlyjs=False
    )

    found = re.search(r'id="(?P<id>[^"]+)"', dom)
    dom_id = found.group('id')

    insert_index = dom.index('"showLink":')
    dom = ''.join([
        dom[:insert_index],
        '"staticPlot": {}, '.format('true' if static else 'false'),
        dom[insert_index:]
    ])

    return templating.render_template(
        'plotly-component.html',
        dom=dom,
        scale=scale,
        min_height=round(100.0 * scale),
        id=dom_id
    )
def plotly ( data : list = None , layout : dict = None , scale : float = 0.5 , figure : dict = None , static : bool = False ) -> str : environ . abort_thread ( ) try : import plotly as plotly_lib except ImportError : plotly_lib = None if plotly_lib is None : return templating . render_template ( template_name = 'import-error.html' , library_name = 'Plotly' ) source = figure if figure else { 'data' : data , 'layout' : layout } dom = plotly_lib . offline . plot ( figure_or_data = source , output_type = 'div' , include_plotlyjs = False ) found = re . search ( r'id="(?P<id>[^"]+)"' , dom ) dom_id = found . group ( 'id' ) insert_index = dom . index ( '"showLink":' ) dom = '' . join ( [ dom [ : insert_index ] , '"staticPlot": {}, ' . format ( 'true' if static else 'false' ) , dom [ insert_index : ] ] ) return templating . render_template ( 'plotly-component.html' , dom = dom , scale = scale , min_height = round ( 100.0 * scale ) , id = dom_id )
:param data:
    :param layout:
    :param scale:
    :param figure:
    :param static:
    :return: