210 depracate datanames in teal.data::get_code - #343
Conversation
|
I think it should be OK to just delete this method and make a case in What do you think @gogonzo ? |
I'm not sure if we can just remove a method. Some people might use |
|
@gogonzo valid point, if someone prefixes |
|
Updated the opening comment and made this ready for the review! |
Code Coverage SummaryDiff against mainResults for commit: ff7cc1d Minimum allowed coverage is ♻️ This comment has been updated with latest results |
Unit Tests Summary 1 files 13 suites 1s ⏱️ Results for commit ff7cc1d. ♻️ This comment has been updated with latest results. |
Unit Test Performance Difference
Additional test case details
Results for commit 43f8eca ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
There is no point of keeping the old code. get_code should just use teal.code::get_code.
# method for teal_data
function(object, deparse, datanames = NULL, names = datanames, ...) {
<deprecate>
teal.code::get_code(object = object, deparse = deparse, names = names)
}Current implementation also assumes that get_code method for teal_data won't be deprecated (that it will stay) because it warns-deprecate only when datanames is specified.
|
@gogonzo totally! This is way easier and cleaner. Will improve! Thanks |
|
I see some local errors, that are also on CI/GitHub Actions > library(teal.data)
> tdata1 <- within(teal_data(), {a <- 1; b <- 2})
> get_code(tdata1)
Error in grDevices::pdf(nullfile()) : too many open devices
Called from: grDevices::pdf(nullfile())
|
Co-authored-by: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Signed-off-by: Marcin <133694481+m7pr@users.noreply.github.com>
…ghtsengineering/teal.data into 210_deprecate_get_code@main
…atanames if arguments are not named
Merge branch '218_deprecate_get_code@main' of https://github.com/insightsengineering/teal.data into 210_deprecate_get_code@main # Conflicts: # man/get_code.Rd
…whole teal.data::get_code
Merge branch 'main' into 210_deprecate_get_code@main # Conflicts: # R/teal_data-get_code.R # R/utils-get_code_dependency.R # tests/testthat/test-get_code.R
BLOCKED by - insightsengineering/teal.data#340 Closes - #210 Companion to - insightsengineering/teal.data#343 - insightsengineering/teal#1388 # Description Brings `names` parameter to `get_code` so that you can limit returned code to specific objects (and the lines that create those objects). `get_code_dependency` was moved from `teal.data` # Tested with ``` r library(teal.code) # EVAL CODE q <- qenv() q <- eval_code(q, code = c("a <- 1", "b <- 2")) q@code #> [1] "a <- 1\nb <- 2" get_code(q, names = "a") #> [1] "a <- 1" # WITHIN q <- qenv() q <- within(q, {a <- 1; b <- 2}) q@code #> [1] "a <- 1\nb <- 2" get_code(q, names = "a") #> [1] "a <- 1" # OLD TEAL.DATA t <- teal.data::teal_data(a = 5, code = c("a <- 1", "b <- 2")) t@code #> [1] "a <- 1\nb <- 2" teal.data::get_code(t, datanames = 'a') #> Warning in .local(object, deparse, ...): get_code(datanames) was deprecated in #> teal.data 0.6.1, use get_code(names) instead. #> [1] "a <- 1" ``` <sup>Created on 2024-10-16 with [reprex v2.1.1](https://reprex.tidyverse.org)</sup> # Local tests ```r > devtools::test() ℹ Testing teal.code ✔ | F W S OK | Context ✔ | 12 | qenv_concat ✔ | 8 | qenv_constructor ✔ | 26 | qenv_eval_code ✔ | 2 60 | qenv_get_code [1.1s] ✔ | 10 | qenv_get_var ✔ | 7 | qenv_get_warnings ✔ | 40 | qenv_join ✔ | 14 | qenv_within ✔ | 12 | utils ══ Results ══════════════════════════════════════════════════════════════════ Duration: 2.2 s ── Skipped tests (2) ──────────────────────────────────────────────────────── • This is not urgent and can be ommitted with @linksto tag. (1): test-qenv_get_code.R:526:3 • We will not resolve this, as this requires code evaluation. (1): test-qenv_get_code.R:318:3 [ FAIL 0 | WARN 0 | SKIP 2 | PASS 189 ] ```` # Local R CMD CHECK ```r ── R CMD check results ──────────────────────────────────── teal.code 0.5.0.9010 ──── Duration: 33.5s ❯ checking for future file timestamps ... NOTE unable to verify current time 0 errors ✔ | 0 warnings ✔ | 1 note ✖ R CMD check succeeded ``` --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com>
Part of
namesargument inget_codeto subset code for specific objects. teal.code#210Companion to
teal.data::get_codewithteal.code::get_codeteal#1388get_code_dependencyteal.code#214Description
Deprecates the usage of
datanamesparameter inteal.data::get_code(datanames)in favour ofteal.code::get_code(names).VBUMP package version locally to something greater than
0.6.1during testing.Created on 2024-10-17 with reprex v2.1.1