From 97b52dd5cbd168dcbb54621e931751aea9a0f4af Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Fri, 29 Oct 2021 10:24:44 +0100 Subject: [PATCH] fix deprecation warning from tomli --- src/black/files.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/black/files.py b/src/black/files.py index 4d7b47aaa9f..eb4a94a5e60 100644 --- a/src/black/files.py +++ b/src/black/files.py @@ -93,8 +93,8 @@ def parse_pyproject_toml(path_config: str) -> Dict[str, Any]: If parsing fails, will raise a tomli.TOMLDecodeError """ - with open(path_config, encoding="utf8") as f: - pyproject_toml = tomli.load(f) # type: ignore # due to deprecated API usage + with open(path_config, "rb") as f: + pyproject_toml = tomli.load(f) config = pyproject_toml.get("tool", {}).get("black", {}) return {k.replace("--", "").replace("-", "_"): v for k, v in config.items()}