Skip to content

Commit c47e999

Browse files
committed
housekeeping --> fix type, check for empty config/creds in file, move include to top of script
1 parent 01d28e2 commit c47e999

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/Plotly.jl

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ using HTTPClient.HTTPC
33
using JSON
44
using Debug
55

6+
include("plot.jl")
67

78
type CurrentPlot
89
filename::String
@@ -92,13 +93,17 @@ function set_credentials_file(input_creds::Dict)
9293

9394
#check to see if dir/file exists --> if not create it
9495
try
95-
mkdir(plotly_credential_folder)
96+
mkdir(plotly_credentials_folder)
9697
catch err
9798
isa(err, SystemError) || rethrow(err)
9899
end
99100

100101
#merge input creds with prev creds
101-
creds = merge(prev_creds, input_creds)
102+
if prev_creds != nothing
103+
creds = merge(prev_creds, input_creds)
104+
else
105+
creds = input_creds
106+
end
102107

103108
#write the json strings to the cred file
104109
creds_file = open(plotly_credentials_file, "w")
@@ -125,7 +130,11 @@ function set_config_file(input_config::Dict)
125130
end
126131

127132
#merge input config with prev config
128-
config = merge(prev_config, input_config)
133+
if prev_config != nothing
134+
config = merge(prev_config, input_config)
135+
else
136+
config = input_config
137+
end
129138

130139
#write the json strings to the config file
131140
config_file = open(plotly_config_file, "w")
@@ -209,8 +218,6 @@ function plot(data::Array,options=Dict())
209218
end
210219
end
211220

212-
include("plot.jl")
213-
214221
function layout(layout_opts::Dict,meta_opts=Dict())
215222
creds = get_credentials()
216223
endpoint = get_plot_endpoint()

0 commit comments

Comments
 (0)