Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[2.0.0] Unify API #651

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 12 commits into from
Jan 9, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Use api.v2.plot_schema to get GRAPH_REFERENCE.
There is a circular import issue that needed to be fixed here as well.
  • Loading branch information
theengineear committed Jan 5, 2017
commit 61a1e015cc332d09e6a6eb78a44f5830917b2b24
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
from pkg_resources import resource_string
from unittest import TestCase

import requests
import six
from nose.plugins.attrib import attr

from plotly import files, graph_reference as gr
from plotly import graph_reference as gr
from plotly.api import v2
from plotly.graph_reference import string_to_class_name, get_role
from plotly.tests.utils import PlotlyTestCase

FAKE_API_DOMAIN = 'https://api.am.not.here.ly'


class TestGraphReferenceCaching(PlotlyTestCase):

Expand All @@ -32,14 +33,8 @@ def test_get_graph_reference(self):

@attr('slow')
def test_default_schema_is_up_to_date(self):
api_domain = files.FILE_CONTENT[files.CONFIG_FILE]['plotly_api_domain']
graph_reference_url = '{}{}?sha1'.format(api_domain, '/v2/plot-schema')
response = requests.get(graph_reference_url)
if six.PY3:
content = str(response.content, encoding='utf-8')
else:
content = response.content
schema = json.loads(content)['schema']
response = v2.plot_schema.retrieve('')
schema = response.json()['schema']

path = os.path.join('package_data', 'default-schema.json')
s = resource_string('plotly', path).decode('utf-8')
Expand Down
2 changes: 1 addition & 1 deletion plotly/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from plotly import colors
from plotly import utils
from plotly import exceptions
from plotly import graph_reference
from plotly import session
from plotly.files import (CONFIG_FILE, CREDENTIALS_FILE, FILE_CONTENT,
check_file_permissions)
Expand Down Expand Up @@ -1357,6 +1356,7 @@ def validate(obj, obj_type):

"""
# TODO: Deprecate or move. #283
from plotly import graph_reference
from plotly.graph_objs import graph_objs

if obj_type not in graph_reference.CLASSES:
Expand Down