Skip to content

Commit 622cb09

Browse files
Remove new_qenv (#222)
# Pull Request As commented on #215, it was hard to see a pattern on what to do when deprecating functions. Based on @m7pr feedback I deleted the help page and the code (generic and methods). teal.gallery and tlg-catalog were searched and no usage was found (and deprectae_warn, would have warned). Fixes #215 --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 86aa265 commit 622cb09

File tree

5 files changed

+5
-94
lines changed

5 files changed

+5
-94
lines changed

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export(get_env)
1111
export(get_var)
1212
export(get_warnings)
1313
export(join)
14-
export(new_qenv)
1514
export(qenv)
1615
exportClasses(qenv)
1716
exportMethods(show)

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
### Breaking Change
1111

12-
* `qenv` objects should now be created with `qenv()` rather than `new_qenv()`. The new constructor always creates an empty object. `new_qenv` is now deprecated.
12+
* `qenv` objects should now be created with `qenv()` rather than `new_qenv()` (which has been removed). The new constructor always creates an empty object.
1313

1414
### Miscellaneous
1515

R/qenv-constructor.R

Lines changed: 2 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@
1010
#' `qenv()` instantiates a `qenv` with an empty environment.
1111
#' Any changes must be made by evaluating code in it with `eval_code` or `within`, thereby ensuring reproducibility.
1212
#'
13-
#' `new_qenv()` (`r badge("deprecated")` and not recommended)
14-
#' can instantiate a `qenv` object with data in the environment and code registered.
15-
#'
1613
#' @name qenv
1714
#'
18-
#' @return `qenv` and `new_qenv` return a `qenv` object.
15+
#' @return Returns a `qenv` object.
1916
#'
17+
#' @seealso [`base::within()`], [`get_var()`], [`get_env()`], [`get_warnings()`], [`join()`], [`concat()`]
2018
#' @examples
2119
#' # create empty qenv
2220
#' qenv()
@@ -27,69 +25,3 @@ qenv <- function() {
2725
lockEnvironment(q_env, bindings = TRUE)
2826
methods::new("qenv", env = q_env)
2927
}
30-
31-
32-
#' @param code `r badge("deprecated")`
33-
#' (`character(1)` or `language`) code to evaluate. Accepts and stores comments also.
34-
#' @param env `r badge("deprecated")` (`environment`)
35-
#' Environment being a result of the `code` evaluation.
36-
#'
37-
#' @examples
38-
#' # create qenv with data and code (deprecated)
39-
#' new_qenv(env = list2env(list(a = 1)), code = quote(a <- 1))
40-
#' new_qenv(env = list2env(list(a = 1)), code = parse(text = "a <- 1", keep.source = TRUE))
41-
#' new_qenv(env = list2env(list(a = 1)), code = "a <- 1")
42-
#'
43-
#' @rdname qenv
44-
#' @aliases new_qenv,environment,expression-method
45-
#' @aliases new_qenv,environment,character-method
46-
#' @aliases new_qenv,environment,language-method
47-
#' @aliases new_qenv,environment,missing-method
48-
#' @aliases new_qenv,missing,missing-method
49-
#'
50-
#' @seealso [`base::within()`], [`get_var()`], [`get_env()`], [`get_warnings()`], [`join()`], [`concat()`]
51-
#'
52-
#' @export
53-
setGeneric("new_qenv", function(env = new.env(parent = parent.env(.GlobalEnv)), code = character()) {
54-
lifecycle::deprecate_warn(when = " 0.5.0", what = "new_qenv()", with = "qenv()", always = TRUE)
55-
standardGeneric("new_qenv")
56-
})
57-
58-
setMethod(
59-
"new_qenv",
60-
signature = c(env = "environment", code = "expression"),
61-
function(env, code) {
62-
new_qenv(env, paste(lang2calls(code), collapse = "\n"))
63-
}
64-
)
65-
66-
setMethod(
67-
"new_qenv",
68-
signature = c(env = "environment", code = "character"),
69-
function(env, code) {
70-
new_env <- rlang::env_clone(env, parent = parent.env(.GlobalEnv))
71-
lockEnvironment(new_env, bindings = TRUE)
72-
if (length(code) > 0) code <- paste(code, collapse = "\n")
73-
id <- sample.int(.Machine$integer.max, size = length(code))
74-
methods::new(
75-
"qenv",
76-
env = new_env, code = code, warnings = rep("", length(code)), messages = rep("", length(code)), id = id
77-
)
78-
}
79-
)
80-
81-
setMethod(
82-
"new_qenv",
83-
signature = c(env = "environment", code = "language"),
84-
function(env, code) {
85-
new_qenv(env = env, code = paste(lang2calls(code), collapse = "\n"))
86-
}
87-
)
88-
89-
setMethod(
90-
"new_qenv",
91-
signature = c(code = "missing", env = "missing"),
92-
function(env, code) {
93-
new_qenv(env = env, code = code)
94-
}
95-
)

_pkgdown.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ reference:
3434
- get_var
3535
- get_warnings
3636
- join
37-
- new_qenv
3837
- qenv
3938
- show,qenv-method
4039
- within.qenv

man/qenv.Rd

Lines changed: 2 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)