Permalink
Browse files

0.4 deprecations: Union, UInt, Void, String

  • Loading branch information...
1 parent a9468e2 commit 387c38831b471a8246b2876fb8f1aa6ab596001f @dpsanders dpsanders committed Oct 2, 2015
View
@@ -49,7 +49,7 @@ A type `Element` which represents anything displayable (can use type promotion h
# stack elems in the specified direction (down, right, left, up)
flow(direction :: Symbol, elems :: Element....) # returns an Element
# Create a tab group with a tab for each element
-tabs(elems :: (String, Element)...) # returns an Element
+tabs(elems :: (AbstractString, Element)...) # returns an Element
# accordion, etc in the same vein
```
View
@@ -1,5 +1,5 @@
julia 0.3
JSON
-Compat
+Compat 0.7
Reactive 0.1.9
DataStructures 0.2.10
@@ -526,7 +526,7 @@
"data": {
"text/html": [],
"text/plain": [
- "Button{Nothing}([Input{Nothing}] nothing,\"Click Me\",nothing)"
+ "Button{Void}([Input{Void}] nothing,\"Click Me\",nothing)"
]
},
"execution_count": 8,
@@ -598,7 +598,7 @@
"data": {
"text/html": [],
"text/plain": [
- "Options{:Dropdown,ASCIIString}([Input{ASCIIString}] one,\"\",\"one\",\"one\",OptionDict({\"one\",\"two\",\"three\"},{\"two\"=>\"two\",\"one\"=>\"one\",\"three\"=>\"three\"}),None[],None[])"
+ "Options{:Dropdown,ASCIIAbstractString}([Input{ASCIIAbstractString}] one,\"\",\"one\",\"one\",OptionDict({\"one\",\"two\",\"three\"},{\"two\"=>\"two\",\"one\"=>\"one\",\"three\"=>\"three\"}),None[],None[])"
]
},
"execution_count": 10,
@@ -757,7 +757,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "A textbox can be of a `Number` or `String` type. `textbox` takes one argument: its default value."
+ "A textbox can be of a `Number` or `AbstractString` type. `textbox` takes one argument: its default value."
]
},
{
@@ -771,7 +771,7 @@
"data": {
"text/html": [],
"text/plain": [
- "Textbox{UTF8String}([Input{UTF8String}] Change me,\"\",nothing,\"Change me\")"
+ "Textbox{UTF8AbstractString}([Input{UTF8AbstractString}] Change me,\"\",nothing,\"Change me\")"
]
},
"execution_count": 16,
@@ -943,7 +943,7 @@
"data": {
"text/html": [],
"text/plain": [
- "Textarea{ASCIIString}([Input{ASCIIString}] Your very own $\\LaTeX$ editor,\"\",\"Your very own \\$\\\\LaTeX\\$ editor\")"
+ "Textarea{ASCIIAbstractString}([Input{ASCIIAbstractString}] Your very own $\\LaTeX$ editor,\"\",\"Your very own \\$\\\\LaTeX\\$ editor\")"
]
},
"execution_count": 22,
@@ -1023,7 +1023,7 @@
"data": {
"text/html": [],
"text/plain": [
- "Textbox{String}([Input{String}] text,\"\",nothing,\"text\")"
+ "Textbox{AbstractString}([Input{AbstractString}] text,\"\",nothing,\"text\")"
]
},
"metadata": {},
Oops, something went wrong.
Oops, something went wrong.
View
@@ -35,7 +35,7 @@ import Base: writemime, mimewritable
const comms = Dict{Signal, Comm}()
function get_data_dict(value, mimetypes)
- dict = Dict{ASCIIString, ByteString}()
+ dict = Dict{ASCIIAbstractString, ByteAbstractString}()
for m in mimetypes
if mimewritable(m, value)
dict[m] = stringmime(m, value)
@@ -51,7 +51,7 @@ end
function init_comm(x::Signal)
if !haskey(comms, x)
- subscriptions = Dict{ASCIIString, Int}()
+ subscriptions = Dict{ASCIIAbstractString, Int}()
function handle_subscriptions(msg)
if haskey(msg.content, "data")
action = get(msg.content["data"], "action", "")
@@ -207,7 +207,7 @@ function create_view(w::Widget)
if haskey(widget_comms, w)
comm = widget_comms[w]
else
- comm = Comm("ipython.widget", data=merge(Dict{String, Any}([
+ comm = Comm("ipython.widget", data=merge(Dict{AbstractString, Any}([
("model_name", "WidgetModel"),
("_model_name", "WidgetModel"), # Jupyter 4.0 missing (https://github.com/ipython/ipywidgets/pull/84)
]), view_state(w)))
View
@@ -49,8 +49,8 @@ end
uuid4() = string(Base.Random.uuid4())
-const id_to_widget = Dict{String, InputWidget}()
-const widget_to_id = Dict{InputWidget, String}()
+const id_to_widget = Dict{AbstractString, InputWidget}()
+const widget_to_id = Dict{InputWidget, AbstractString}()
function register_widget(w::InputWidget)
if haskey(widget_to_id, w)
@@ -63,7 +63,7 @@ function register_widget(w::InputWidget)
end
end
-function get_widget(id::String)
+function get_widget(id::AbstractString)
if haskey(id_to_widget, id)
return id_to_widget[id]
else
View
@@ -13,7 +13,7 @@ style(widget, style) = StyledWidget(widget, style)
immutable Labeled{W <: Widget} <: WidgetMod
widget::W
- label::String
+ label::AbstractString
end
label(widget, label) = LabeledWidget(widget, label)
View
@@ -11,7 +11,7 @@ export slider, togglebutton, button,
type Slider{T<:Number} <: InputWidget{T}
signal::Input{T}
- label::String
+ label::AbstractString
value::T
range::Range{T}
end
@@ -30,7 +30,7 @@ slider{T}(range::Range{T};
type Checkbox <: InputWidget{Bool}
signal::Input{Bool}
- label::String
+ label::AbstractString
value::Bool
end
@@ -44,7 +44,7 @@ checkbox(; label="", value=false, signal=Input(value)) =
type ToggleButton <: InputWidget{Bool}
signal::Input{Bool}
- label::String
+ label::AbstractString
value::Bool
end
@@ -60,7 +60,7 @@ togglebutton(label; kwargs...) =
type Button{T} <: InputWidget{T}
signal::Input{T}
- label::String
+ label::AbstractString
value::T
end
@@ -74,14 +74,14 @@ button(label; kwargs...) =
type Textbox{T} <: InputWidget{T}
signal::Input{T}
- label::String
- range::Union(Nothing, Range)
+ label::AbstractString
+ @compat range::Union{Void, Range}
value::T
end
function empty(t::Type)
if is(t, Number) zero(t)
- elseif is(t, String) ""
+ elseif is(t, AbstractString) ""
end
end
@@ -91,7 +91,7 @@ function Textbox(; label="",
typ=typeof(value),
range=nothing,
signal=Input{typ}(value))
- if isa(value, String) && !isa(range, Nothing)
+ if isa(value, AbstractString) && !isa(range, Void)
throw(ArgumentError(
"You cannot set a range on a string textbox"
))
@@ -102,7 +102,7 @@ end
textbox(;kwargs...) = Textbox(;kwargs...)
textbox(val; kwargs...) =
Textbox(value=val; kwargs...)
-textbox(val::String; kwargs...) =
+textbox(val::AbstractString; kwargs...) =
Textbox(value=utf8(val); kwargs...)
parse_msg{T<:Number}(w::Textbox{T}, val::AbstractString) = parse_msg(w, parse(T, val))
@@ -118,10 +118,10 @@ end
######################### Textarea ###########################
-type Textarea{String} <: InputWidget{String}
- signal::Input{String}
- label::String
- value::String
+type Textarea{AbstractString} <: InputWidget{AbstractString}
+ signal::Input{AbstractString}
+ label::AbstractString
+ value::AbstractString
end
textarea(args...) = Textarea(args...)
@@ -154,9 +154,9 @@ function Base.setindex!(x::OptionDict, v, k)
end
type Options{view, T} <: InputWidget{T}
signal::Signal
- label::String
+ label::AbstractString
value::T
- value_label::String
+ value_label::AbstractString
options::OptionDict
icons::AbstractArray
tooltips::AbstractArray
@@ -212,8 +212,8 @@ export HTML, Latex, Progress
type HTML <: Widget
- label::String
- value::String
+ label::AbstractString
+ value::AbstractString
end
html(label, value) = HTML(label, value)
html(value; label="") = HTML(label, value)
@@ -223,19 +223,19 @@ html(value; label="") = HTML(label, value)
## write(io, h.value)
type Latex <: Widget
- label::String
- value::String
+ label::AbstractString
+ value::AbstractString
end
-latex(label, value::String) = Latex(label, value)
-latex(value::String; label="") = Latex(label, value)
+latex(label, value::AbstractString) = Latex(label, value)
+latex(value::AbstractString; label="") = Latex(label, value)
latex(value; label="") = Latex(label, mimewritable("application/x-latex", value) ? stringmime("application/x-latex", value) : stringmime("text/latex", value))
## # assume we already have Latex
## writemime(io::IO, m::MIME{symbol("application/x-latex")}, l::Latex) =
## write(io, l.value)
type Progress <: Widget
- label::String
+ label::AbstractString
value::Int
range::Range
end
@@ -251,5 +251,5 @@ widget(x::Range, label="") = slider(x, label=label)
widget(x::AbstractVector, label="") = togglebuttons(x, label=label)
widget(x::Associative, label="") = togglebuttons(x, label=label)
widget(x::Bool, label="") = checkbox(x, label=label)
-widget(x::String, label="") = textbox(x, label=label, typ=String)
+widget(x::AbstractString, label="") = textbox(x, label=label, typ=AbstractString)
widget{T <: Number}(x::T, label="") = textbox(typ=T, value=x, label=label)

0 comments on commit 387c388

Please sign in to comment.