From 48676a1599ebc19f3dd408f87e8da00f94efcde5 Mon Sep 17 00:00:00 2001 From: Tim Hatch Date: Sat, 20 Jan 2024 16:13:41 -0800 Subject: [PATCH] Fix toml loading on 3.10 --- checkdeps/metadata.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/checkdeps/metadata.py b/checkdeps/metadata.py index a0464a2..2ff6ec3 100644 --- a/checkdeps/metadata.py +++ b/checkdeps/metadata.py @@ -11,9 +11,9 @@ from typing import Dict, Generator, Sequence try: - from tomllib import load + from tomllib import loads as toml_loads except ImportError: - from toml import load + from toml import loads as toml_loads # type: ignore from packaging.requirements import Requirement from packaging.utils import canonicalize_name @@ -56,7 +56,7 @@ def get_metadata_requirements(target_dir: Path) -> Dict[str, Sequence[Requiremen pyproject_toml = target_dir / "pyproject.toml" if pyproject_toml.exists(): - doc = load(pyproject_toml) + doc = toml_loads(pyproject_toml.read_text()) project = doc.get("project", {}) deps = project.get("dependencies")