Skip to content

Commit

Permalink
fixed problem with isempty (being called during variable definition)
Browse files Browse the repository at this point in the history
  • Loading branch information
alefcastelli committed Aug 23, 2023
1 parent bceed7c commit 911ce3f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/PowerNetworkMatrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,11 @@ function Base.summary(io::IO, A::PowerNetworkMatrix)
show(IOContext(io, :limit => true), ax)
println(io)
end
print(io, "And data, a ", size(A))
print(io, "And data with size ", size(A))

Check warning on line 227 in src/PowerNetworkMatrix.jl

View check run for this annotation

Codecov / codecov/patch

src/PowerNetworkMatrix.jl#L227

Added line #L227 was not covered by tests
return
end

_summary(io::IO, A::PowerNetworkMatrix) = println(io, "PowerNetworkMatrix")
_summary(io::IO, ::T) where T <: PowerNetworkMatrix = println(io, "$T")

Check warning on line 231 in src/PowerNetworkMatrix.jl

View check run for this annotation

Codecov / codecov/patch

src/PowerNetworkMatrix.jl#L231

Added line #L231 was not covered by tests

function Base.summary(
io::IOContext{Base.GenericIOBuffer{Array{UInt8, 1}}},
Expand Down Expand Up @@ -303,7 +303,7 @@ function Base.show_nd(
end
end

function Base.show(io::IO, array::PowerNetworkMatrix)
function Base.show(io::IO, ::MIME{Symbol("text/plain")}, array::PowerNetworkMatrix)

Check warning on line 306 in src/PowerNetworkMatrix.jl

View check run for this annotation

Codecov / codecov/patch

src/PowerNetworkMatrix.jl#L306

Added line #L306 was not covered by tests
summary(io, array)
isempty(array) && return
println(io, ":")
Expand Down
2 changes: 1 addition & 1 deletion src/virtual_lodf_calculations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function Base.isempty(vlodf::VirtualLODF)
for name in fieldnames(typeof(vlodf))
# note: impossible to define empty KLU field
if name != :K && isempty(getfield(vlodf, name))
@info "Field " * string(name) * " is empty."
@debug "Field " * string(name) * " is empty."
return true
end
end
Expand Down
4 changes: 2 additions & 2 deletions src/virtual_ptdf_calculations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ Checks if the any of the fields of VirtualPTDF is empty.
function Base.isempty(vptdf::VirtualPTDF)
for name in fieldnames(typeof(vptdf))
if name == :dist_slack && isempty(getfield(vptdf, name))
@info "Field dist_slack has default value: " *
@debug "Field dist_slack has default value: " *
string(getfield(vptdf, name)) * "."
elseif !(name in [:K, :dist_slack]) && isempty(getfield(vptdf, name))
@info "Field " * string(name) * " not defined."
@debug "Field " * string(name) * " not defined."
return true
end
end
Expand Down

0 comments on commit 911ce3f

Please sign in to comment.