@@ -120,25 +120,38 @@ show_handle(object) = false
120
120
function simple_repr (T)
121
121
repr = string (T. name. name)
122
122
parameters = T. parameters
123
- p_string = " "
124
- if length (parameters) > 0
125
- p = parameters[1 ]
126
- if p isa DataType
127
- p_string = simple_repr (p)
128
- elseif p isa Symbol
129
- p_string = string (" :" , p)
130
- end
131
- if length (parameters) > 1
132
- p_string *= " ,…"
133
- end
134
- end
135
- isempty (p_string) || (repr *= " {" * p_string* " }" )
123
+
124
+ # # add abbreviated type parameters:
125
+ # p_string = ""
126
+ # if length(parameters) > 0
127
+ # p = parameters[1]
128
+ # if p isa DataType
129
+ # p_string = simple_repr(p)
130
+ # elseif p isa Symbol
131
+ # p_string = string(":", p)
132
+ # end
133
+ # if length(parameters) > 1
134
+ # p_string *= ",…"
135
+ # end
136
+ # end
137
+ # isempty(p_string) || (repr *= "{"*p_string*"}")
138
+
136
139
return repr
137
140
end
138
141
139
142
# short version of showing a `MLJType` object:
140
143
function Base. show (stream:: IO , object:: MLJType )
141
144
str = simple_repr (typeof (object))
145
+ L = length (propertynames (object))
146
+ if L > 0
147
+ first_name = propertynames (object) |> first
148
+ value = getproperty (object, first_name)
149
+ str *= " ($first_name = $value "
150
+ L > 1 && (str *= " , …" )
151
+ str *= " )"
152
+ else
153
+ str *= " ()"
154
+ end
142
155
show_handle (object) && (str *= " $(handle (object)) " )
143
156
if false # !isempty(propertynames(object))
144
157
printstyled (IOContext (stream, :color => SHOW_COLOR),
@@ -185,9 +198,13 @@ function fancy(stream, object::MLJType, current_depth, depth, n)
185
198
show_compact (object) ||
186
199
print (stream, crind (n + length (prefix) - anti))
187
200
print (stream, " $(names[k]) = " )
188
- fancy (stream, value, current_depth + 1 , depth, n + length (prefix)
189
- - anti + length (" $k = " ))
190
- k == n_names || print (stream, " ," )
201
+ if show_compact (object)
202
+ show (stream, value)
203
+ else
204
+ fancy (stream, value, current_depth + 1 , depth, n + length (prefix)
205
+ - anti + length (" $k = " ))
206
+ end
207
+ k == n_names || print (stream, " , " )
191
208
end
192
209
print (stream, " )" )
193
210
if current_depth == 0 && show_handle (object)
0 commit comments