Skip to content

Commit

Permalink
Release/cran270 (#249)
Browse files Browse the repository at this point in the history

### Breaking changes (Antares v8.7.0) : 

* `readBindingConstraints()` read now Scenarized RHS for binding constraints (cf. Antares v8.7 changelog)
  - function returns a new list structure
* Private function `fread_antares()` no longer returns warnings  
* `api_put()/api_delete()` return a server error message 

BUGFIXES :  

* `readBindingConstraints()` read well study >= v8.3.2

DATA : 

* A test study in tar.gz format is available in version v8.7.0  
* An empty test study in version v8.7.0 for marginal cases 

Dependencies :  

* New package `lifecycle` to manage functions status/package status
  • Loading branch information
berthetclement authored May 29, 2024
1 parent 23d8954 commit 69256e9
Show file tree
Hide file tree
Showing 34 changed files with 874 additions and 284 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
branches: [main, master, develop]
pull_request:
branches: [main, master]
branches: [main, master, develop]

name: R-CMD-check

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
branches: [main, master, develop]
pull_request:
branches: [main, master]
branches: [main, master, develop]

name: test-coverage

Expand Down
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: antaresRead
Type: Package
Title: Import, Manipulate and Explore the Results of an 'Antares' Simulation
Version: 2.6.1
Version: 2.7.0
Authors@R: c(
person("Tatiana", "Vargas", email = "[email protected]", role = c("aut", "cre")),
person("Jalal-Edine", "ZAWAM", role = "aut"),
Expand Down Expand Up @@ -39,7 +39,8 @@ Imports:
httr,
utils,
memuse,
purrr
purrr,
lifecycle
Suggests:
rhdf5 (>= 2.24.0),
testthat,
Expand Down
239 changes: 120 additions & 119 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,119 +1,120 @@
# Generated by roxygen2: do not edit by hand

S3method("[",antaresDataTable)
S3method(as.antaresDataList,antaresDataList)
S3method(as.antaresDataList,antaresDataTable)
S3method(as.antaresDataList,data.frame)
S3method(as.antaresDataList,default)
S3method(as.antaresDataList,list)
S3method(as.antaresDataTable,antaresDataTable)
S3method(as.antaresDataTable,data.frame)
S3method(as.antaresDataTable,default)
S3method(copyToClipboard,antaresDataList)
S3method(copyToClipboard,data.frame)
S3method(copyToClipboard,default)
S3method(copyToClipboard,matrix)
S3method(merge,antaresDataTable)
S3method(print,antaresDataList)
S3method(print,antaresDataTable)
S3method(print,simOptions)
S3method(subset,antaresDataList)
S3method(summary,bindingConstraints)
S3method(viewAntares,antaresDataList)
S3method(viewAntares,default)
export(.getOptionsH5)
export(.h5ReadAntares)
export(.writeAntaresH5Fun)
export(aggregateResult)
export(api_delete)
export(api_get)
export(api_post)
export(api_put)
export(as.antaresDataList)
export(as.antaresDataTable)
export(changeTimeStep)
export(copyToClipboard)
export(extractDataList)
export(getAlias)
export(getAreas)
export(getDistricts)
export(getGeographicTrimming)
export(getIdCols)
export(getLinks)
export(hvdcModification)
export(isH5Opts)
export(mergeDigests)
export(parAggregateMCall)
export(ponderateMcAggregation)
export(readAntares)
export(readAntaresAreas)
export(readAntaresClusters)
export(readBindingConstraints)
export(readClusterDesc)
export(readClusterResDesc)
export(readClusterSTDesc)
export(readDigestFile)
export(readIni)
export(readIniAPI)
export(readIniFile)
export(readInputRES)
export(readInputTS)
export(readInputThermal)
export(readLayout)
export(readOptimCriteria)
export(removeVirtualAreas)
export(setAlias)
export(setHvdcAreas)
export(setRam)
export(setSimulationPath)
export(setSimulationPathAPI)
export(setTimeoutAPI)
export(showAliases)
export(simOptions)
export(viewAntares)
export(writeAntaresH5)
export(writeDigest)
import(bit64)
import(data.table)
import(doParallel)
import(jsonlite)
import(parallel)
import(plyr)
importFrom(doParallel,registerDoParallel)
importFrom(grDevices,col2rgb)
importFrom(grDevices,rgb)
importFrom(httr,DELETE)
importFrom(httr,GET)
importFrom(httr,POST)
importFrom(httr,PUT)
importFrom(httr,accept_json)
importFrom(httr,add_headers)
importFrom(httr,content)
importFrom(httr,content_type_json)
importFrom(httr,http_status)
importFrom(httr,stop_for_status)
importFrom(httr,timeout)
importFrom(memuse,Sys.meminfo)
importFrom(methods,is)
importFrom(pbapply,pblapply)
importFrom(pbapply,pboptions)
importFrom(plyr,llply)
importFrom(purrr,quietly)
importFrom(shiny,getDefaultReactiveDomain)
importFrom(shiny,incProgress)
importFrom(shiny,withProgress)
importFrom(stats,as.formula)
importFrom(stats,setNames)
importFrom(stats,weighted.mean)
importFrom(stringi,stri_replace_last_fixed)
importFrom(stringr,str_match)
importFrom(stringr,str_replace)
importFrom(stringr,str_split)
importFrom(utils,URLencode)
importFrom(utils,View)
importFrom(utils,read.table)
importFrom(utils,setTxtProgressBar)
importFrom(utils,txtProgressBar)
importFrom(utils,type.convert)
importFrom(utils,untar)
importFrom(utils,write.table)
# Generated by roxygen2: do not edit by hand

S3method("[",antaresDataTable)
S3method(as.antaresDataList,antaresDataList)
S3method(as.antaresDataList,antaresDataTable)
S3method(as.antaresDataList,data.frame)
S3method(as.antaresDataList,default)
S3method(as.antaresDataList,list)
S3method(as.antaresDataTable,antaresDataTable)
S3method(as.antaresDataTable,data.frame)
S3method(as.antaresDataTable,default)
S3method(copyToClipboard,antaresDataList)
S3method(copyToClipboard,data.frame)
S3method(copyToClipboard,default)
S3method(copyToClipboard,matrix)
S3method(merge,antaresDataTable)
S3method(print,antaresDataList)
S3method(print,antaresDataTable)
S3method(print,simOptions)
S3method(subset,antaresDataList)
S3method(summary,bindingConstraints)
S3method(viewAntares,antaresDataList)
S3method(viewAntares,default)
export(.getOptionsH5)
export(.h5ReadAntares)
export(.writeAntaresH5Fun)
export(aggregateResult)
export(api_delete)
export(api_get)
export(api_post)
export(api_put)
export(as.antaresDataList)
export(as.antaresDataTable)
export(changeTimeStep)
export(copyToClipboard)
export(extractDataList)
export(getAlias)
export(getAreas)
export(getDistricts)
export(getGeographicTrimming)
export(getIdCols)
export(getLinks)
export(hvdcModification)
export(isH5Opts)
export(mergeDigests)
export(parAggregateMCall)
export(ponderateMcAggregation)
export(readAntares)
export(readAntaresAreas)
export(readAntaresClusters)
export(readBindingConstraints)
export(readClusterDesc)
export(readClusterResDesc)
export(readClusterSTDesc)
export(readDigestFile)
export(readIni)
export(readIniAPI)
export(readIniFile)
export(readInputRES)
export(readInputTS)
export(readInputThermal)
export(readLayout)
export(readOptimCriteria)
export(removeVirtualAreas)
export(setAlias)
export(setHvdcAreas)
export(setRam)
export(setSimulationPath)
export(setSimulationPathAPI)
export(setTimeoutAPI)
export(showAliases)
export(simOptions)
export(viewAntares)
export(writeAntaresH5)
export(writeDigest)
import(bit64)
import(data.table)
import(doParallel)
import(jsonlite)
import(parallel)
import(plyr)
importFrom(doParallel,registerDoParallel)
importFrom(grDevices,col2rgb)
importFrom(grDevices,rgb)
importFrom(httr,DELETE)
importFrom(httr,GET)
importFrom(httr,POST)
importFrom(httr,PUT)
importFrom(httr,accept_json)
importFrom(httr,add_headers)
importFrom(httr,content)
importFrom(httr,content_type_json)
importFrom(httr,http_status)
importFrom(httr,stop_for_status)
importFrom(httr,timeout)
importFrom(lifecycle,deprecated)
importFrom(memuse,Sys.meminfo)
importFrom(methods,is)
importFrom(pbapply,pblapply)
importFrom(pbapply,pboptions)
importFrom(plyr,llply)
importFrom(purrr,quietly)
importFrom(shiny,getDefaultReactiveDomain)
importFrom(shiny,incProgress)
importFrom(shiny,withProgress)
importFrom(stats,as.formula)
importFrom(stats,setNames)
importFrom(stats,weighted.mean)
importFrom(stringi,stri_replace_last_fixed)
importFrom(stringr,str_match)
importFrom(stringr,str_replace)
importFrom(stringr,str_split)
importFrom(utils,URLencode)
importFrom(utils,View)
importFrom(utils,read.table)
importFrom(utils,setTxtProgressBar)
importFrom(utils,txtProgressBar)
importFrom(utils,type.convert)
importFrom(utils,untar)
importFrom(utils,write.table)
32 changes: 31 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
> Copyright © 2016 RTE Réseau de transport d’électricité
# antaresRead 2.6.1
# antaresRead 2.7.0

### Breaking changes (Antares v8.7.0) :

* `readBindingConstraints()` read now Scenarized RHS for binding constraints (cf. Antares v8.7 changelog)
- function returns a new list structure
* Private function `fread_antares()` no longer returns warnings
* `api_put()/api_delete()` return a server error message

BUGFIXES :

* `readBindingConstraints()` read well study >= v8.3.2

DATA :

* A test study in tar.gz format is available in version v8.7.0
* An empty test study in version v8.7.0 for marginal cases

Dependencies :

* New package `lifecycle` to manage functions status/package status


# antaresRead 2.6.2 (development)

BUGFIXES :
* `readIniFile()` : avoid `utils::type.convert` on specific cases (ex : 789e or 123i)
* `api_get()` add encoding argument to pass to `httr::content()`


# antaresRead 2.6.1

BUGFIXES :

Expand Down
27 changes: 21 additions & 6 deletions R/API-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#' @param ... Additional arguments passed to API method.
#' @param default_endpoint Default endpoint to use.
#' @param parse_result `character` options for parameter `as` of function [httr::content()]
#' @param encoding argument to pass as argument to the function [httr::content()]
#' @param opts Antares simulation options or a `list` with an `host = ` slot.
#'
#' @return Response from the API.
Expand All @@ -24,16 +25,18 @@
#' endpoint = NULL,
#' parse_result = NULL)
#'
#' # you can force parse options as text
#' # you can force parse options as text and encoding to UTF-8
#' api_get(opts = list(host = "http://0.0.0.0:8080"),
#' endpoint = NULL,
#' parse_result = "text")
#' parse_result = "text",
#' encoding = "UTF-8")
#'
#' }
api_get <- function(opts,
endpoint, ...,
default_endpoint = "v1/studies",
parse_result = NULL) {
parse_result = NULL,
encoding = NULL) {
if (inherits(endpoint, "AsIs")) {
opts$host <- endpoint
endpoint <- NULL
Expand Down Expand Up @@ -74,7 +77,7 @@ api_get <- function(opts,
stop_for_status(result, task = mess_error)
}else
warn_for_status(result)
content(result, as = parse_result)
content(result, as = parse_result, encoding = encoding)
}

#' @export
Expand Down Expand Up @@ -141,7 +144,13 @@ api_put <- function(opts, endpoint, ..., default_endpoint = "v1/studies") {
config,
...
)
stop_for_status(result)
api_content <- content(result)
if(!is.null(names(api_content)))
api_content <- paste0("\n[Description] : ", api_content$description,
"\n[Exception] : ", api_content$exception)
else
api_content <- NULL
stop_for_status(result, task = api_content)
content(result)
}

Expand Down Expand Up @@ -175,6 +184,12 @@ api_delete <- function(opts, endpoint, ..., default_endpoint = "v1/studies") {
config = config,
...
)
stop_for_status(result)
api_content <- content(result)
if(!is.null(names(api_content)))
api_content <- paste0("\n[Description] : ", api_content$description,
"\n[Exception] : ", api_content$exception)
else
api_content <- NULL
stop_for_status(result, task = api_content)
content(result)
}
7 changes: 7 additions & 0 deletions R/antaresRead-package.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#' @keywords internal
"_PACKAGE"

## usethis namespace: start
#' @importFrom lifecycle deprecated
## usethis namespace: end
NULL
Loading

0 comments on commit 69256e9

Please sign in to comment.