|
3 | 3 | # returning results. |
4 | 4 |
|
5 | 5 | import Base.Libc: flush_cstdio |
6 | | -if VERSION ≥ v"0.7" |
7 | | - import Pkg |
8 | | -end |
| 6 | +import Pkg |
9 | 7 |
|
10 | 8 | const text_plain = MIME("text/plain") |
11 | 9 | const image_svg = MIME("image/svg+xml") |
@@ -62,20 +60,16 @@ const displayqueue = Any[] |
62 | 60 |
|
63 | 61 | # remove x from the display queue |
64 | 62 | function undisplay(x) |
65 | | - i = Compat.findfirst(isequal(x), displayqueue) |
| 63 | + i = findfirst(isequal(x), displayqueue) |
66 | 64 | i !== nothing && splice!(displayqueue, i) |
67 | 65 | return x |
68 | 66 | end |
69 | 67 |
|
70 | | -if VERSION < v"0.7.0-DEV.3498" # julia #25544 |
71 | | - import Base.REPL: ip_matches_func |
72 | | -else |
73 | | - import Base: ip_matches_func |
74 | | -end |
| 68 | +import Base: ip_matches_func |
75 | 69 |
|
76 | 70 | function show_bt(io::IO, top_func::Symbol, t, set) |
77 | 71 | # follow PR #17570 code in removing top_func from backtrace |
78 | | - eval_ind = Compat.findlast(addr->ip_matches_func(addr, top_func), t) |
| 72 | + eval_ind = findlast(addr->ip_matches_func(addr, top_func), t) |
79 | 73 | eval_ind !== nothing && (t = t[1:eval_ind-1]) |
80 | 74 | Base.show_backtrace(io, t) |
81 | 75 | end |
|
84 | 78 | # doesn't support keyword arguments. |
85 | 79 | showerror_nobt(io, e, bt) = showerror(io, e, bt, backtrace=false) |
86 | 80 |
|
87 | | -@static if VERSION < v"0.7.0-DEV.4724" |
88 | | - # https://github.com/JuliaLang/Compat.jl/pull/572 |
89 | | - # thanks to https://github.com/jipolanco/WriteVTK.jl/commit/ea046493c7787ae651b5f629455aaf7bdaa000b1 |
90 | | - rsplit(s::AbstractString; limit::Integer=0, keepempty::Bool=false) = |
91 | | - Base.rsplit(s) |
92 | | - rsplit(s::AbstractString, splitter; limit::Integer=0, keepempty::Bool=false) = |
93 | | - Base.rsplit(s, splitter; limit=limit, keep=keepempty) |
94 | | - split(s::AbstractString; limit::Integer=0, keepempty::Bool=false) = |
95 | | - Base.split(s) |
96 | | - split(s::AbstractString, splitter; limit::Integer=0, keepempty::Bool=false) = |
97 | | - Base.split(s, splitter; limit=limit, keep=keepempty) |
98 | | -end |
99 | | - |
100 | 81 | # return the content of a pyerr message for exception e |
101 | 82 | function error_content(e, bt=catch_backtrace(); |
102 | 83 | backtrace_top::Symbol=SOFTSCOPE[] ? :softscope_include_string : :include_string, |
@@ -130,11 +111,7 @@ execute_msg = Msg(["julia"], Dict("username"=>"jlkernel", "session"=>uuid4()), D |
130 | 111 | # request |
131 | 112 | const stdio_bytes = Ref(0) |
132 | 113 |
|
133 | | -if VERSION < v"0.7.0-DEV.3589" # julia #25738 |
134 | | - import Base.Docs: helpmode # added in 0.6, see julia #19858 |
135 | | -else |
136 | | - import REPL: helpmode |
137 | | -end |
| 114 | +import REPL: helpmode |
138 | 115 |
|
139 | 116 | # use a global array to accumulate "payloads" for the execute_reply message |
140 | 117 | const execute_payloads = Dict[] |
@@ -169,12 +146,11 @@ function execute_request(socket, msg) |
169 | 146 | m -> string(replace(m, r"^\s*;" => "Base.repl_cmd(`"), |
170 | 147 | "`, ", stdout_name, ")")) |
171 | 148 |
|
172 | | - if VERSION ≥ v"0.7" |
173 | | - # "] ..." cells are interpreted as pkg shell commands |
174 | | - if occursin(r"^\].*$", code) |
175 | | - code = "IJulia.Pkg.REPLMode.do_cmd(IJulia.minirepl[], \"" * |
176 | | - escape_string(code[2:end]) * "\"; do_rethrow=true)" |
177 | | - end |
| 149 | + |
| 150 | + # "] ..." cells are interpreted as pkg shell commands |
| 151 | + if occursin(r"^\].*$", code) |
| 152 | + code = "IJulia.Pkg.REPLMode.do_cmd(IJulia.minirepl[], \"" * |
| 153 | + escape_string(code[2:end]) * "\"; do_rethrow=true)" |
178 | 154 | end |
179 | 155 |
|
180 | 156 | # a cell beginning with "? ..." is interpreted as a help request |
|
0 commit comments