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 897a163

Browse filesBrowse files
committed
added SHARING_OPTION to avoid repetition
1 parent d220490 commit 897a163
Copy full SHA for 897a163

File tree

Expand file treeCollapse file tree

1 file changed

+6
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-5
lines changed

‎plotly/session.py

Copy file name to clipboardExpand all lines: plotly/session.py
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
'sharing': six.string_types
4444
}
4545

46+
SHARING_OPTIONS = ['public', 'private', 'secret']
47+
4648

4749
def sign_in(username, api_key, **kwargs):
4850
"""
@@ -118,11 +120,10 @@ def update_session_plot_options(**kwargs):
118120
.format(key, PLOT_OPTIONS[key]))
119121

120122
# raise exception if sharing is invalid
121-
if (key == 'sharing' and not (kwargs[key] in
122-
['public', 'private', 'secret'])):
123-
raise exceptions.PlotlyError("'{}' must be of either {}"
124-
.format(key, "'public', 'private'" +
125-
" or 'secret'"))
123+
if (key == 'sharing' and not (kwargs[key] in SHARING_OPTIONS)):
124+
raise exceptions.PlotlyError("'{0}' must be of either '{1}', '{2}'"
125+
" or '{3}'"
126+
.format(key, *SHARING_OPTIONS))
126127

127128
# update local _session dict with new plot options
128129
_session['plot_options'].update(kwargs)

0 commit comments

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