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

Remove lubridate #32

Merged
merged 2 commits into from
Nov 19, 2024
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
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Imports:
fs (>= 1.6.4),
glue (>= 1.8.0),
lifecycle (>= 1.0.0),
lubridate (>= 1.9.3),
purrr (>= 1.0.2),
readr (>= 2.0.0),
rlang (>= 1.1.4),
Expand Down
4 changes: 2 additions & 2 deletions R/builders.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ build_stratum <- function(stratum_name, project_path, order = 1) {
if (!stratum_name %in% current_strata) {
cat(
paste0(
stratum_name, " = { created = ", lubridate::today(),
stratum_name, " = { created = ", Sys.Date(),
", order = ", order,
" }\n"
),
Expand Down Expand Up @@ -136,7 +136,7 @@ build_lamina <- function(lamina_name, stratum_path, order = 1, skip_if_fail = FA
if (!lamina_name %in% current_laminae) {
cat(
paste0(
lamina_name, " = { created = ", lubridate::today(),
lamina_name, " = { created = ", Sys.Date(),
", order = ", order,
", skip_if_fail = ", stringr::str_to_lower(skip_if_fail),
" }\n"
Expand Down
4 changes: 2 additions & 2 deletions R/execution_plan.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# given a dataframe of an execution_plan, source each script in the order
# specified in the plan, with or without logging as specified by the user
run_execution_plan <- function(execution_plan, silent = FALSE) {
strata_start <- lubridate::now()
strata_start <- Sys.time()

initial_stratum <- execution_plan[1, ]$stratum
initial_lamina <- execution_plan[1, ]$lamina
Expand Down Expand Up @@ -41,7 +41,7 @@ run_execution_plan <- function(execution_plan, silent = FALSE) {
}
}

strata_end <- lubridate::now()
strata_end <- Sys.time()
total_time <- log_total_time(strata_start, strata_end)
log_message(
paste("Strata finished - duration:", total_time, "seconds")
Expand Down
2 changes: 1 addition & 1 deletion R/logging.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ log_message <- function(message, level = "INFO", out_or_err = "OUT") {
# check for stdout or stderr
checkmate::assert_choice(out_or_err, c("OUT", "ERR"))
timestamp <-
lubridate::now() |>
Sys.time() |>
as.character() |>
stringr::str_trunc(width = 24, ellipsis = "")

Expand Down
2 changes: 1 addition & 1 deletion R/manage_tomls.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ initial_stratum_toml <- function(path, name, order) {
readr::write_lines(
paste0(
"[strata]\n",
name, " = { created = ", lubridate::today(),
name, " = { created = ", Sys.Date(),
", order = ", order,
" }"
),
Expand Down
2 changes: 1 addition & 1 deletion R/read_write_toml.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ read_toml <- function(toml_path) {

var_list <-
tibble::lst(
created = lubridate::as_date(created),
created = as.Date(created),
order = as.integer(order)
)

Expand Down
2 changes: 1 addition & 1 deletion R/user_toml_interaction.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ view_toml <- function(toml_path) {
#' original_toml
#' new_toml <- original_toml |>
#' dplyr::mutate(
#' created = lubridate::ymd("2021-01-01")
#' created = as.Date("2021-01-01")
#' )
#' new_toml_path <- edit_toml(original_toml_path, new_toml)
#' view_toml(new_toml_path)
Expand Down
6 changes: 3 additions & 3 deletions man/edit_toml.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test-execution_plan.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ test_that("execution plan is as expected", {
lamina = c("first_lamina", "second_lamina"),
order = c(1, 2),
skip_if_fail = c(FALSE, FALSE),
created = lubridate::today(),
created = Sys.Date(),
script = c("my_code1", "my_code2"),
path = c(first_lamina_code, second_lamina_code)
)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-logging.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test_that("log_message and log_error to stderr", {


test_that("log_total_time works", {
begin <- lubridate::now()
begin <- Sys.time()
end <- begin + 100
expect_equal(log_total_time(begin, end), 100)
})
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-manage_tomls.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test_that("fixes order", {
name = "test",
order = c(1, 2, 3, 4, 5),
skip_if_fail = c("FALSE", "FALSE", "FALSE", "FALSE", "FALSE"),
created = lubridate::today()
created = Sys.Date()
)

expect_equal(
Expand All @@ -43,7 +43,7 @@ test_that("fixes order", {
type = "strata",
name = "test",
order = c(1, 2, 3, 4, 4),
created = lubridate::today()
created = Sys.Date()
)

expect_equal(
Expand Down
12 changes: 6 additions & 6 deletions tests/testthat/test-user_toml_interaction.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ test_that("check_toml_dataframe manages order", {
type = "strata",
name = "test",
order = c(1, 2, 3, 4, 4),
created = lubridate::today()
created = Sys.Date()
)

expect_equal(
Expand All @@ -131,7 +131,7 @@ test_that("check_toml_dataframe drops bad columns", {
name = "test",
bad_column0 = "test",
order = c(1, 2, 3, 4, 5),
created = lubridate::today(),
created = Sys.Date(),
bad_column1 = "test",
bad_column2 = "test",
bad_column3 = "test"
Expand All @@ -142,7 +142,7 @@ test_that("check_toml_dataframe drops bad columns", {
type = "strata",
name = "test",
order = c(1, 2, 3, 4, 5),
created = lubridate::today()
created = Sys.Date()
)

expect_equal(
Expand All @@ -168,7 +168,7 @@ test_that("check_toml_dataframe works with strata", {
type = "strata",
name = "test",
order = c(1, 2, 3, 4, 5),
created = lubridate::today()
created = Sys.Date()
)

expected_toml_snapshot <- toml_snapshot
Expand All @@ -186,7 +186,7 @@ test_that("check_toml_dataframe works with laminae", {
name = "test",
order = c(1, 2, 3, 4, 5),
skip_if_fail = FALSE,
created = lubridate::today()
created = Sys.Date()
)

expected_toml_snapshot <- toml_snapshot
Expand All @@ -203,7 +203,7 @@ test_that("check_toml_dataframe returns a dataframe", {
type = "strata",
name = "test",
order = c(1, 2, 3, 4, 5),
created = lubridate::today()
created = Sys.Date()
)

expect_equal(
Expand Down