8000 renaming now that module is mostly private · mode/plotly.py@b6ef5fd · GitHub
[go: up one dir, main page]

Skip to content

Commit b6ef5fd

Browse files
committed
renaming now that module is mostly private
1 parent 767d01c commit b6ef5fd

File tree

2 files changed

+14
-194
lines changed

2 files changed

+14
-194
lines changed

plotly/offline.py

Lines changed: 0 additions & 182 deletions
This file was deleted.

plotly/offline/offline.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,28 @@
1010
import os
1111
import requests
1212

13-
import plotly.plotly as py
1413
from plotly import utils
1514
from plotly import tools
1615
from plotly.exceptions import PlotlyError
16+
from plotly import session
1717

18-
_PLOTLY_OFFLINE_DIRECTORY = plotlyjs_path = os.path.expanduser(
18+
PLOTLY_OFFLINE_DIRECTORY = plotlyjs_path = os.path.expanduser(
1919
os.path.join(*'~/.plotly/plotlyjs'.split('/')))
20-
_PLOTLY_OFFLINE_BUNDLE = os.path.join(_PLOTLY_OFFLINE_DIRECTORY,
21-
'plotly-ipython-offline-bundle.js')
20+
PLOTLY_OFFLINE_BUNDLE = os.path.join(PLOTLY_OFFLINE_DIRECTORY,
21+
'plotly-ipython-offline-bundle.js')
22+
2223

2324
__PLOTLY_OFFLINE_INITIALIZED = False
2425

2526

2627
def download_plotlyjs(download_url):
27-
if not os.path.exists(plotlyjs_path):
28-
os.makedirs(plotlyjs_path)
28+
if not os.path.exists(PLOTLY_OFFLINE_DIRECTORY):
29+
os.makedirs(PLOTLY_OFFLINE_DIRECTORY)
2930

3031
res = requests.get(download_url)
3132
res.raise_for_status()
3233

33-
with open(_PLOTLY_OFFLINE_BUNDLE, 'wb') as f:
34+
with open(PLOTLY_OFFLINE_BUNDLE, 'wb') as f:
3435
f.write(res.content)
3536

3637
print('\n'.join([
@@ -55,7 +56,7 @@ def init_notebook_mode():
5556
raise ImportError('`iplot` can only run inside an IPython Notebook.')
5657
from IPython.display import HTML, display
5758

58-
if not os.path.exists(_PLOTLY_OFFLINE_BUNDLE):
59+
if not os.path.exists(PLOTLY_OFFLINE_BUNDLE):
5960
raise PlotlyError('Plotly Offline source file at {source_path} '
6061
'is not found.\n'
6162
'If you have a Plotly Offline license, then try '
@@ -64,12 +65,12 @@ def init_notebook_mode():
6465
"Don't have a Plotly Offline license? "
6566
'Contact sales@plot.ly learn more about licensing.\n'
6667
'Questions? support@plot.ly.'
67-
.format(source_path=_PLOTLY_OFFLINE_BUNDLE))
68+
.format(source_path=PLOTLY_OFFLINE_BUNDLE))
6869

6970
global __PLOTLY_OFFLINE_INITIALIZED
7071
__PLOTLY_OFFLINE_INITIALIZED = True
7172
display(HTML('<script type="text/javascript">' +
72-
open(_PLOTLY_OFFLINE_BUNDLE).read() + '</script>'))
73+
open(PLOTLY_OFFLINE_BUNDLE).read() + '</script>'))
7374

7475

7576
def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly'):
@@ -142,8 +143,8 @@ def iplot(figure_or_data, show_link=True, link_text='Export to plot.ly'):
142143
if show_link is False:
143144
link_text = ''
144145

145-
plotly_platform_url = py.get_config().get('plotly_domain',
146-
'https://plot.ly')
146+
plotly_platform_url = session.get_session_config().get('plotly_domain',
147+
'https://plot.ly')
147148
if (plotly_platform_url != 'https://plot.ly' and
148149
link_text == 'Export to plot.ly'):
149150

@@ -185,3 +186,4 @@ def plot():
185186
""" Configured to work with localhost Plotly graph viewer
186187
"""
187188
raise NotImplementedError
189+

0 commit comments

Comments
 (0)
0