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)
| 55 | |
| 56 | |
| 57 | def 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 | |
| 86 | def build_data_validator_params(base_trace_node: TraceNode): |
no test coverage detected