66from codegen .datatypes import build_datatype_py , write_datatype_py # noqa: F401
77from codegen .compatibility import (
88 write_deprecated_datatypes ,
9- write_graph_objs_graph_objs ,
9+ write_graph_objects_graph_objects ,
1010 DEPRECATED_DATATYPES ,
1111)
1212from codegen .figure import write_figure_classes
@@ -60,7 +60,7 @@ def preprocess_schema(plotly_schema):
6060matching the structure of `figure.layout` and `traceTemplate` is a dict
6161matching the structure of the trace with type `trace_type` (e.g. 'scatter').
6262Alternatively, this may be specified as an instance of
63- plotly.graph_objs .layout.Template.
63+ plotly.graph_objects .layout.Template.
6464
6565Trace templates are applied cyclically to
6666traces of each type. Container arrays (eg `annotations`) have special
@@ -89,22 +89,22 @@ def make_paths(codedir):
8989 """Make various paths needed for code generation."""
9090
9191 validators_dir = codedir / "validators"
92- graph_objs_dir = codedir / "graph_objs "
93- graph_objects_path = codedir / "graph_objects " / "__init__.py"
94- return validators_dir , graph_objs_dir , graph_objects_path
92+ graph_objects_dir = codedir / "graph_objects "
93+ graph_objs_path = codedir / "graph_objs " / "__init__.py"
94+ return validators_dir , graph_objects_dir , graph_objs_path
9595
9696
9797def perform_codegen (codedir , noformat = False ):
9898 """Generate code."""
9999
100100 # Get paths
101- validators_dir , graph_objs_dir , graph_objects_path = make_paths (codedir )
101+ validators_dir , graph_objects_dir , graph_objs_path = make_paths (codedir )
102102
103103 # Delete prior codegen output
104104 if validators_dir .exists ():
105105 shutil .rmtree (validators_dir )
106- if graph_objs_dir .exists ():
107- shutil .rmtree (graph_objs_dir )
106+ if graph_objects_dir .exists ():
107+ shutil .rmtree (graph_objects_dir )
108108
109109 # Load plotly schema
110110 project_root = codedir .parent
@@ -186,10 +186,10 @@ def perform_codegen(codedir, noformat=False):
186186 write_datatype_py (codedir , node )
187187
188188 # Deprecated
189- # These are deprecated legacy datatypes like graph_objs .Marker
189+ # These are deprecated legacy datatypes like graph_objects .Marker
190190 write_deprecated_datatypes (codedir )
191191
192- # Write figure class to graph_objs
192+ # Write figure class to graph_objects
193193 data_validator = get_data_validator_instance (base_traces_node )
194194 layout_validator = layout_node .get_validator_instance ()
195195 frame_validator = frame_node .get_validator_instance ()
@@ -222,10 +222,10 @@ def perform_codegen(codedir, noformat=False):
222222 f".{ node .name_undercase } "
223223 )
224224
225- # Write plotly/graph_objs/graph_objs .py
225+ # Write plotly/graph_objects/graph_objects .py
226226 # This is for backward compatibility. It just imports everything from
227- # graph_objs /__init__.py
228- write_graph_objs_graph_objs (codedir )
227+ # graph_objects /__init__.py
228+ write_graph_objects_graph_objects (codedir )
229229
230230 # Add Figure and FigureWidget
231231 root_datatype_imports = datatype_rel_class_imports [()]
@@ -241,7 +241,7 @@ def perform_codegen(codedir, noformat=False):
241241 import ipywidgets as _ipywidgets
242242 from packaging.version import Version as _Version
243243 if _Version(_ipywidgets.__version__) >= _Version("7.0.0"):
244- from ..graph_objs ._figurewidget import FigureWidget
244+ from ..graph_objects ._figurewidget import FigureWidget
245245 else:
246246 raise ImportError()
247247 except Exception:
@@ -255,7 +255,7 @@ def __getattr__(import_name):
255255 import ipywidgets
256256 from packaging.version import Version
257257 if Version(ipywidgets.__version__) >= Version("7.0.0"):
258- from ..graph_objs ._figurewidget import FigureWidget
258+ from ..graph_objects ._figurewidget import FigureWidget
259259 return FigureWidget
260260 else:
261261 raise ImportError()
@@ -270,43 +270,43 @@ def __getattr__(import_name):
270270 # __all__
271271 for path_parts , class_names in alls .items ():
272272 if path_parts and class_names :
273- filepath = codedir / "graph_objs "
273+ filepath = codedir / "graph_objects "
274274 filepath = filepath .joinpath (* path_parts ) / "__init__.py"
275275 with open (filepath , "at" ) as f :
276276 f .write (f"\n __all__ = { class_names } " )
277277
278278 # Output datatype __init__.py files
279- graph_objs_pkg = codedir / "graph_objs "
279+ graph_objects_pkg = codedir / "graph_objects "
280280 for path_parts in datatype_rel_class_imports :
281281 rel_classes = sorted (datatype_rel_class_imports [path_parts ])
282282 rel_modules = sorted (datatype_rel_module_imports .get (path_parts , []))
283283 if path_parts == ():
284284 init_extra = optional_figure_widget_import
285285 else :
286286 init_extra = ""
287- write_init_py (graph_objs_pkg , path_parts , rel_modules , rel_classes , init_extra )
287+ write_init_py (graph_objects_pkg , path_parts , rel_modules , rel_classes , init_extra )
288288
289- # Output graph_objects .py alias
290- graph_objects_rel_classes = [
291- "..graph_objs ." + rel_path .split ("." )[- 1 ]
289+ # Output graph_objs .py alias
290+ graph_objs_rel_classes = [
291+ "..graph_objects ." + rel_path .split ("." )[- 1 ]
292292 for rel_path in datatype_rel_class_imports [()]
293293 ]
294- graph_objects_rel_modules = [
295- "..graph_objs ." + rel_module .split ("." )[- 1 ]
294+ graph_objs_rel_modules = [
295+ "..graph_objects ." + rel_module .split ("." )[- 1 ]
296296 for rel_module in datatype_rel_module_imports [()]
297297 ]
298298
299- graph_objects_init_source = build_from_imports_py (
300- graph_objects_rel_modules ,
301- graph_objects_rel_classes ,
299+ graph_objs_init_source = build_from_imports_py (
300+ graph_objs_rel_modules ,
301+ graph_objs_rel_classes ,
302302 init_extra = optional_figure_widget_import ,
303303 )
304- graph_objects_path = codedir / "graph_objects "
305- graph_objects_path .mkdir (parents = True , exist_ok = True )
306- graph_objects_path /= "__init__.py"
307- with open (graph_objects_path , "wt" ) as f :
304+ graph_objs_path = codedir / "graph_objs "
305+ graph_objs_path .mkdir (parents = True , exist_ok = True )
306+ graph_objs_path /= "__init__.py"
307+ with open (graph_objs_path , "wt" ) as f :
308308 f .write ("# ruff: noqa: F401\n " )
309- f .write (graph_objects_init_source )
309+ f .write (graph_objs_init_source )
310310
311311
312312if __name__ == "__main__" :
0 commit comments