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 b35979e

Browse filesBrowse files
authored
Merge pull request plotly#679 from srinivasreddy/refactor
refactor the files.py
2 parents be3dab6 + 4676c42 commit b35979e
Copy full SHA for b35979e

File tree

Expand file treeCollapse file tree

1 file changed

+16
-12
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+16
-12
lines changed

‎plotly/files.py

Copy file name to clipboardExpand all lines: plotly/files.py
+16-12Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,22 @@
2222
'sharing': 'public',
2323
'auto_open': True}}
2424

25-
try:
26-
os.mkdir(TEST_DIR)
27-
os.rmdir(TEST_DIR)
28-
if not os.path.exists(PLOTLY_DIR):
29-
os.mkdir(PLOTLY_DIR)
30-
f = open(TEST_FILE, 'w')
31-
f.write('testing\n')
32-
f.close()
33-
os.remove(TEST_FILE)
34-
_file_permissions = True
35-
except:
36-
_file_permissions = False
25+
26+
def _permissions():
27+
try:
28+
os.mkdir(TEST_DIR)
29+
os.rmdir(TEST_DIR)
30+
if not os.path.exists(PLOTLY_DIR):
31+
os.mkdir(PLOTLY_DIR)
32+
with open(TEST_FILE, 'w') as f:
33+
f.write('testing\n')
34+
os.remove(TEST_FILE)
35+
return True
36+
except:
37+
return False
38+
39+
40+
_file_permissions = _permissions()
3741

3842

3943
def check_file_permissions():

0 commit comments

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