|
15 | 15 | from typing import Annotated, Any, Final, NamedTuple, final |
16 | 16 | from typing_extensions import TypeGuard |
17 | 17 |
|
18 | | -import tomli |
| 18 | +try: |
| 19 | + import tomllib |
| 20 | +except ImportError: |
| 21 | + import tomli as tomllib |
| 22 | + |
19 | 23 | import tomlkit |
20 | 24 | from packaging.requirements import Requirement |
21 | 25 | from packaging.specifiers import Specifier |
@@ -52,7 +56,7 @@ def _is_nested_dict(obj: object) -> TypeGuard[dict[str, dict[str, Any]]]: |
52 | 56 | @functools.cache |
53 | 57 | def get_oldest_supported_python() -> str: |
54 | 58 | with PYPROJECT_PATH.open("rb") as config: |
55 | | - val = tomli.load(config)["tool"]["typeshed"]["oldest_supported_python"] |
| 59 | + val = tomllib.load(config)["tool"]["typeshed"]["oldest_supported_python"] |
56 | 60 | assert type(val) is str |
57 | 61 | return val |
58 | 62 |
|
@@ -92,7 +96,7 @@ def system_requirements_for_platform(self, platform: str) -> list[str]: |
92 | 96 | def read_stubtest_settings(distribution: str) -> StubtestSettings: |
93 | 97 | """Return an object describing the stubtest settings for a single stubs distribution.""" |
94 | 98 | with metadata_path(distribution).open("rb") as f: |
95 | | - data: dict[str, object] = tomli.load(f).get("tool", {}).get("stubtest", {}) |
| 99 | + data: dict[str, object] = tomllib.load(f).get("tool", {}).get("stubtest", {}) |
96 | 100 |
|
97 | 101 | skip: object = data.get("skip", False) |
98 | 102 | apt_dependencies: object = data.get("apt_dependencies", []) |
|
0 commit comments