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

Commit 9605c3a

Browse filesBrowse files
committed
🐮
1 parent 4cad45a commit 9605c3a
Copy full SHA for 9605c3a

File tree

Expand file treeCollapse file tree

3 files changed

+11
-27
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+11
-27
lines changed

‎plotly/files.py

Copy file name to clipboardExpand all lines: plotly/files.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
'plotly_ssl_verification': True,
2121
'plotly_proxy_authorization': False,
2222
'world_readable': True,
23-
'sharing': "public",
24-
"auto_open": True}}
23+
'sharing': 'public',
24+
'auto_open': True}}
2525

2626
try:
2727
os.mkdir(TEST_DIR)

‎plotly/plotly/plotly.py

Copy file name to clipboardExpand all lines: plotly/plotly/plotly.py
+6-22Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -100,33 +100,17 @@ def _plot_option_logic(plot_options_from_call_signature):
100100
session_options, file_options]:
101101
utils.validate_world_readable_and_sharing_settings(option_set)
102102
utils.set_sharing_and_world_readable(option_set)
103+
103104
# dynamic defaults
104105
if ('filename' in option_set and
105106
'fileopt' not in option_set):
106107
option_set['fileopt'] = 'overwrite'
107108

108-
# merge options together with precedence
109-
def update_plot_options(base_plot_options, new_plot_options):
110-
"""
111-
Merge new_plot_options into base_plot_options
112-
113-
"""
114-
updated_plot_options = {}
115-
base_plot_options = copy.deepcopy(base_plot_options)
116-
new_plot_options = copy.deepcopy(new_plot_options)
117-
for key in base_plot_options:
118-
updated_plot_options[key] = new_plot_options.get(
119-
key, base_plot_options[key])
120-
121-
return updated_plot_options
122-
123-
user_plot_options = default_plot_options
124-
user_plot_options = update_plot_options(user_plot_options,
125-
file_options)
126-
user_plot_options = update_plot_options(user_plot_options,
127-
session_options)
128-
user_plot_options = update_plot_options(user_plot_options,
129-
plot_options_from_call_signature)
109+
user_plot_options = {}
110+
user_plot_options.update(default_plot_options)
111+
user_plot_options.update(file_options)
112+
user_plot_options.update(session_options)
113+
user_plot_options.update(plot_options_from_call_signature)
130114

131115
return user_plot_options
132116

‎plotly/tests/test_core/test_plotly/test_plot.py

Copy file name to clipboardExpand all lines: plotly/tests/test_core/test_plotly/test_plot.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
"""
88
from __future__ import absolute_import
99

10+
import json
1011
import requests
1112
import six
12-
import json
1313

1414
from unittest import TestCase
1515
from nose.plugins.attrib import attr
1616
from nose.tools import raises
1717

18-
from plotly.tests.utils import PlotlyTestCase
1918
import plotly.tools as tls
19+
from plotly.tests.utils import PlotlyTestCase
2020
from plotly.plotly import plotly as py
2121
from plotly.exceptions import PlotlyError, PlotlyEmptyDataError
2222
from plotly.files import CONFIG_FILE
@@ -214,7 +214,7 @@ def test_private_plot_response_with_and_without_share_key(self):
214214

215215
class TestPlotOptionLogic(PlotlyTestCase):
216216
conflicting_option_set = (
217-
{'world_readable': True, 'sharing': 'secret', },
217+
{'world_readable': True, 'sharing': 'secret'},
218218
{'world_readable': True, 'sharing': 'private'},
219219
{'world_readable': False, 'sharing': 'public'}
220220
)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.