Skip to content

remove unused functions #698

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

Merged
merged 1 commit into from
Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions R/aaa_models.R
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,6 @@ check_mode_with_no_engine <- function(cls, mode) {
}
}

check_engine_val <- function(eng) {
if (rlang::is_missing(eng) || length(eng) != 1 || !is.character(eng))
rlang::abort("Please supply a character string for an engine (e.g. `'lm'`).")
invisible(NULL)
}

check_arg_val <- function(arg) {
if (rlang::is_missing(arg) || length(arg) != 1 || !is.character(arg))
rlang::abort("Please supply a character string for the argument.")
Expand Down
12 changes: 0 additions & 12 deletions R/descriptors.R
Original file line number Diff line number Diff line change
Expand Up @@ -320,18 +320,6 @@ has_exprs <- function(x) {
is_symbolic(x)
}

make_descr <- function(object) {
if (length(object$args) > 0)
expr_main <- map_lgl(object$args, has_exprs)
else
expr_main <- FALSE
if (length(object$eng_args) > 0)
expr_eng_args <- map_lgl(object$eng_args, has_exprs)
else
expr_eng_args <- FALSE
any(expr_main) | any(expr_eng_args)
}

# Locate descriptors -----------------------------------------------------------

# take a model spec, see if any require descriptors
Expand Down
16 changes: 0 additions & 16 deletions R/engine_docs.R
Original file line number Diff line number Diff line change
Expand Up @@ -289,22 +289,6 @@ sort_c <- function(x) {
withr::with_collate("C", sort(x))
}

get_sorted_unique_engines <- function(x) {
engines <- x$engine
engines <- unique(engines)
engines <- sort_c(engines)
engines
}
combine_prefix_with_engines <- function(prefix, engines) {
if (length(engines) == 0L) {
engines <- "No engines currently available"
} else {
engines <- glue::glue_collapse(engines, sep = ", ")
}

glue::glue("{prefix} {engines}")
}

# ------------------------------------------------------------------------------

#' Locate and show errors/warnings in engine-specific documentation
Expand Down
4 changes: 0 additions & 4 deletions R/fit.R
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,6 @@ inher <- function(x, cls, cl) {

# ------------------------------------------------------------------------------


has_both_or_none <- function(a, b)
(!is.null(a) & is.null(b)) | (is.null(a) & !is.null(b))

check_interface <- function(formula, data, cl, model) {
inher(formula, "formula", cl)
inher(data, c("data.frame", "tbl_spark"), cl)
Expand Down
15 changes: 0 additions & 15 deletions R/misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@ levels_from_formula <- function(f, dat) {
res
}

is_spark <- function(x)
isTRUE(unname(x$method$fit$func["pkg"] == "sparklyr"))


#' @export
#' @keywords internal
#' @rdname add_on_exports
Expand Down Expand Up @@ -211,17 +207,6 @@ check_outcome <- function(y, spec) {
invisible(NULL)
}


# Get's a character string of varible names used as the outcome
# in a terms object
terms_y <- function(x) {
att <- attributes(x)
resp_ind <- att$response
y_expr <- att$predvars[[resp_ind + 1]]
all.vars(y_expr)
}


# ------------------------------------------------------------------------------

#' @export
Expand Down
29 changes: 0 additions & 29 deletions tests/testthat/test_misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,35 +41,6 @@ test_that('other objects', {

# ------------------------------------------------------------------------------

context("getting y names from terms")

test_that('getting y names from terms', {

expect_equal(
parsnip:::terms_y(lm(cbind(mpg, disp) ~., data = mtcars)$terms),
c("mpg", "disp")
)

expect_equal(
parsnip:::terms_y(lm(mpg ~., data = mtcars)$terms),
"mpg"
)

expect_equal(
parsnip:::terms_y(lm(log(mpg) ~., data = mtcars)$terms),
"mpg"
)

expect_equal(
parsnip:::terms_y(terms( ~., data = mtcars)),
character(0)
)


})

# ------------------------------------------------------------------------------

test_that('S3 method dispatch/registration', {

expect_error(
Expand Down