Skip to content

Commit a61d73b

Browse files
keewisIllviljanheadtr1ck
authored
use the files interface instead of the deprecated read_binary (#7664)
* use the `files` interface instead of the deprecated `read_binary` * use `read_text(encoding=...)` instead of `read_bytes(...).decode(...)` Co-authored-by: Michael Niklas <[email protected]> --------- Co-authored-by: Illviljan <[email protected]> Co-authored-by: Michael Niklas <[email protected]>
1 parent 4448828 commit a61d73b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

xarray/core/formatting_html.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from collections import OrderedDict
55
from functools import lru_cache, partial
66
from html import escape
7-
from importlib.resources import read_binary
7+
from importlib.resources import files
88

99
from xarray.core.formatting import (
1010
inline_index_repr,
@@ -23,7 +23,7 @@
2323
def _load_static_files():
2424
"""Lazily load the resource files into memory the first time they are needed"""
2525
return [
26-
read_binary(package, resource).decode("utf-8")
26+
files(package).joinpath(resource).read_text(encoding="utf-8")
2727
for package, resource in STATIC_FILES
2828
]
2929

0 commit comments

Comments
 (0)