Skip to content

Commit 69256e9

Browse files
Release/cran270 (#249)
### 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
1 parent 23d8954 commit 69256e9

34 files changed

Lines changed: 874 additions & 284 deletions

.github/workflows/R-CMD-check.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
33
on:
44
push:
5-
branches: [main, master]
5+
branches: [main, master, develop]
66
pull_request:
7-
branches: [main, master]
7+
branches: [main, master, develop]
88

99
name: R-CMD-check
1010

.github/workflows/test-coverage.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
33
on:
44
push:
5-
branches: [main, master]
5+
branches: [main, master, develop]
66
pull_request:
7-
branches: [main, master]
7+
branches: [main, master, develop]
88

99
name: test-coverage
1010

DESCRIPTION

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: antaresRead
22
Type: Package
33
Title: Import, Manipulate and Explore the Results of an 'Antares' Simulation
4-
Version: 2.6.1
4+
Version: 2.7.0
55
Authors@R: c(
66
person("Tatiana", "Vargas", email = "tatiana.vargas@rte-france.com", role = c("aut", "cre")),
77
person("Jalal-Edine", "ZAWAM", role = "aut"),
@@ -39,7 +39,8 @@ Imports:
3939
httr,
4040
utils,
4141
memuse,
42-
purrr
42+
purrr,
43+
lifecycle
4344
Suggests:
4445
rhdf5 (>= 2.24.0),
4546
testthat,

NAMESPACE

Lines changed: 120 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,120 @@
1-
# Generated by roxygen2: do not edit by hand
2-
3-
S3method("[",antaresDataTable)
4-
S3method(as.antaresDataList,antaresDataList)
5-
S3method(as.antaresDataList,antaresDataTable)
6-
S3method(as.antaresDataList,data.frame)
7-
S3method(as.antaresDataList,default)
8-
S3method(as.antaresDataList,list)
9-
S3method(as.antaresDataTable,antaresDataTable)
10-
S3method(as.antaresDataTable,data.frame)
11-
S3method(as.antaresDataTable,default)
12-
S3method(copyToClipboard,antaresDataList)
13-
S3method(copyToClipboard,data.frame)
14-
S3method(copyToClipboard,default)
15-
S3method(copyToClipboard,matrix)
16-
S3method(merge,antaresDataTable)
17-
S3method(print,antaresDataList)
18-
S3method(print,antaresDataTable)
19-
S3method(print,simOptions)
20-
S3method(subset,antaresDataList)
21-
S3method(summary,bindingConstraints)
22-
S3method(viewAntares,antaresDataList)
23-
S3method(viewAntares,default)
24-
export(.getOptionsH5)
25-
export(.h5ReadAntares)
26-
export(.writeAntaresH5Fun)
27-
export(aggregateResult)
28-
export(api_delete)
29-
export(api_get)
30-
export(api_post)
31-
export(api_put)
32-
export(as.antaresDataList)
33-
export(as.antaresDataTable)
34-
export(changeTimeStep)
35-
export(copyToClipboard)
36-
export(extractDataList)
37-
export(getAlias)
38-
export(getAreas)
39-
export(getDistricts)
40-
export(getGeographicTrimming)
41-
export(getIdCols)
42-
export(getLinks)
43-
export(hvdcModification)
44-
export(isH5Opts)
45-
export(mergeDigests)
46-
export(parAggregateMCall)
47-
export(ponderateMcAggregation)
48-
export(readAntares)
49-
export(readAntaresAreas)
50-
export(readAntaresClusters)
51-
export(readBindingConstraints)
52-
export(readClusterDesc)
53-
export(readClusterResDesc)
54-
export(readClusterSTDesc)
55-
export(readDigestFile)
56-
export(readIni)
57-
export(readIniAPI)
58-
export(readIniFile)
59-
export(readInputRES)
60-
export(readInputTS)
61-
export(readInputThermal)
62-
export(readLayout)
63-
export(readOptimCriteria)
64-
export(removeVirtualAreas)
65-
export(setAlias)
66-
export(setHvdcAreas)
67-
export(setRam)
68-
export(setSimulationPath)
69-
export(setSimulationPathAPI)
70-
export(setTimeoutAPI)
71-
export(showAliases)
72-
export(simOptions)
73-
export(viewAntares)
74-
export(writeAntaresH5)
75-
export(writeDigest)
76-
import(bit64)
77-
import(data.table)
78-
import(doParallel)
79-
import(jsonlite)
80-
import(parallel)
81-
import(plyr)
82-
importFrom(doParallel,registerDoParallel)
83-
importFrom(grDevices,col2rgb)
84-
importFrom(grDevices,rgb)
85-
importFrom(httr,DELETE)
86-
importFrom(httr,GET)
87-
importFrom(httr,POST)
88-
importFrom(httr,PUT)
89-
importFrom(httr,accept_json)
90-
importFrom(httr,add_headers)
91-
importFrom(httr,content)
92-
importFrom(httr,content_type_json)
93-
importFrom(httr,http_status)
94-
importFrom(httr,stop_for_status)
95-
importFrom(httr,timeout)
96-
importFrom(memuse,Sys.meminfo)
97-
importFrom(methods,is)
98-
importFrom(pbapply,pblapply)
99-
importFrom(pbapply,pboptions)
100-
importFrom(plyr,llply)
101-
importFrom(purrr,quietly)
102-
importFrom(shiny,getDefaultReactiveDomain)
103-
importFrom(shiny,incProgress)
104-
importFrom(shiny,withProgress)
105-
importFrom(stats,as.formula)
106-
importFrom(stats,setNames)
107-
importFrom(stats,weighted.mean)
108-
importFrom(stringi,stri_replace_last_fixed)
109-
importFrom(stringr,str_match)
110-
importFrom(stringr,str_replace)
111-
importFrom(stringr,str_split)
112-
importFrom(utils,URLencode)
113-
importFrom(utils,View)
114-
importFrom(utils,read.table)
115-
importFrom(utils,setTxtProgressBar)
116-
importFrom(utils,txtProgressBar)
117-
importFrom(utils,type.convert)
118-
importFrom(utils,untar)
119-
importFrom(utils,write.table)
1+
# Generated by roxygen2: do not edit by hand
2+
3+
S3method("[",antaresDataTable)
4+
S3method(as.antaresDataList,antaresDataList)
5+
S3method(as.antaresDataList,antaresDataTable)
6+
S3method(as.antaresDataList,data.frame)
7+
S3method(as.antaresDataList,default)
8+
S3method(as.antaresDataList,list)
9+
S3method(as.antaresDataTable,antaresDataTable)
10+
S3method(as.antaresDataTable,data.frame)
11+
S3method(as.antaresDataTable,default)
12+
S3method(copyToClipboard,antaresDataList)
13+
S3method(copyToClipboard,data.frame)
14+
S3method(copyToClipboard,default)
15+
S3method(copyToClipboard,matrix)
16+
S3method(merge,antaresDataTable)
17+
S3method(print,antaresDataList)
18+
S3method(print,antaresDataTable)
19+
S3method(print,simOptions)
20+
S3method(subset,antaresDataList)
21+
S3method(summary,bindingConstraints)
22+
S3method(viewAntares,antaresDataList)
23+
S3method(viewAntares,default)
24+
export(.getOptionsH5)
25+
export(.h5ReadAntares)
26+
export(.writeAntaresH5Fun)
27+
export(aggregateResult)
28+
export(api_delete)
29+
export(api_get)
30+
export(api_post)
31+
export(api_put)
32+
export(as.antaresDataList)
33+
export(as.antaresDataTable)
34+
export(changeTimeStep)
35+
export(copyToClipboard)
36+
export(extractDataList)
37+
export(getAlias)
38+
export(getAreas)
39+
export(getDistricts)
40+
export(getGeographicTrimming)
41+
export(getIdCols)
42+
export(getLinks)
43+
export(hvdcModification)
44+
export(isH5Opts)
45+
export(mergeDigests)
46+
export(parAggregateMCall)
47+
export(ponderateMcAggregation)
48+
export(readAntares)
49+
export(readAntaresAreas)
50+
export(readAntaresClusters)
51+
export(readBindingConstraints)
52+
export(readClusterDesc)
53+
export(readClusterResDesc)
54+
export(readClusterSTDesc)
55+
export(readDigestFile)
56+
export(readIni)
57+
export(readIniAPI)
58+
export(readIniFile)
59+
export(readInputRES)
60+
export(readInputTS)
61+
export(readInputThermal)
62+
export(readLayout)
63+
export(readOptimCriteria)
64+
export(removeVirtualAreas)
65+
export(setAlias)
66+
export(setHvdcAreas)
67+
export(setRam)
68+
export(setSimulationPath)
69+
export(setSimulationPathAPI)
70+
export(setTimeoutAPI)
71+
export(showAliases)
72+
export(simOptions)
73+
export(viewAntares)
74+
export(writeAntaresH5)
75+
export(writeDigest)
76+
import(bit64)
77+
import(data.table)
78+
import(doParallel)
79+
import(jsonlite)
80+
import(parallel)
81+
import(plyr)
82+
importFrom(doParallel,registerDoParallel)
83+
importFrom(grDevices,col2rgb)
84+
importFrom(grDevices,rgb)
85+
importFrom(httr,DELETE)
86+
importFrom(httr,GET)
87+
importFrom(httr,POST)
88+
importFrom(httr,PUT)
89+
importFrom(httr,accept_json)
90+
importFrom(httr,add_headers)
91+
importFrom(httr,content)
92+
importFrom(httr,content_type_json)
93+
importFrom(httr,http_status)
94+
importFrom(httr,stop_for_status)
95+
importFrom(httr,timeout)
96+
importFrom(lifecycle,deprecated)
97+
importFrom(memuse,Sys.meminfo)
98+
importFrom(methods,is)
99+
importFrom(pbapply,pblapply)
100+
importFrom(pbapply,pboptions)
101+
importFrom(plyr,llply)
102+
importFrom(purrr,quietly)
103+
importFrom(shiny,getDefaultReactiveDomain)
104+
importFrom(shiny,incProgress)
105+
importFrom(shiny,withProgress)
106+
importFrom(stats,as.formula)
107+
importFrom(stats,setNames)
108+
importFrom(stats,weighted.mean)
109+
importFrom(stringi,stri_replace_last_fixed)
110+
importFrom(stringr,str_match)
111+
importFrom(stringr,str_replace)
112+
importFrom(stringr,str_split)
113+
importFrom(utils,URLencode)
114+
importFrom(utils,View)
115+
importFrom(utils,read.table)
116+
importFrom(utils,setTxtProgressBar)
117+
importFrom(utils,txtProgressBar)
118+
importFrom(utils,type.convert)
119+
importFrom(utils,untar)
120+
importFrom(utils,write.table)

NEWS.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,36 @@
11
> Copyright © 2016 RTE Réseau de transport d’électricité
22
3-
# antaresRead 2.6.1
3+
# antaresRead 2.7.0
4+
5+
### Breaking changes (Antares v8.7.0) :
6+
7+
* `readBindingConstraints()` read now Scenarized RHS for binding constraints (cf. Antares v8.7 changelog)
8+
- function returns a new list structure
9+
* Private function `fread_antares()` no longer returns warnings
10+
* `api_put()/api_delete()` return a server error message
11+
12+
BUGFIXES :
13+
14+
* `readBindingConstraints()` read well study >= v8.3.2
15+
16+
DATA :
17+
18+
* A test study in tar.gz format is available in version v8.7.0
19+
* An empty test study in version v8.7.0 for marginal cases
20+
21+
Dependencies :
22+
23+
* New package `lifecycle` to manage functions status/package status
24+
25+
26+
# antaresRead 2.6.2 (development)
27+
28+
BUGFIXES :
29+
* `readIniFile()` : avoid `utils::type.convert` on specific cases (ex : 789e or 123i)
30+
* `api_get()` add encoding argument to pass to `httr::content()`
31+
32+
33+
# antaresRead 2.6.1
434

535
BUGFIXES :
636

R/API-methods.R

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#' @param ... Additional arguments passed to API method.
77
#' @param default_endpoint Default endpoint to use.
88
#' @param parse_result `character` options for parameter `as` of function [httr::content()]
9+
#' @param encoding argument to pass as argument to the function [httr::content()]
910
#' @param opts Antares simulation options or a `list` with an `host = ` slot.
1011
#'
1112
#' @return Response from the API.
@@ -24,16 +25,18 @@
2425
#' endpoint = NULL,
2526
#' parse_result = NULL)
2627
#'
27-
#' # you can force parse options as text
28+
#' # you can force parse options as text and encoding to UTF-8
2829
#' api_get(opts = list(host = "http://0.0.0.0:8080"),
2930
#' endpoint = NULL,
30-
#' parse_result = "text")
31+
#' parse_result = "text",
32+
#' encoding = "UTF-8")
3133
#'
3234
#' }
3335
api_get <- function(opts,
3436
endpoint, ...,
3537
default_endpoint = "v1/studies",
36-
parse_result = NULL) {
38+
parse_result = NULL,
39+
encoding = NULL) {
3740
if (inherits(endpoint, "AsIs")) {
3841
opts$host <- endpoint
3942
endpoint <- NULL
@@ -74,7 +77,7 @@ api_get <- function(opts,
7477
stop_for_status(result, task = mess_error)
7578
}else
7679
warn_for_status(result)
77-
content(result, as = parse_result)
80+
content(result, as = parse_result, encoding = encoding)
7881
}
7982

8083
#' @export
@@ -141,7 +144,13 @@ api_put <- function(opts, endpoint, ..., default_endpoint = "v1/studies") {
141144
config,
142145
...
143146
)
144-
stop_for_status(result)
147+
api_content <- content(result)
148+
if(!is.null(names(api_content)))
149+
api_content <- paste0("\n[Description] : ", api_content$description,
150+
"\n[Exception] : ", api_content$exception)
151+
else
152+
api_content <- NULL
153+
stop_for_status(result, task = api_content)
145154
content(result)
146155
}
147156

@@ -175,6 +184,12 @@ api_delete <- function(opts, endpoint, ..., default_endpoint = "v1/studies") {
175184
config = config,
176185
...
177186
)
178-
stop_for_status(result)
187+
api_content <- content(result)
188+
if(!is.null(names(api_content)))
189+
api_content <- paste0("\n[Description] : ", api_content$description,
190+
"\n[Exception] : ", api_content$exception)
191+
else
192+
api_content <- NULL
193+
stop_for_status(result, task = api_content)
179194
content(result)
180195
}

R/antaresRead-package.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#' @keywords internal
2+
"_PACKAGE"
3+
4+
## usethis namespace: start
5+
#' @importFrom lifecycle deprecated
6+
## usethis namespace: end
7+
NULL

0 commit comments

Comments
 (0)