Skip to content

Commit

Permalink
Use === instead of ==
Browse files Browse the repository at this point in the history
Co-authored-by: Christopher Rackauckas <[email protected]>
  • Loading branch information
Zentrik and ChrisRackauckas authored Oct 1, 2023
1 parent 78b398e commit 87f72a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions lib/OptimizationBBO/src/OptimizationBBO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function SciMLBase.__solve(cache::Optimization.OptimizationCache{
cur, state = iterate(cache.data)

function _cb(trace)
if cache.callback == Optimization.DEFAULT_CALLBACK
if cache.callback === Optimization.DEFAULT_CALLBACK

Check warning on line 115 in lib/OptimizationBBO/src/OptimizationBBO.jl

View check run for this annotation

Codecov / codecov/patch

lib/OptimizationBBO/src/OptimizationBBO.jl#L115

Added line #L115 was not covered by tests
cb_call = false
else
cb_call = cache.callback(decompose_trace(trace, cache.progress), x...)
Expand All @@ -125,7 +125,7 @@ function SciMLBase.__solve(cache::Optimization.OptimizationCache{
BlackBoxOptim.shutdown_optimizer!(trace) #doesn't work
end

if cache.data != Optimization.DEFAULT_DATA
if cache.data !== Optimization.DEFAULT_DATA

Check warning on line 128 in lib/OptimizationBBO/src/OptimizationBBO.jl

View check run for this annotation

Codecov / codecov/patch

lib/OptimizationBBO/src/OptimizationBBO.jl#L128

Added line #L128 was not covered by tests
cur, state = iterate(cache.data, state)
end
cb_call
Expand All @@ -135,11 +135,11 @@ function SciMLBase.__solve(cache::Optimization.OptimizationCache{
maxtime = Optimization._check_and_convert_maxtime(cache.solver_args.maxtime)

_loss = function (θ)
if cache.callback == Optimization.DEFAULT_CALLBACK && cache.data == Optimization.DEFAULT_DATA
if cache.callback === Optimization.DEFAULT_CALLBACK && cache.data === Optimization.DEFAULT_DATA

Check warning on line 138 in lib/OptimizationBBO/src/OptimizationBBO.jl

View check run for this annotation

Codecov / codecov/patch

lib/OptimizationBBO/src/OptimizationBBO.jl#L138

Added line #L138 was not covered by tests
return first(cache.f(θ, cache.p))
elseif cache.callback == Optimization.DEFAULT_CALLBACK
elseif cache.callback === Optimization.DEFAULT_CALLBACK

Check warning on line 140 in lib/OptimizationBBO/src/OptimizationBBO.jl

View check run for this annotation

Codecov / codecov/patch

lib/OptimizationBBO/src/OptimizationBBO.jl#L140

Added line #L140 was not covered by tests
return first(cache.f(θ, cache.p, cur...))
elseif cache.data != Optimization.DEFAULT_DATA
elseif cache.data !== Optimization.DEFAULT_DATA

Check warning on line 142 in lib/OptimizationBBO/src/OptimizationBBO.jl

View check run for this annotation

Codecov / codecov/patch

lib/OptimizationBBO/src/OptimizationBBO.jl#L142

Added line #L142 was not covered by tests
x = cache.f(θ, cache.p)
return first(x)
else
Expand All @@ -149,8 +149,8 @@ function SciMLBase.__solve(cache::Optimization.OptimizationCache{
end

opt_args = __map_optimizer_args(cache, cache.opt;
callback = cache.callback == Optimization.DEFAULT_CALLBACK &&
cache.data == Optimization.DEFAULT_DATA ?
callback = cache.callback === Optimization.DEFAULT_CALLBACK &&
cache.data === Optimization.DEFAULT_DATA ?
nothing : _cb,
cache.solver_args...,
maxiters = maxiters,
Expand Down
4 changes: 2 additions & 2 deletions lib/OptimizationOptimisers/src/sophia.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ function SciMLBase.__solve(cache::OptimizationCache{
maxiters = Optimization._check_and_convert_maxiters(maxiters)

_loss = function (θ)
if cache.callback == Optimization.DEFAULT_CALLBACK && data == Optimization.DEFAULT_DATA
if cache.callback === Optimization.DEFAULT_CALLBACK && data === Optimization.DEFAULT_DATA

Check warning on line 74 in lib/OptimizationOptimisers/src/sophia.jl

View check run for this annotation

Codecov / codecov/patch

lib/OptimizationOptimisers/src/sophia.jl#L74

Added line #L74 was not covered by tests
return first(cache.f(θ, cache.p))
elseif cache.callback == Optimization.DEFAULT_CALLBACK
elseif cache.callback === Optimization.DEFAULT_CALLBACK

Check warning on line 76 in lib/OptimizationOptimisers/src/sophia.jl

View check run for this annotation

Codecov / codecov/patch

lib/OptimizationOptimisers/src/sophia.jl#L76

Added line #L76 was not covered by tests
return first(cache.f(θ, cache.p, cur...))
elseif data === Optimization.DEFAULT_DATA

Check warning on line 78 in lib/OptimizationOptimisers/src/sophia.jl

View check run for this annotation

Codecov / codecov/patch

lib/OptimizationOptimisers/src/sophia.jl#L78

Added line #L78 was not covered by tests
x = cache.f(θ, cache.p)
Expand Down

0 comments on commit 87f72a9

Please sign in to comment.