Skip to content

Commit 9b322bf

Browse files
committed
Improve inferability of comm methods
1 parent 6c5c88a commit 9b322bf

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/comm_manager.jl

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ function Comm(target,
2929
return comm
3030
end
3131

32-
comm_target(comm :: Comm{target}) where {target} = target
32+
comm_target(comm :: Comm{target}) where {target} = target::Symbol
3333

3434
function comm_info_request(sock, kernel, msg)
3535
reply = if haskey(msg.content, "target_name")
36-
t = Symbol(msg.content["target_name"])
36+
t = Symbol(msg.content["target_name"]::String)
3737
filter(kv -> comm_target(kv.second) == t, kernel.comms)
3838
else
3939
# reply with all comms.
@@ -87,9 +87,9 @@ end
8787

8888
function comm_open(sock, kernel, msg)
8989
if haskey(msg.content, "comm_id")
90-
comm_id = msg.content["comm_id"]
90+
comm_id = msg.content["comm_id"]::String
9191
if haskey(msg.content, "target_name")
92-
target = msg.content["target_name"]
92+
target = msg.content["target_name"]::String
9393
if !haskey(msg.content, "data")
9494
msg.content["data"] = Dict()
9595
end
@@ -104,11 +104,13 @@ function comm_open(sock, kernel, msg)
104104
msg, "comm_close"))
105105
end
106106
end
107+
108+
nothing
107109
end
108110

109111
function comm_msg(sock, kernel, msg)
110112
if haskey(msg.content, "comm_id")
111-
comm_id = msg.content["comm_id"]
113+
comm_id = msg.content["comm_id"]::String
112114
if haskey(kernel.comms, comm_id)
113115
comm = kernel.comms[comm_id]
114116
else
@@ -121,11 +123,13 @@ function comm_msg(sock, kernel, msg)
121123
end
122124
comm.on_msg(msg)
123125
end
126+
127+
nothing
124128
end
125129

126130
function comm_close(sock, kernel, msg)
127131
if haskey(msg.content, "comm_id")
128-
comm_id = msg.content["comm_id"]
132+
comm_id = msg.content["comm_id"]::String
129133
comm = kernel.comms[comm_id]
130134

131135
if !haskey(msg.content, "data")
@@ -135,6 +139,8 @@ function comm_close(sock, kernel, msg)
135139

136140
delete!(kernel.comms, comm.id)
137141
end
142+
143+
nothing
138144
end
139145

140146
end # module

0 commit comments

Comments
 (0)