Skip to content
Snippets Groups Projects
Verified Commit 4db94c0a authored by Michiel Cottaar's avatar Michiel Cottaar
Browse files

Make printing more robust

parent 4e90a823
No related branches found
No related tags found
No related merge requests found
...@@ -178,17 +178,16 @@ function Base.show(io::IO, printer::BuildingBlockPrinter) ...@@ -178,17 +178,16 @@ function Base.show(io::IO, printer::BuildingBlockPrinter)
print(io, ", ") print(io, ", ")
end end
for name in propertynames(block) for name in propertynames(block)
value = getproperty(block, name) ft = fieldtype(typeof(block), name)
if ( if (
name in variable_names || ft in (VariableType, Model) ||
value isa AbstractJuMPScalar || ft <: BuildingBlock ||
(value isa AbstractVector && eltype(value) isa AbstractJuMPScalar) || (ft <: AbstractVector && eltype(ft) == VariableType) ||
value isa Model || string(name)[1] == "_"
value isa BuildingBlock ||
string(name)[1] == '_'
) )
continue continue
end end
print(io, name, "=", repr(value), ", ") print(io, name, "=", repr(value), ", ")
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment