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

Method get_constructor_params_docstring

codegen/utils.py:881–954  ·  view source on GitHub ↗

Return a docstring-style string containing the names and descriptions of all of the node's child datatypes Parameters ---------- indent : int Leading indent of the string Returns ------- str

(self, indent=12)

Source from the content-addressed store, hash-verified

879 return bool([n for n in self.children if n.plotly_name == name])
880
881 def get_constructor_params_docstring(self, indent=12):
882 """
883 Return a docstring-style string containing the names and
884 descriptions of all of the node's child datatypes
885
886 Parameters
887 ----------
888 indent : int
889 Leading indent of the string
890
891 Returns
892 -------
893 str
894 """
895 assert self.is_compound
896
897 buffer = StringIO()
898
899 subtype_nodes = self.child_datatypes
900 for subtype_node in subtype_nodes:
901 raw_description = subtype_node.description
902 if raw_description:
903 subtype_description = raw_description
904 elif subtype_node.is_array_element:
905 if (
906 self.name_datatype_class == "Data"
907 and self.parent
908 and self.parent.name_datatype_class == "Template"
909 ):
910 class_name = (
911 f"plotly.graph_objects.{subtype_node.name_datatype_class}"
912 )
913 else:
914 class_name = (
915 f"plotly.graph_objects"
916 f"{subtype_node.parent_dotpath_str}."
917 f"{subtype_node.name_datatype_class}"
918 )
919 subtype_description = (
920 f"A tuple of :class:`{class_name}` instances or "
921 "dicts with compatible properties"
922 )
923 elif subtype_node.is_compound:
924 if (
925 subtype_node.name_datatype_class == "Layout"
926 and self.name_datatype_class == "Template"
927 ):
928 class_name = "plotly.graph_objects.Layout"
929 else:
930 class_name = (
931 f"plotly.graph_objects"
932 f"{subtype_node.parent_dotpath_str}."
933 f"{subtype_node.name_datatype_class}"
934 )
935
936 subtype_description = (
937 f":class:`{class_name}` instance or dict with compatible properties"
938 )

Callers 2

build_datatype_pyFunction · 0.80
add_docstringFunction · 0.80

Calls 2

wrapMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected