Skip to content

Commit

Permalink
fix some deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Apr 16, 2018
1 parent 1db899c commit e2a8226
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
julia 0.6

Compat 0.43
Compat 0.62
JSON
MbedTLS
HTTP 0.6.3
Expand Down
2 changes: 1 addition & 1 deletion src/activity/events.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ sig_header(request::HTTP.Request) = HTTP.header(request, "X-Hub-Signature")

function has_valid_secret(request::HTTP.Request, secret)
if has_sig_header(request)
secret_sha = "sha1="*bytes2hex(MbedTLS.digest(MbedTLS.MD_SHA1, HTTP.payload(request, String), secret))
secret_sha = "sha1="*bytes2hex(MbedTLS.digest(MbedTLS.MD_SHA1, HTTP.payload(request), secret))
return sig_header(request) == secret_sha
end
return false
Expand Down
4 changes: 2 additions & 2 deletions src/git/reference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ name(ref::Reference) = String(split(get(ref.ref), "refs/")[2])

@api_default function reference(api::GitHubAPI, repo, ref_obj; options...)
result = gh_get_json(api, "/repos/$(name(repo))/git/refs/$(name(ref_obj))"; options...)
return Reference.(result)
return Reference(result)
end

@api_default function references(api::GitHubAPI, repo; options...)
results, page_data = gh_get_paged_json(api, "/repos/$(name(repo))/git/refs"; options...)
return Reference.(results), page_data
return Reference.((results,)), page_data
end

@api_default function create_reference(api::GitHubAPI, repo; options...)
Expand Down
42 changes: 21 additions & 21 deletions src/utils/GitHubType.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ end
@generated function json2github(::Type{G}, data::Dict) where {G<:GitHubType}
types = G.types
fields = fieldnames(G)
args = Vector{Expr}(length(fields))
args = Vector{Expr}(undef, length(fields))
for i in eachindex(fields)
field, T = fields[i], first(types[i].parameters)
key = field == :typ ? "type" : string(field)
Expand Down Expand Up @@ -125,27 +125,27 @@ end
###################

function Base.show(io::IO, g::GitHubType)
print(io, "$(typeof(g)) (all fields are Nullable):")
for field in fieldnames(typeof(g))
val = getfield(g, field)
if !(isnull(val))
gotval = get(val)
println(io)
print(io, " $field: ")
if isa(gotval, Vector)
print(io, typeof(gotval))
else
showcompact(io, gotval)
end
if get(io, :compact, false)
uri_id = namefield(g)
if isnull(uri_id)
print(io, typeof(g), "(…)")
else
print(io, typeof(g), "($(repr(get(uri_id))))")
end
end
end

function Base.showcompact(io::IO, g::GitHubType)
uri_id = namefield(g)
if isnull(uri_id)
print(io, typeof(g), "(…)")
else
print(io, typeof(g), "($(repr(get(uri_id))))")
print(io, "$(typeof(g)) (all fields are Nullable):")
for field in fieldnames(typeof(g))
val = getfield(g, field)
if !(isnull(val))
gotval = get(val)
println(io)
print(io, " $field: ")
if isa(gotval, Vector)
print(io, typeof(gotval))
else
show(IOContext(io, :compact => true), gotval)
end
end
end
end
end
2 changes: 1 addition & 1 deletion src/utils/requests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ get_page_links(r) = split(HTTP.header(r, "Link",), ",")
function find_page_link(links, rel)
relstr = "rel=\"$(rel)\""
for i in 1:length(links)
if contains(links[i], relstr)
if occursin(relstr, links[i])
return i
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/event_tests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include("commit_comment.jl")
event_request = create_event()
event_json = JSON.parse(HTTP.payload(event_request, String))
event_json = JSON.parse(IOBuffer(HTTP.payload(event_request)))
event = GitHub.event_from_payload!("commit_comment", event_json)

@testset "WebhookEvent" begin
Expand Down
2 changes: 1 addition & 1 deletion test/read_only_api_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ end
@test entry["type"] == "blob"

b = blob(github_jl, entry["sha"]; auth=auth)
@test contains(String(base64decode(replace(get(b.content),"\n" => ""))), "GitHub.jl")
@test occursin("GitHub.jl", String(base64decode(replace(get(b.content),"\n" => ""))))

break
end
Expand Down

0 comments on commit e2a8226

Please sign in to comment.