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

Function write_validator_json

codegen/validators.py:57–83  ·  view source on GitHub ↗

Write out a JSON serialization of the validator arguments for all validators (keyed by f"{parent_name}.{plotly_name}) Each validator has a "params": {kwargs} entry and a "superclass": str to indicate the class to be instantiated Parameters ---------- outdir : str

(outdir, params: dict)

Source from the content-addressed store, hash-verified

55
56
57def write_validator_json(outdir, params: dict):
58 """
59 Write out a JSON serialization of the validator arguments
60 for all validators (keyed by f"{parent_name}.{plotly_name})
61
62 Each validator has a "params": {kwargs} entry and
63 a "superclass": str to indicate the class to be instantiated
64
65 Parameters
66 ----------
67 outdir : str
68 Root outdir in which the validators package should reside
69 params : dict
70 Dictionary to store the JSON data for the validator
71 Returns
72 -------
73 None
74 """
75
76 # Validate inputs
77 if not isinstance(params, dict):
78 raise ValueError("Expected params to be a dictionary")
79
80 # Write file
81 filepath = opath.join(outdir, "validators", "_validators.json")
82 with open(filepath, "w") as f:
83 f.write(json.dumps(params, indent=4))
84
85
86def build_data_validator_params(base_trace_node: TraceNode):

Callers 1

perform_codegenFunction · 0.90

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected