8000 refactor validators to remove duplicate files by gvwilson · Pull Request #5214 · plotly/plotly.py · GitHub
[go: up one dir, main page]

Skip to content

refactor validators to remove duplicate files #5214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Jun 10, 2025
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2cf19ff
removing old generated validators
bmaranville May 8, 2025
1f911b6
write single json instead of python files
bmaranville May 8, 2025
930509f
generate validator class instances from json data
bmaranville May 8, 2025
3fd1cfd
use validators from ValidatorCache
bmaranville May 8, 2025
665595d
use validators from ValidatorCache
bmaranville May 8, 2025
af43f68
use DataValidator from ValidatorCache
bmaranville May 8, 2025
771f918
trace validator should be instance not class of DataValidator
bmaranville May 8, 2025
6d905e7
use validators from ValidatorCache
bmaranville May 8, 2025
58ab3e1
use template validator from ValidatorCache
bmaranville May 8, 2025
44f7a4e
allow overlaying args on derived classes
bmaranville May 8, 2025
2507be9
add DataValidator to autogenerated instances provided by ValidatorCac…
bmaranville May 8, 2025
5d1ccdb
add DataValidator to autogenerated instances provided by ValidatorCac…
bmaranville May 8, 2025
6bd2bb3
add DataValidator to autogenerated instances provided by ValidatorCac…
bmaranville May 8, 2025
fdaf441
use a copy of the DataValidator in BaseFigure, with local set_uid att…
bmaranville May 8, 2025
7baa252
update validator params store
bmaranville May 8, 2025
0e913eb
DataValidator is an instance already, and is not callable
bmaranville May 8, 2025
ba8ec10
use heatmap colorscale validator
bmaranville May 8, 2025
2454767
update documentation example to use validator from ValidatorCache
bmaranville May 8, 2025
c62f6cb
cleanup
bmaranville May 9, 2025
cb4c504
black formatting
bmaranville May 9, 2025
6f777ef
black formatting
bmaranville May 9, 2025
8000
6be6f28
revert this file - it is auto-generated
bmaranville May 9, 2025
1b99411
cleanup
bmaranville May 9, 2025
03d85de
use ValidatorCache for generated Layout validators
bmaranville May 9, 2025
f8daca4
black formatting
bmaranville May 9, 2025
0184bd4
feat: regenerating validators with all recent changes
gvwilson Jun 4, 2025
513337c
fix: address code review issues
emilykl Jun 4, 2025
37c387e
fix path to _validators.json
emilykl Jun 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
black formatting
  • Loading branch information
bmaranville authored and gvwilson committed Jun 4, 2025
commit 6f777ef8f5361e628c247ce498989bc743744bd1
14 changes: 8 additions & 6 deletions codegen/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

def get_validator_params(node: PlotlyNode, store: dict):
"""
Get params for the validator instance for the supplied node
Get params for the validator instance for the supplied node
and add them to the store.

Parameters
Expand All @@ -22,7 +22,7 @@ def get_validator_params(node: PlotlyNode, store: dict):
-------
None
"""
assert isinstance(store, dict)
assert isinstance(store, dict)
assert node.is_datatype

raw_params = node.get_validator_params()
Expand Down Expand Up @@ -59,8 +59,8 @@ def write_validator_json(outdir, params: dict):
"""
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

Each validator has a "params": {kwargs} entry and
a "superclass": str to indicate the class to be instantiated

Parameters
Expand All @@ -74,6 +74,7 @@ def write_validator_json(outdir, params: dict):
None
"""
import json

# Validate inputs
# ---------------
if not isinstance(params, dict):
Expand Down Expand Up @@ -103,8 +104,9 @@ def build_data_validator_params(base_trace_node: TraceNode):
# Get list of trace nodes
# -----------------------
tracetype_nodes = base_trace_node.child_compound_datatypes
class_strs_map = dict([
(node.name_property, node.name_datatype_class) for node in tracetype_nodes])
class_strs_map = dict(
[(node.name_property, node.name_datatype_class) for node in tracetype_nodes]
)

return {
"class_strs_map": class_strs_map,
Expand Down
0