Skip to content

Commit

Permalink
fix: namespace couldn't be unloaded cleanly
Browse files Browse the repository at this point in the history
  • Loading branch information
bblodfon committed Jan 31, 2024
1 parent 14aeab8 commit 42ee837
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ register_mlr3pipelines = function() {
iwalk(as.list(mlr3proba_graphs), function(obj, name) mlr_graphs$add(name, obj)) # nolint
}

.onLoad = function(libname, pkgname) { # nolint
.onLoad = function(libname, pkgname) {
register_mlr3()
if (requireNamespace("mlr3pipelines", quietly = TRUE)) {
register_mlr3pipelines()
Expand All @@ -164,7 +164,7 @@ register_mlr3pipelines = function() {
action = "append")
}

.onUnload = function(libpath) { # nolint
.onUnload = function(libpath) {
event = packageEvent("mlr3", "onLoad")
hooks = getHook(event)
pkgname = vapply(hooks[-1], function(x) environment(x)$pkgname, NA_character_)
Expand All @@ -180,8 +180,8 @@ register_mlr3pipelines = function() {
walk(names(mlr3proba_tasks), function(nm) mlr_tasks$remove(nm))
walk(names(mlr3proba_measures), function(nm) mlr_measures$remove(nm))
walk(names(mlr3proba_task_gens), function(nm) mlr_task_generators$remove(nm))
walk(names(mlr3proba_pipeops), function(nm) mlr_pipeops$remove(nm))
walk(names(mlr3proba_graphs), function(nm) mlr_graphs$remove(nm))
walk(names(mlr3proba_pipeops), function(nm) mlr3pipelines::mlr_pipeops$remove(nm))
walk(names(mlr3proba_graphs), function(nm) mlr3pipelines::mlr_graphs$remove(nm))

library.dynam.unload("mlr3proba", libpath)
}
Expand Down

0 comments on commit 42ee837

Please sign in to comment.