From c4b35545c743ce90377a136147587bc287ebabed Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Fri, 10 May 2019 21:37:31 +0700 Subject: [PATCH] Replace requests.compat.json with real json requests.compat.json may use simplejson, which is incompatible with plotly.py usage of json. Fixes https://github.com/plotly/plotly.py/issues/1556 --- chart_studio/api/v1/clientresp.py | 2 +- chart_studio/api/v2/utils.py | 2 +- chart_studio/grid_objs/grid_objs.py | 2 +- chart_studio/plotly/plotly.py | 2 +- chart_studio/tests/test_plot_ly/test_api/test_v1/test_utils.py | 2 +- chart_studio/tests/test_plot_ly/test_api/test_v2/test_grids.py | 2 +- chart_studio/tests/test_plot_ly/test_api/test_v2/test_images.py | 2 +- chart_studio/tests/test_plot_ly/test_api/test_v2/test_utils.py | 2 +- .../tests/test_plot_ly/test_get_requests/test_get_requests.py | 2 +- chart_studio/tests/test_plot_ly/test_plotly/test_plot.py | 2 +- chart_studio/utils.py | 2 +- chart_studio/widgets/graph_widget.py | 2 +- plotly/graph_reference.py | 2 +- .../test_core/test_graph_reference/test_graph_reference.py | 2 +- plotly/tests/test_core/test_offline/test_offline.py | 2 +- plotly/tests/test_core/test_utils/test_utils.py | 2 +- plotly/tests/test_optional/test_offline/test_offline.py | 2 +- plotly/tests/test_optional/test_utils/test_utils.py | 2 +- plotly/tests/test_plot_ly/test_api/test_v1/test_utils.py | 2 +- plotly/tests/test_plot_ly/test_api/test_v2/test_grids.py | 2 +- plotly/tests/test_plot_ly/test_api/test_v2/test_images.py | 2 +- plotly/tests/test_plot_ly/test_api/test_v2/test_utils.py | 2 +- .../tests/test_plot_ly/test_get_requests/test_get_requests.py | 2 +- plotly/tests/test_plot_ly/test_plotly/test_plot.py | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/chart_studio/api/v1/clientresp.py b/chart_studio/api/v1/clientresp.py index dd933e7fd9b..1f7707e1d97 100644 --- a/chart_studio/api/v1/clientresp.py +++ b/chart_studio/api/v1/clientresp.py @@ -3,7 +3,7 @@ import warnings -from requests.compat import json as _json +import json as _json from _plotly_utils.utils import PlotlyJSONEncoder diff --git a/chart_studio/api/v2/utils.py b/chart_studio/api/v2/utils.py index ec9a4201b39..8d7a14dfa36 100644 --- a/chart_studio/api/v2/utils.py +++ b/chart_studio/api/v2/utils.py @@ -1,7 +1,7 @@ from __future__ import absolute_import import requests -from requests.compat import json as _json +import json as _json from requests.exceptions import RequestException from retrying import retry diff --git a/chart_studio/grid_objs/grid_objs.py b/chart_studio/grid_objs/grid_objs.py index 414d9800d2e..92363da3852 100644 --- a/chart_studio/grid_objs/grid_objs.py +++ b/chart_studio/grid_objs/grid_objs.py @@ -12,7 +12,7 @@ except ImportError: from collections import MutableSequence -from requests.compat import json as _json +import json as _json from _plotly_utils.optional_imports import get_module from chart_studio import utils, exceptions diff --git a/chart_studio/plotly/plotly.py b/chart_studio/plotly/plotly.py index 763c431985f..7bfb50c2af8 100644 --- a/chart_studio/plotly/plotly.py +++ b/chart_studio/plotly/plotly.py @@ -26,7 +26,7 @@ import six import six.moves -from requests.compat import json as _json +import json as _json import _plotly_utils.utils import _plotly_utils.exceptions diff --git a/chart_studio/tests/test_plot_ly/test_api/test_v1/test_utils.py b/chart_studio/tests/test_plot_ly/test_api/test_v1/test_utils.py index 8d599f973d6..8fb761de550 100644 --- a/chart_studio/tests/test_plot_ly/test_api/test_v1/test_utils.py +++ b/chart_studio/tests/test_plot_ly/test_api/test_v1/test_utils.py @@ -1,7 +1,7 @@ from __future__ import absolute_import from requests import Response -from requests.compat import json as _json +import json as _json from requests.exceptions import ConnectionError from chart_studio.api.utils import to_native_utf8_string diff --git a/chart_studio/tests/test_plot_ly/test_api/test_v2/test_grids.py b/chart_studio/tests/test_plot_ly/test_api/test_v2/test_grids.py index 32e3ea3cfe1..aa3d06bd6c1 100644 --- a/chart_studio/tests/test_plot_ly/test_api/test_v2/test_grids.py +++ b/chart_studio/tests/test_plot_ly/test_api/test_v2/test_grids.py @@ -1,6 +1,6 @@ from __future__ import absolute_import -from requests.compat import json as _json +import json as _json from chart_studio.api.v2 import grids from chart_studio.tests.test_plot_ly.test_api import PlotlyApiTestCase diff --git a/chart_studio/tests/test_plot_ly/test_api/test_v2/test_images.py b/chart_studio/tests/test_plot_ly/test_api/test_v2/test_images.py index 5830a36ed2b..11f4f90c9e1 100644 --- a/chart_studio/tests/test_plot_ly/test_api/test_v2/test_images.py +++ b/chart_studio/tests/test_plot_ly/test_api/test_v2/test_images.py @@ -1,6 +1,6 @@ from __future__ import absolute_import -from requests.compat import json as _json +import json as _json from chart_studio.api.v2 import images from chart_studio.tests.test_plot_ly.test_api import PlotlyApiTestCase diff --git a/chart_studio/tests/test_plot_ly/test_api/test_v2/test_utils.py b/chart_studio/tests/test_plot_ly/test_api/test_v2/test_utils.py index 7ae1143cd41..f8bb29ec345 100644 --- a/chart_studio/tests/test_plot_ly/test_api/test_v2/test_utils.py +++ b/chart_studio/tests/test_plot_ly/test_api/test_v2/test_utils.py @@ -1,6 +1,6 @@ from __future__ import absolute_import -from requests.compat import json as _json +import json as _json from requests.exceptions import ConnectionError from plotly import version diff --git a/chart_studio/tests/test_plot_ly/test_get_requests/test_get_requests.py b/chart_studio/tests/test_plot_ly/test_get_requests/test_get_requests.py index 7ca4d607b59..863afc90a58 100644 --- a/chart_studio/tests/test_plot_ly/test_get_requests/test_get_requests.py +++ b/chart_studio/tests/test_plot_ly/test_get_requests/test_get_requests.py @@ -10,7 +10,7 @@ import requests import six from nose.plugins.attrib import attr -from requests.compat import json as _json +import json as _json from chart_studio.tests.utils import PlotlyTestCase diff --git a/chart_studio/tests/test_plot_ly/test_plotly/test_plot.py b/chart_studio/tests/test_plot_ly/test_plotly/test_plot.py index fe6915cbc5d..6c0bd8934c3 100644 --- a/chart_studio/tests/test_plot_ly/test_plotly/test_plot.py +++ b/chart_studio/tests/test_plot_ly/test_plotly/test_plot.py @@ -10,7 +10,7 @@ import requests import six import sys -from requests.compat import json as _json +import json as _json import warnings from nose.plugins.attrib import attr diff --git a/chart_studio/utils.py b/chart_studio/utils.py index a8e90fda3c3..5a42ed2ac61 100644 --- a/chart_studio/utils.py +++ b/chart_studio/utils.py @@ -12,7 +12,7 @@ import threading import warnings -from requests.compat import json as _json +import json as _json from _plotly_utils.exceptions import PlotlyError from _plotly_utils.optional_imports import get_module diff --git a/chart_studio/widgets/graph_widget.py b/chart_studio/widgets/graph_widget.py index 4ead8a9abaa..e1b08087319 100644 --- a/chart_studio/widgets/graph_widget.py +++ b/chart_studio/widgets/graph_widget.py @@ -6,7 +6,7 @@ from collections import deque import pkgutil -from requests.compat import json as _json +import json as _json # TODO: protected imports? import ipywidgets as widgets diff --git a/plotly/graph_reference.py b/plotly/graph_reference.py index 9ac39a76f21..aa53de95317 100644 --- a/plotly/graph_reference.py +++ b/plotly/graph_reference.py @@ -9,7 +9,7 @@ import pkgutil import six -from requests.compat import json as _json +import json as _json from plotly import utils diff --git a/plotly/tests/test_core/test_graph_reference/test_graph_reference.py b/plotly/tests/test_core/test_graph_reference/test_graph_reference.py index 02afb1d0a15..05db9127ad3 100644 --- a/plotly/tests/test_core/test_graph_reference/test_graph_reference.py +++ b/plotly/tests/test_core/test_graph_reference/test_graph_reference.py @@ -8,7 +8,7 @@ from unittest import TestCase from nose.plugins.attrib import attr -from requests.compat import json as _json +import json as _json from plotly import graph_reference as gr from plotly.api import v2 diff --git a/plotly/tests/test_core/test_offline/test_offline.py b/plotly/tests/test_core/test_offline/test_offline.py index 00f24909493..ea3d1e155c1 100644 --- a/plotly/tests/test_core/test_offline/test_offline.py +++ b/plotly/tests/test_core/test_offline/test_offline.py @@ -8,7 +8,7 @@ from unittest import TestCase from nose.plugins.attrib import attr -from requests.compat import json as _json +import json as _json import plotly import json diff --git a/plotly/tests/test_core/test_utils/test_utils.py b/plotly/tests/test_core/test_utils/test_utils.py index c5709430eb4..aa2559bfe76 100644 --- a/plotly/tests/test_core/test_utils/test_utils.py +++ b/plotly/tests/test_core/test_utils/test_utils.py @@ -3,7 +3,7 @@ from inspect import getargspec from unittest import TestCase -from requests.compat import json as _json +import json as _json from plotly.utils import (PlotlyJSONEncoder, get_by_path, memoize, node_generator) diff --git a/plotly/tests/test_optional/test_offline/test_offline.py b/plotly/tests/test_optional/test_offline/test_offline.py index 6b2b2e05dc5..058594dd407 100644 --- a/plotly/tests/test_optional/test_offline/test_offline.py +++ b/plotly/tests/test_optional/test_offline/test_offline.py @@ -6,7 +6,7 @@ import re from nose.tools import raises from nose.plugins.attrib import attr -from requests.compat import json as _json +import json as _json from unittest import TestCase diff --git a/plotly/tests/test_optional/test_utils/test_utils.py b/plotly/tests/test_optional/test_utils/test_utils.py index d9b463d3ca1..84e3c92a30f 100644 --- a/plotly/tests/test_optional/test_utils/test_utils.py +++ b/plotly/tests/test_optional/test_utils/test_utils.py @@ -15,7 +15,7 @@ import pytz from nose.plugins.attrib import attr from pandas.util.testing import assert_series_equal -from requests.compat import json as _json +import json as _json from plotly import optional_imports, utils from plotly.graph_objs import Scatter, Scatter3d, Figure, Data diff --git a/plotly/tests/test_plot_ly/test_api/test_v1/test_utils.py b/plotly/tests/test_plot_ly/test_api/test_v1/test_utils.py index ff2034c653f..151ba0419bc 100644 --- a/plotly/tests/test_plot_ly/test_api/test_v1/test_utils.py +++ b/plotly/tests/test_plot_ly/test_api/test_v1/test_utils.py @@ -3,7 +3,7 @@ from unittest import TestCase from requests import Response -from requests.compat import json as _json +import json as _json from requests.exceptions import ConnectionError from plotly.api.utils import to_native_utf8_string diff --git a/plotly/tests/test_plot_ly/test_api/test_v2/test_grids.py b/plotly/tests/test_plot_ly/test_api/test_v2/test_grids.py index 4d373bbc676..c356bf928d8 100644 --- a/plotly/tests/test_plot_ly/test_api/test_v2/test_grids.py +++ b/plotly/tests/test_plot_ly/test_api/test_v2/test_grids.py @@ -1,6 +1,6 @@ from __future__ import absolute_import -from requests.compat import json as _json +import json as _json from plotly.api.v2 import grids from plotly.tests.test_plot_ly.test_api import PlotlyApiTestCase diff --git a/plotly/tests/test_plot_ly/test_api/test_v2/test_images.py b/plotly/tests/test_plot_ly/test_api/test_v2/test_images.py index a392913fc68..bc43f9776fe 100644 --- a/plotly/tests/test_plot_ly/test_api/test_v2/test_images.py +++ b/plotly/tests/test_plot_ly/test_api/test_v2/test_images.py @@ -1,6 +1,6 @@ from __future__ import absolute_import -from requests.compat import json as _json +import json as _json from plotly.api.v2 import images from plotly.tests.test_plot_ly.test_api import PlotlyApiTestCase diff --git a/plotly/tests/test_plot_ly/test_api/test_v2/test_utils.py b/plotly/tests/test_plot_ly/test_api/test_v2/test_utils.py index cef3e1d2e9a..96721fe621e 100644 --- a/plotly/tests/test_plot_ly/test_api/test_v2/test_utils.py +++ b/plotly/tests/test_plot_ly/test_api/test_v2/test_utils.py @@ -1,6 +1,6 @@ from __future__ import absolute_import -from requests.compat import json as _json +import json as _json from requests.exceptions import ConnectionError from plotly import version diff --git a/plotly/tests/test_plot_ly/test_get_requests/test_get_requests.py b/plotly/tests/test_plot_ly/test_get_requests/test_get_requests.py index 6945a3a641e..b796f4883cd 100644 --- a/plotly/tests/test_plot_ly/test_get_requests/test_get_requests.py +++ b/plotly/tests/test_plot_ly/test_get_requests/test_get_requests.py @@ -10,7 +10,7 @@ import requests import six from nose.plugins.attrib import attr -from requests.compat import json as _json +import json as _json from plotly.tests.utils import PlotlyTestCase diff --git a/plotly/tests/test_plot_ly/test_plotly/test_plot.py b/plotly/tests/test_plot_ly/test_plotly/test_plot.py index 1d378ea7c64..6e1c62315d4 100644 --- a/plotly/tests/test_plot_ly/test_plotly/test_plot.py +++ b/plotly/tests/test_plot_ly/test_plotly/test_plot.py @@ -10,7 +10,7 @@ import requests import six import sys -from requests.compat import json as _json +import json as _json import warnings from nose.plugins.attrib import attr