Skip to content

Commit ef29f00

Browse files
committed
Use positional instead of keyword arguments for EachLine
1 parent c83bef0 commit ef29f00

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

base/deprecated.jl

-2
Original file line numberDiff line numberDiff line change
@@ -1809,8 +1809,6 @@ eval(LibGit2, quote
18091809
end
18101810
end)
18111811

1812-
@deprecate EachLine(stream, ondone) EachLine(stream, ondone=ondone)
1813-
18141812
# These conversions should not be defined, see #19896
18151813
@deprecate convert{T<:Number}(::Type{T}, x::Dates.Period) convert(T, Dates.value(x))
18161814
@deprecate convert{T<:Dates.Period}(::Type{T}, x::Real) T(x)

base/io.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ type EachLine
543543
ondone::Function
544544
chomp::Bool
545545

546-
EachLine(stream::IO=STDIN; ondone::Function=()->nothing, chomp::Bool=true) =
546+
EachLine(stream::IO=STDIN, ondone::Function=()->nothing, chomp::Bool=true) =
547547
new(stream, ondone, chomp)
548548
end
549549

@@ -558,11 +558,11 @@ removed. When called with a file name, the file is opened once at the beginning
558558
iteration and closed at the end. If iteration is interrupted, the file will be
559559
closed when the `EachLine` object is garbage collected.
560560
"""
561-
eachline(stream::IO=STDIN; chomp::Bool=true) = EachLine(stream, chomp=chomp)::EachLine
561+
eachline(stream::IO=STDIN; chomp::Bool=true) = EachLine(stream, ()->nothing, chomp)
562562

563563
function eachline(filename::AbstractString; chomp::Bool=true)
564564
s = open(filename)
565-
EachLine(s, ondone=()->close(s), chomp=chomp)::EachLine
565+
EachLine(s, ()->close(s), chomp)
566566
end
567567

568568
start(itr::EachLine) = nothing

base/process.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,8 @@ function eachline(cmd::AbstractCmd, stdin; chomp::Bool=true)
561561
close(stdout.in)
562562
out = stdout.out
563563
# implicitly close after reading lines, since we opened
564-
return EachLine(out, chomp=chomp,
565-
ondone=()->(close(out); success(processes) || pipeline_error(processes)))
564+
return EachLine(out,
565+
()->(close(out); success(processes) || pipeline_error(processes)), chomp)
566566
end
567567
eachline(cmd::AbstractCmd; chomp::Bool=true) = eachline(cmd, DevNull, chomp=chomp)
568568

test/iterators.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ end
2929
let b = IOBuffer("foo\n")
3030
@test collect(EachLine(b)) == ["foo"]
3131
seek(b, 0)
32-
@test collect(EachLine(b, chomp=false)) == ["foo\n"]
32+
@test collect(EachLine(b, ()->nothing, false)) == ["foo\n"]
3333
seek(b, 0)
34-
@test collect(EachLine(b, ondone=()->0)) == ["foo"]
34+
@test collect(EachLine(b, ()->0)) == ["foo"]
3535
seek(b, 0)
36-
@test collect(EachLine(b, chomp=false, ondone=()->0)) == ["foo\n"]
36+
@test collect(EachLine(b, ()->0, false)) == ["foo\n"]
3737
end
3838

3939
# enumerate (issue #6284)

0 commit comments

Comments
 (0)