Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 1 addition & 23 deletions codegen/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
from codegen.utils import CAVEAT, write_source_py


locationmode_traces = [
"choropleth",
"scattergeo",
]


def get_typing_type(plotly_type, array_ok=False):
"""
Get Python type corresponding to a valType string from the plotly schema
Expand Down Expand Up @@ -97,7 +91,7 @@ def build_datatype_py(node):
)
buffer.write("import copy as _copy\n")

if node.name_property in locationmode_traces or node.name_property == "template":
if node.name_property == "template":
buffer.write("import warnings\n")

# Write class definition
Expand Down Expand Up @@ -340,22 +334,6 @@ def __init__(self"""
"""
)

# Add warning for 'country names' locationmode
if node.name_property in locationmode_traces:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can locationmode_traces also be removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good catch

buffer.write(
f"""
if locationmode == "country names" and kwargs.get("_validate"):
warnings.warn(
"The library used by the *country names* `locationmode` option is changing in an upcoming version. "
"Country names in existing plots may not work in the new version. "
"To ensure consistent behavior, consider setting `locationmode` to *ISO-3*.",
DeprecationWarning,
stacklevel=5,
)

"""
)

buffer.write(
f"""
self._skip_invalid = kwargs.pop("skip_invalid", False)
Expand Down
18 changes: 0 additions & 18 deletions plotly/express/_chart_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1111,15 +1111,6 @@ def choropleth(
colored region mark on a map.
"""

if locationmode == "country names":
warn(
"The library used by the *country names* `locationmode` option is changing in an upcoming version. "
"Country names in existing plots may not work in the new version. "
"To ensure consistent behavior, consider setting `locationmode` to *ISO-3*.",
DeprecationWarning,
stacklevel=2,
)

return make_figure(
args=locals(),
constructor=go.Choropleth,
Expand Down Expand Up @@ -1179,15 +1170,6 @@ def scatter_geo(
by a symbol mark on a map.
"""

if locationmode == "country names":
warn(
"The library used by the *country names* `locationmode` option is changing in an upcoming version. "
"Country names in existing plots may not work in the new version. "
"To ensure consistent behavior, consider setting `locationmode` to *ISO-3*.",
DeprecationWarning,
stacklevel=2,
)

return make_figure(
args=locals(),
constructor=go.Scattergeo,
Expand Down
10 changes: 0 additions & 10 deletions plotly/graph_objs/_choropleth.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from plotly.basedatatypes import BaseTraceType as _BaseTraceType
import copy as _copy
import warnings


class Choropleth(_BaseTraceType):
Expand Down Expand Up @@ -1486,15 +1485,6 @@ def __init__(
constructor must be a dict or
an instance of :class:`plotly.graph_objs.Choropleth`""")

if locationmode == "country names" and kwargs.get("_validate"):
warnings.warn(
"The library used by the *country names* `locationmode` option is changing in an upcoming version. "
"Country names in existing plots may not work in the new version. "
"To ensure consistent behavior, consider setting `locationmode` to *ISO-3*.",
DeprecationWarning,
stacklevel=5,
)

self._skip_invalid = kwargs.pop("skip_invalid", False)
self._validate = kwargs.pop("_validate", True)

Expand Down
10 changes: 0 additions & 10 deletions plotly/graph_objs/_scattergeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from plotly.basedatatypes import BaseTraceType as _BaseTraceType
import copy as _copy
import warnings


class Scattergeo(_BaseTraceType):
Expand Down Expand Up @@ -1550,15 +1549,6 @@ def __init__(
constructor must be a dict or
an instance of :class:`plotly.graph_objs.Scattergeo`""")

if locationmode == "country names" and kwargs.get("_validate"):
warnings.warn(
"The library used by the *country names* `locationmode` option is changing in an upcoming version. "
"Country names in existing plots may not work in the new version. "
"To ensure consistent behavior, consider setting `locationmode` to *ISO-3*.",
DeprecationWarning,
stacklevel=5,
)

self._skip_invalid = kwargs.pop("skip_invalid", False)
self._validate = kwargs.pop("_validate", True)

Expand Down
Loading