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 db5fba7

Browse filesBrowse files
committed
Add get_config_defaults.
1 parent f6531f9 commit db5fba7
Copy full SHA for db5fba7

File tree

Expand file treeCollapse file tree

2 files changed

+28
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+28
-0
lines changed
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from __future__ import absolute_import
2+
3+
from unittest import TestCase
4+
5+
from plotly.tools import get_config_defaults, _FILE_CONTENT, CONFIG_FILE
6+
7+
8+
class TestGetConfigDefaults(TestCase):
9+
10+
def test_config_dict_is_equivalent_copy(self):
11+
12+
original = _FILE_CONTENT[CONFIG_FILE]
13+
copy = get_config_defaults()
14+
self.assertIsNot(copy, original)
15+
self.assertEqual(copy, original)

‎plotly/tools.py

Copy file name to clipboardExpand all lines: plotly/tools.py
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,19 @@ def warning_on_one_line(message, category, filename, lineno,
8585
_file_permissions = False
8686

8787

88+
def get_config_defaults():
89+
"""
90+
Convenience function to check current settings against defaults.
91+
92+
Example:
93+
94+
if plotly_domain != get_config_defaults()['plotly_domain']:
95+
# do something
96+
97+
"""
98+
return dict(_FILE_CONTENT[CONFIG_FILE]) # performs a shallow copy
99+
100+
88101
def check_file_permissions():
89102
return _file_permissions
90103

0 commit comments

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