Skip to content

Commit

Permalink
Merge pull request #7 from queryverse/fix-iteratorsize
Browse files Browse the repository at this point in the history
Fix iteratorsize
  • Loading branch information
davidanthoff authored Feb 9, 2019
2 parents 3a4ab5a + e7f7d5f commit 73f7e48
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# TableShowUtils.jl v0.2.2 Release Notes
* Fix how IteratorSize is handled

# TableShowUtils.jl v0.2.1 Release Notes
* Fix a remaining julia deprecation bug

Expand Down
4 changes: 2 additions & 2 deletions src/TableShowUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function printtable(io::IO, source, typename::AbstractString; force_unknown_rows
if force_unknown_rows
rows = nothing
data = Iterators.take(source, 10) |> collect
elseif Base.IteratorSize(source)==Base.HasLength()
elseif Base.IteratorSize(source) isa Union{Base.HasLength, Base.HasShape{1}}
rows = length(source)
data = Iterators.take(source, 10) |> collect
else
Expand Down Expand Up @@ -123,7 +123,7 @@ function printHTMLtable(io, source; force_unknown_rows=false)

if force_unknown_rows
rows = nothing
elseif Base.IteratorSize(source)==Base.HasLength()
elseif Base.IteratorSize(source) isa Union{Base.HasLength, Base.HasShape{1}}
rows = length(source)
else
count_needed_plus_one = Iterators.count(i->true, Iterators.take(source, max_elements+1))
Expand Down

0 comments on commit 73f7e48

Please sign in to comment.