Skip to content

Commit

Permalink
Updates for Julia 0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan committed May 30, 2018
1 parent 7457f08 commit f70f417
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ os:
- linux
- osx
julia:
- 0.5
- 0.6
- nightly
notifications:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Showoff

[![Showoff](http://pkg.julialang.org/badges/Showoff_0.5.svg)](http://pkg.julialang.org/?pkg=Showoff)
[![Showoff](http://pkg.julialang.org/badges/Showoff_0.6.svg)](http://pkg.julialang.org/?pkg=Showoff)
[![Showoff](http://pkg.julialang.org/badges/Showoff_0.7.svg)](http://pkg.julialang.org/?pkg=Showoff)
[![Build Status](https://travis-ci.org/JuliaGraphics/Showoff.jl.svg?branch=master)](https://travis-ci.org/JuliaGraphics/Showoff.jl)
[![Coverage Status](https://coveralls.io/repos/github/JuliaGraphics/Showoff.jl/badge.svg?branch=master)](https://coveralls.io/github/JuliaGraphics/Showoff.jl?branch=master)

Expand All @@ -16,9 +16,9 @@ If you want your type to look nice when plotted, just define a `showoff`
function. Here's an example.

```julia
import Showoff
using Showoff

immutable Percent
struct Percent
value::Float64
end

Expand Down
4 changes: 2 additions & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
julia 0.5
Compat 0.18.0
julia 0.6
Compat 0.59.0
14 changes: 7 additions & 7 deletions src/Showoff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ __precompile__()
module Showoff

using Compat
import Compat.Iterators: drop
using Compat.Dates

export showoff

Expand All @@ -21,7 +21,7 @@ end

# Fallback
function showoff(xs::AbstractArray, style=:none)
result = Vector{String}(length(xs))
result = Vector{String}(undef, length(xs))
buf = IOBuffer()
for (i, x) in enumerate(xs)
show(buf, x)
Expand Down Expand Up @@ -78,7 +78,7 @@ function concrete_maximum(xs)
end


function plain_precision_heuristic{T <: AbstractFloat}(xs::AbstractArray{T})
function plain_precision_heuristic(xs::AbstractArray{<:AbstractFloat})
ys = filter(isfinite, xs)
precision = 0
for y in ys
Expand All @@ -89,14 +89,14 @@ function plain_precision_heuristic{T <: AbstractFloat}(xs::AbstractArray{T})
end


function scientific_precision_heuristic{T <: AbstractFloat}(xs::AbstractArray{T})
function scientific_precision_heuristic(xs::AbstractArray{<:AbstractFloat})
ys = [x == 0.0 ? 0.0 : x / 10.0^floor(log10(abs(x)))
for x in xs if isfinite(x)]
return plain_precision_heuristic(ys) + 1
end


function showoff{T <: AbstractFloat}(xs::AbstractArray{T}, style=:auto)
function showoff(xs::AbstractArray{<:AbstractFloat}, style=:auto)
x_min = concrete_minimum(xs)
x_max = concrete_maximum(xs)
x_min = Float64(Float32(x_min))
Expand Down Expand Up @@ -262,7 +262,7 @@ function format_fixed_scientific(x::AbstractFloat, precision::Integer,
end


function showoff{T <: (Union{Date, DateTime})}(ds::AbstractArray{T}, style=:none)
function showoff(ds::AbstractArray{T}, style=:none) where T<:Union{Date,DateTime}
years = Set()
months = Set()
days = Set()
Expand Down Expand Up @@ -311,7 +311,7 @@ function showoff{T <: (Union{Date, DateTime})}(ds::AbstractArray{T}, style=:none
first_label_format = f1
end

labels = Vector{String}(length(ds))
labels = Vector{String}(undef, length(ds))
labels[1] = Dates.format(ds[1], first_label_format)
d_last = ds[1]
for (i, d) in enumerate(ds[2:end])
Expand Down
3 changes: 2 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Showoff
using Base.Test
using Compat
using Compat.Test

@testset "Internals" begin
@test Showoff.@grisu_ccall(1, 2, 3) === nothing
Expand Down

0 comments on commit f70f417

Please sign in to comment.