paws-r / paws

Paws, a package for Amazon Web Services in R
https://www.paws-r-sdk.com
Other
313 stars 37 forks source link

supported nested content within ini file (#667) #673

Closed DyfanJones closed 11 months ago

DyfanJones commented 11 months ago

This PR addresses the issue of being able to read nested content within an ini files.

For example AWS config file could have the following (this is prep work for #667):

[profile development]
s3 =
  max_concurrent_requests = 20
  max_queue_size = 10000
  multipart_threshold = 64MB

Previously paws would keep everything a as flattened list.

# paws.common 0.6.0
paws.common:::read_ini("data_ini")
#> $default
#> $default$arg1
#> [1] "value1"
#> 
#> $default$arg2
#> [1] "value2"
#> 
#> 
#> $foo
#> $foo$arg1
#> [1] "foo_value1"
#> 
#> $foo$arg2
#> [1] "foo_value2"
#> 
#> 
#> $`profile bar`
#> $`profile bar`$arg1
#> [1] "bar_value1"
#> 
#> $`profile bar`$arg2
#> [1] "bar_value2"
#> 
#> 
#> $equalsign
#> $equalsign$arg1
#> [1] "value1=="
#> 
#> $equalsign$arg2
#> [1] "value2"
#> 
#> 
#> $spaces
#> $spaces$arg1
#> [1] "value1"
#> 
#> $spaces$arg2
#> [1] "value2"
#> 
#> 
#> $`profile sts`
#> $`profile sts`$sts_regional_endpoint
#> [1] "legacy"
#> 
#> 
#> $nested
#> $nested$nested1
#> [1] ""
#> 
#> $nested$arg1
#> [1] "value1"
#> 
#> $nested$arg2
#> [1] "value2"
#> 
#> $nested$arg3
#> [1] "value3"
#> 
#> $nested$nested2
#> [1] ""
#> 
#> $nested$arg4
#> [1] "value4"

Created on 2023-09-14 with reprex v2.0.2

Now paws will include nested contents as a nest list.

# paws.common 0.6.0.9000
paws.common:::read_ini("data_ini")
#> $default
#> $default$arg1
#> [1] "value1"
#> 
#> $default$arg2
#> [1] "value2"
#> 
#> 
#> $foo
#> $foo$arg1
#> [1] "foo_value1"
#> 
#> $foo$arg2
#> [1] "foo_value2"
#> 
#> 
#> $`profile bar`
#> $`profile bar`$arg1
#> [1] "bar_value1"
#> 
#> $`profile bar`$arg2
#> [1] "bar_value2"
#> 
#> 
#> $equalsign
#> $equalsign$arg1
#> [1] "value1=="
#> 
#> $equalsign$arg2
#> [1] "value2"
#> 
#> 
#> $spaces
#> $spaces$arg1
#> [1] "value1"
#> 
#> $spaces$arg2
#> [1] "value2"
#> 
#> 
#> $`profile sts`
#> $`profile sts`$sts_regional_endpoint
#> [1] "legacy"
#> 
#> 
#> $nested
#> $nested$arg3
#> [1] "value3"
#> 
#> $nested$nested1
#> $nested$nested1$arg1
#> [1] "value1"
#> 
#> $nested$nested1$arg2
#> [1] "value2"
#> 
#> 
#> $nested$nested2
#> $nested$nested2$arg4
#> [1] "value4"

Created on 2023-09-14 with reprex v2.0.2

The new method for read_ini does have some performance improvement however it is hardly noticeable 😛 (roughly ~0.5ms improvement)

codecov[bot] commented 11 months ago

Codecov Report

Patch coverage has no change and project coverage change: +0.04% :tada:

Comparison is base (34b6d72) 84.00% compared to head (bfd3784) 84.05%.

:exclamation: Current head bfd3784 differs from pull request most recent head 027057b. Consider uploading reports for the commit 027057b to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #673 +/- ## ========================================== + Coverage 84.00% 84.05% +0.04% ========================================== Files 201 201 Lines 14365 14422 +57 ========================================== + Hits 12068 12122 +54 - Misses 2297 2300 +3 ``` [see 3 files with indirect coverage changes](https://app.codecov.io/gh/paws-r/paws/pull/673/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=paws-r)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.