<commit_before>

# Measures without Canvas Units
# -----------------------------

# Rather than introducing a new type to represent measures that
# have no canvas unit dimension, we just parameterize Measure
# over a special type that promotes appropriately.
immutable MeasureNil
end

const measure_nil = MeasureNil()


# All measures in Compose are specified as the sum
immutable Measure{S, T}
    abs::Float64 # absolute measurement in millimeters
    cx::S        # canvas x-units
    cy::T        # canvas y-units
    cw::Float64  # proportion of canvas width
    ch::Float64  # proportion of canvas height

    function Measure(abs::Number, cx::S, cy::T, cw::Number, ch::Number)
        new(float64(abs), cx, cy, float64(cw), float64(ch))
    end

    function Measure(; abs=0.0, cx::S=zero(S), cy::T=zero(T), cw=0.0, ch=0.0)
        new(float64(abs), cx, cy, float64(cw), float64(ch))
    end
end


typealias MeasureOrNumber Union(Measure, Number)


# MeasureNil semantics
zero(::Type{MeasureNil}) = measure_nil
zero(::MeasureNil) = measure_nil

# ambiguity warning
max(::Function, b::MeasureNil) = measure_nil
min(::Function, b::MeasureNil) = measure_nil

max(a::MeasureNil, b::MeasureNil) = measure_nil
max(a::MeasureNil, b)             = b
max(a, b::MeasureNil)             = a

min(a::MeasureNil, b::MeasureNil) = measure_nil
min(a::MeasureNil, b)             = measure_nil
min(a, b::MeasureNil)             = measure_nil

isless(a::MeasureNil, b::MeasureNil) = false

+(a::MeasureNil, b::MeasureNil)      = measure_nil
+(a::MeasureNil, b::MeasureOrNumber) = b
+(a::MeasureOrNumber, b::MeasureNil) = a

-(a::MeasureNil, b::MeasureNil)      = measure_nil
-(a::MeasureNil, b::MeasureOrNumber) = -b
-(a::MeasureOrNumber, b::MeasureNil) =  a
-(a::MeasureNil)                     = measure_nil

*(a::MeasureNil, b::MeasureNil)      = error("Two measure_nil objects multiplied")
*(a::MeasureNil, b::MeasureOrNumber) = measure_nil
*(a::MeasureOrNumber, b::MeasureNil) = measure_nil

/(a::MeasureNil, b::MeasureNil)      = error("Division by a measure_nil")
/(a::MeasureOrNumber, b::MeasureNil) = error("Division by a measure_nil")
/(a::MeasureNil, b::MeasureOrNumber) = measure_nil


function -{S,T}(a::Measure{S, T})
    return Measure{S, T}(-a.abs, -a.cx, -a.cy, -a.cw, -a.ch)
end


function zero(::Type{Measure})
    return Measure()
end


function zero(::Measure)
    return Measure()
end<commit_msg>Fix overly restrictive types in measure ops.<commit_after>

# Measures without Canvas Units
# -----------------------------

# Rather than introducing a new type to represent measures that
# have no canvas unit dimension, we just parameterize Measure
# over a special type that promotes appropriately.
immutable MeasureNil
end

const measure_nil = MeasureNil()


# All measures in Compose are specified as the sum
immutable Measure{S, T}
    abs::Float64 # absolute measurement in millimeters
    cx::S        # canvas x-units
    cy::T        # canvas y-units
    cw::Float64  # proportion of canvas width
    ch::Float64  # proportion of canvas height

    function Measure(abs::Number, cx::S, cy::T, cw::Number, ch::Number)
        new(float64(abs), cx, cy, float64(cw), float64(ch))
    end

    function Measure(; abs=0.0, cx::S=zero(S), cy::T=zero(T), cw=0.0, ch=0.0)
        new(float64(abs), cx, cy, float64(cw), float64(ch))
    end
end


typealias MeasureOrNumber Union(Measure, Number)


# MeasureNil semantics
zero(::Type{MeasureNil}) = measure_nil
zero(::MeasureNil) = measure_nil

# ambiguity warning
max(::Function, b::MeasureNil) = measure_nil
min(::Function, b::MeasureNil) = measure_nil

max(a::MeasureNil, b::MeasureNil) = measure_nil
max(a::MeasureNil, b)             = b
max(a, b::MeasureNil)             = a

min(a::MeasureNil, b::MeasureNil) = measure_nil
min(a::MeasureNil, b)             = measure_nil
min(a, b::MeasureNil)             = measure_nil

isless(a::MeasureNil, b::MeasureNil) = false

+(a::MeasureNil, b::MeasureNil) = measure_nil
+(a::MeasureNil, b)             = b
+(a, b::MeasureNil)             = a

-(a::MeasureNil, b::MeasureNil) = measure_nil
-(a::MeasureNil, b)             = -b
-(a, b::MeasureNil)             =  a
-(a::MeasureNil)                = measure_nil

*(a::MeasureNil, b::MeasureNil) = error("Two measure_nil objects multiplied")
*(a::MeasureNil, b)             = measure_nil
*(a, b::MeasureNil)             = measure_nil

/(a::MeasureNil, b::MeasureNil) = error("Division by a measure_nil")
/(a, b::MeasureNil)             = error("Division by a measure_nil")
/(a::MeasureNil, b)             = measure_nil


function -{S,T}(a::Measure{S, T})
    return Measure{S, T}(-a.abs, -a.cx, -a.cy, -a.cw, -a.ch)
end


function zero(::Type{Measure})
    return Measure()
end


function zero(::Measure)
    return Measure()
end
{'fraction_non_alphanumeric': 0.15502092050209204, 'fraction_numerical': 0.0100418410041841, 'mean_word_length': 3.5231788079470197, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4389857', 'n_tokens_mistral': 1623, 'n_tokens_neox': 1548, 'n_words': 411}