Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

feat: add type annotations to generated code #5008

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

Draft
wants to merge 11 commits into
base: main
Choose a base branch
Loading
from
Draft
Prev Previous commit
Next Next commit
merge: branch 'main' into codegen2
  • Loading branch information
gvwilson committed Mar 18, 2025
commit 51911a4e110a9c15e217fa161cbace2be214cae9
22 changes: 9 additions & 13 deletions 22 codegen/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,25 +353,21 @@ def __init__(self"""
buffer.write("\n\n")
for subtype_node in subtype_nodes:
name_prop = subtype_node.name_property
buffer.write(
f"""
self._init_provided('{name_prop}', arg, {name_prop})"""
)
if datatype_class == "Template" and name_prop == "data":
buffer.write(
"""
# Template.data contains a 'scattermapbox' key, which causes a
# go.Scattermapbox trace object to be created during validation.
# In order to prevent false deprecation warnings from surfacing,
# we suppress deprecation warnings for this line only.
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
self["data"] = _v"""
f"""
# Template.data contains a 'scattermapbox' key, which causes a
# go.Scattermapbox trace object to be created during validation.
# In order to prevent false deprecation warnings from surfacing,
# we suppress deprecation warnings for this line only.
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
self._init_provided('{name_prop}', arg, {name_prop})"""
)
else:
buffer.write(
f"""
self['{name_prop}'] = _v"""
self._init_provided('{name_prop}', arg, {name_prop})"""
)

### Literals
Expand Down
1 change: 1 addition & 0 deletions 1 plotly/graph_objs/_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


class Figure(BaseFigure):

def __init__(
self, data=None, layout=None, frames=None, skip_invalid=False, **kwargs
):
Expand Down
1 change: 1 addition & 0 deletions 1 plotly/graph_objs/_figurewidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


class FigureWidget(BaseFigureWidget):

def __init__(
self, data=None, layout=None, frames=None, skip_invalid=False, **kwargs
):
Expand Down
8 changes: 7 additions & 1 deletion 8 plotly/graph_objs/layout/_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,13 @@ def __init__(self, arg=None, data=None, layout=None, **kwargs):
self._skip_invalid = kwargs.pop("skip_invalid", False)
self._validate = kwargs.pop("_validate", True)

self._init_provided("data", arg, data)
# Template.data contains a 'scattermapbox' key, which causes a
# go.Scattermapbox trace object to be created during validation.
# In order to prevent false deprecation warnings from surfacing,
# we suppress deprecation warnings for this line only.
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
self._init_provided("data", arg, data)
self._init_provided("layout", arg, layout)
self._process_kwargs(**dict(arg, **kwargs))
self._skip_invalid = False
1 change: 1 addition & 0 deletions 1 plotly/validators/_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


class DataValidator(_plotly_utils.basevalidators.BaseDataValidator):

def __init__(self, plotly_name="data", parent_name="", **kwargs):

super().__init__(
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.