Skip to content

Commit 68ab849

Browse files
SRIKAR-8-77Sreekar Reddyankatiyarmerelcht
authored
fix(datasets): default plotly.JSONDataset save encoding to UTF-8 (#1205)
* Fix:plotly.JSONDataset save encoding to UTF-8 * Fix test Signed-off-by: Merel Theisen <[email protected]> * Update release notes Signed-off-by: Merel Theisen <[email protected]> --------- Signed-off-by: Merel Theisen <[email protected]> Co-authored-by: Sreekar Reddy <[email protected]> Co-authored-by: Ankita Katiyar <[email protected]> Co-authored-by: Merel Theisen <[email protected]> Co-authored-by: Merel Theisen <[email protected]>
1 parent 1b2f4a3 commit 68ab849

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

kedro-datasets/RELEASE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
## Bug fixes and other changes
1919
- Updated `pandas.DeltaTableDataset` to be compatible with `deltalake` version 1.x.
20+
- Fix `plotly.JSONDataset` encoding errors by defaulting thesave encoding to UTF-8.
2021

2122
## Community contributions
2223

kedro-datasets/kedro_datasets/plotly/json_dataset.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ class JSONDataset(AbstractVersionedDataset[go.Figure, go.Figure | go.FigureWidge
5252

5353
DEFAULT_LOAD_ARGS: dict[str, Any] = {}
5454
DEFAULT_SAVE_ARGS: dict[str, Any] = {}
55-
DEFAULT_FS_ARGS: dict[str, Any] = {"open_args_save": {"mode": "w"}}
55+
DEFAULT_FS_ARGS: dict[str, Any] = {
56+
"open_args_save": {"mode": "w", "encoding": "utf-8"}
57+
}
5658

5759
def __init__( # noqa: PLR0913
5860
self,

kedro-datasets/tests/plotly/test_json_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def test_save_and_load(self, json_dataset, dummy_plot):
4040
reloaded = json_dataset.load()
4141
assert dummy_plot == reloaded
4242
assert json_dataset._fs_open_args_load == {}
43-
assert json_dataset._fs_open_args_save == {"mode": "w"}
43+
assert json_dataset._fs_open_args_save == {"mode": "w", "encoding": "utf-8"}
4444

4545
def test_exists(self, json_dataset, dummy_plot):
4646
"""Test `exists` method invocation for both existing and

0 commit comments

Comments
 (0)