MCPcopy Index your code
hub / github.com/plotly/plotly.py / build_figure_py

Function build_figure_py

codegen/figure.py:15–704  ·  view source on GitHub ↗

Parameters ---------- trace_node : PlotlyNode Root trace node (the node that is the parent of all of the individual trace nodes like bar, scatter, etc.) base_package : str Package that the figure's superclass resides in base_classname : str Name

(
    trace_node,
    base_package,
    base_classname,
    fig_classname,
    data_validator,
    layout_validator,
    frame_validator,
    subplot_nodes,
    layout_array_nodes,
)

Source from the content-addressed store, hash-verified

13
14
15def build_figure_py(
16 trace_node,
17 base_package,
18 base_classname,
19 fig_classname,
20 data_validator,
21 layout_validator,
22 frame_validator,
23 subplot_nodes,
24 layout_array_nodes,
25):
26 """
27
28 Parameters
29 ----------
30 trace_node : PlotlyNode
31 Root trace node (the node that is the parent of all of the
32 individual trace nodes like bar, scatter, etc.)
33 base_package : str
34 Package that the figure's superclass resides in
35 base_classname : str
36 Name of the figure's superclass
37 fig_classname : str
38 Name of the Figure class to be generated
39 data_validator : BaseDataValidator
40 DataValidator instance
41 layout_validator : CompoundValidator
42 LayoutValidator instance
43 frame_validator : CompoundArrayValidator
44 FrameValidator instance
45 subplot_nodes: list of str
46 List of names of all of the layout subplot properties
47 layout_array_nodes: list of PlotlyNode
48 List of array nodes under layout that can be positioned using xref/yref
49 Returns
50 -------
51 str
52 Source code for figure class definition
53 """
54
55 # Initialize source code buffer
56 buffer = StringIO()
57 buffer.write(CAVEAT)
58
59 # Get list of trace type nodes
60 trace_nodes = trace_node.child_compound_datatypes
61
62 # Import base class
63 buffer.write(f"from plotly.{base_package} import {base_classname}\n")
64
65 # Write class definition
66 buffer.write(
67 f"""
68
69class {fig_classname}({base_classname}):\n"""
70 )
71
72 # Constructor

Callers 1

write_figure_classesFunction · 0.85

Calls 5

add_constructor_paramsFunction · 0.90
add_docstringFunction · 0.90
add_wrapperFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected