From cad28ea8cc7b35e11b02344f590994458eb053ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABlle=20Salmon?= Date: Mon, 18 Dec 2023 15:29:37 +0100 Subject: [PATCH] refactor!: change R/par.R inline igraph_opt() and igraph_options() --- R/par.R | 41 ++++++++++++++++++++++++++++++++++++----- man/getIgraphOpt.Rd | 22 ++++++++++++++++++++++ man/igraph.options.Rd | 20 ++++++++++++++++++++ man/igraph_options.Rd | 2 -- 4 files changed, 78 insertions(+), 7 deletions(-) create mode 100644 man/getIgraphOpt.Rd create mode 100644 man/igraph.options.Rd diff --git a/R/par.R b/R/par.R index 5704cc350e..2f8b09d757 100644 --- a/R/par.R +++ b/R/par.R @@ -1,4 +1,39 @@ +#' Parameters for the igraph package +#' +#' @description +#' `r lifecycle::badge("deprecated")` +#' +#' `igraph.options()` was renamed to `igraph_options()` to create a more +#' consistent API. +#' @inheritParams igraph_options +#' @keywords internal +#' @export +igraph.options <- function(...) { # nocov start + lifecycle::deprecate_soft("2.0.0", "igraph.options()", "igraph_options()") + igraph_i_options(...) +} # nocov end + +#' Parameters for the igraph package +#' +#' @description +#' `r lifecycle::badge("deprecated")` +#' +#' `getIgraphOpt()` was renamed to `igraph_opt()` to create a more +#' consistent API. +#' @inheritParams igraph_opt +#' @keywords internal +#' @export +getIgraphOpt <- function(x, default = NULL) { # nocov start + lifecycle::deprecate_soft("2.0.0", "getIgraphOpt()", "igraph_opt()") + + if (missing(default)) { + get_config(paste0("igraph::", x), .igraph.pars[[x]]) + } else { + get_config(paste0("igraph::", x), default) + } +} # nocov end + # IGraph R package # Copyright (C) 2005-2012 Gabor Csardi # 334 Harvard street, Cambridge, MA 02139 USA @@ -126,7 +161,7 @@ igraph.pars.callbacks <- list("verbose" = igraph.pars.set.verbose) #' [attribute.combination()] for details on this.} #' } #' -#' @aliases igraph.options igraph_options getIgraphOpt igraph_opt +#' @aliases igraph_options igraph_opt #' @param \dots A list may be given as the only argument, or any number of #' arguments may be in the `name=value` form, or no argument at all may be #' given. See the Value and Details sections for explanation. @@ -247,7 +282,3 @@ with_igraph_opt <- function(options, code) { old <- igraph_options(options) force(code) } -#' @export getIgraphOpt -deprecated("getIgraphOpt", igraph_opt) -#' @export igraph.options -deprecated("igraph.options", igraph_options) diff --git a/man/getIgraphOpt.Rd b/man/getIgraphOpt.Rd new file mode 100644 index 0000000000..ca7b7a6a29 --- /dev/null +++ b/man/getIgraphOpt.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/par.R +\name{getIgraphOpt} +\alias{getIgraphOpt} +\title{Parameters for the igraph package} +\usage{ +getIgraphOpt(x, default = NULL) +} +\arguments{ +\item{x}{A character string holding an option name.} + +\item{default}{If the specified option is not set in the options list, this +value is returned. This facilitates retrieving an option and checking +whether it is set and setting it separately if not.} +} +\description{ +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} + +\code{getIgraphOpt()} was renamed to \code{igraph_opt()} to create a more +consistent API. +} +\keyword{internal} diff --git a/man/igraph.options.Rd b/man/igraph.options.Rd new file mode 100644 index 0000000000..2dcb1ded5a --- /dev/null +++ b/man/igraph.options.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/par.R +\name{igraph.options} +\alias{igraph.options} +\title{Parameters for the igraph package} +\usage{ +igraph.options(...) +} +\arguments{ +\item{...}{A list may be given as the only argument, or any number of +arguments may be in the \code{name=value} form, or no argument at all may be +given. See the Value and Details sections for explanation.} +} +\description{ +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} + +\code{igraph.options()} was renamed to \code{igraph_options()} to create a more +consistent API. +} +\keyword{internal} diff --git a/man/igraph_options.Rd b/man/igraph_options.Rd index 9c8797979a..4c75852c87 100644 --- a/man/igraph_options.Rd +++ b/man/igraph_options.Rd @@ -2,8 +2,6 @@ % Please edit documentation in R/par.R \name{igraph_options} \alias{igraph_options} -\alias{igraph.options} -\alias{getIgraphOpt} \alias{igraph_opt} \title{Parameters for the igraph package} \usage{