Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP 218 deprecate get code@main #213

Closed
wants to merge 13 commits into from
Closed

Conversation

m7pr
Copy link
Contributor

@m7pr m7pr commented Oct 16, 2024

Closes #210 Companion to insightsengineering/teal.data#343

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

STILL WIP - as I have a question in insightsengineering/teal.data#343 (comment)

Tested with

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"

Created on 2024-10-16 with reprex v2.1.1

Local tests

> 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:3We 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 CMD check results ──────────────────────────────────── teal.code 0.5.0.9010 ────
Duration: 33.5schecking for future file timestamps ... NOTE
  unable to verify current time

0 errors| 0 warnings| 1 noteR CMD check succeeded

@m7pr m7pr added the core label Oct 16, 2024
Copy link
Contributor

github-actions bot commented Oct 16, 2024

✅ All contributors have signed the CLA
Posted by the CLA Assistant Lite bot.

@m7pr
Copy link
Contributor Author

m7pr commented Oct 16, 2024

I have read the CLA Document and I hereby sign the CLA

@m7pr m7pr closed this Oct 16, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2024
@m7pr m7pr deleted the 218_deprecate_get_code@main branch October 16, 2024 13:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Implement names argument in get_code to subset code for specific objects.
1 participant