File tree 2 files changed +38
-26
lines changed
2 files changed +38
-26
lines changed Original file line number Diff line number Diff line change
1
+ """
2
+ Merges and prioritizes file/session config and credentials.
3
+
4
+ This is promoted to its own module to simplify imports.
5
+
6
+ """
7
+ from __future__ import absolute_import
8
+
9
+ from plotly import session , tools
10
+
11
+
12
+ def get_credentials ():
13
+ """Returns the credentials that will be sent to plotly."""
14
+ credentials = tools .get_credentials_file ()
15
+ session_credentials = session .get_session_credentials ()
16
+ for credentials_key in credentials :
17
+
18
+ # checking for not false, but truthy value here is the desired behavior
19
+ session_value = session_credentials .get (credentials_key )
20
+ if session_value is False or session_value :
21
+ credentials [credentials_key ] = session_value
22
+ return credentials
23
+
24
+
25
+ def get_config ():
26
+ """Returns either module config or file config."""
27
+ config = tools .get_config_file ()
28
+ session_config = session .get_session_config ()
29
+ for config_key in config :
30
+
31
+ # checking for not false, but truthy value here is the desired behavior
32
+ session_value = session_config .get (config_key )
33
+ if session_value is False or session_value :
34
+ config [config_key ] = session_value
35
+ return config
Original file line number Diff line number Diff line change 35
35
get_session_config )
36
36
from plotly .grid_objs import Grid , Column
37
37
38
+ # This is imported like this for backwards compat. Careful if changing.
39
+ from plotly .config import get_config , get_credentials
40
+
38
41
__all__ = None
39
42
40
43
DEFAULT_PLOT_OPTIONS = {
55
58
update_plot_options = update_session_plot_options
56
59
57
60
58
- def get_credentials ():
59
- """Returns the credentials that will be sent to plotly."""
60
- credentials = tools .get_credentials_file ()
61
- session_credentials = get_session_credentials ()
62
- for credentials_key in credentials :
63
-
64
- # checking for not false, but truthy value here is the desired behavior
65
- session_value = session_credentials .get (credentials_key )
66
- if session_value is False or session_value :
67
- credentials [credentials_key ] = session_value
68
- return credentials
69
-
70
-
71
- def get_config ():
72
- """Returns either module config or file config."""
73
- config = tools .get_config_file ()
74
- session_config = get_session_config ()
75
- for config_key in config :
76
-
77
- # checking for not false, but truthy value here is the desired behavior
78
- session_value = session_config .get (config_key )
79
- if session_value is False or session_value :
80
- config [config_key ] = session_value
81
- return config
82
-
83
-
84
61
def _plot_option_logic (plot_options_from_call_signature ):
85
62
"""
86
63
Given some plot_options as part of a plot call, decide on final options.
You can’t perform that action at this time.
0 commit comments