mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-27 21:32:12 +08:00
Switch from toml to tomli (#6023)
This commit is contained in:
@@ -15,7 +15,7 @@ import filecmp
|
||||
import os
|
||||
import re
|
||||
|
||||
import toml
|
||||
import tomli
|
||||
|
||||
consistent_files = [
|
||||
{"stdlib/@python2/builtins.pyi", "stdlib/@python2/__builtin__.pyi"},
|
||||
@@ -165,7 +165,7 @@ def _strip_dep_version(dependency):
|
||||
def check_metadata():
|
||||
for distribution in os.listdir("stubs"):
|
||||
with open(os.path.join("stubs", distribution, "METADATA.toml")) as f:
|
||||
data = toml.loads(f.read())
|
||||
data = tomli.loads(f.read())
|
||||
assert "version" in data, f"Missing version for {distribution}"
|
||||
version = data["version"]
|
||||
msg = f"Unsupported Python version {version}"
|
||||
|
||||
@@ -21,7 +21,7 @@ from glob import glob
|
||||
from pathlib import Path
|
||||
from typing import Dict, NamedTuple
|
||||
|
||||
import toml
|
||||
import tomli
|
||||
|
||||
parser = argparse.ArgumentParser(description="Test runner for typeshed. Patterns are unanchored regexps on the full path.")
|
||||
parser.add_argument("-v", "--verbose", action="count", default=0, help="More output")
|
||||
@@ -101,7 +101,7 @@ def parse_version(v_str):
|
||||
def is_supported(distribution, major):
|
||||
dist_path = Path("stubs", distribution)
|
||||
with open(dist_path / "METADATA.toml") as f:
|
||||
data = dict(toml.loads(f.read()))
|
||||
data = dict(tomli.loads(f.read()))
|
||||
if major == 2:
|
||||
# Python 2 is not supported by default.
|
||||
return bool(data.get("python2", False)) or (dist_path / "@python2").exists()
|
||||
@@ -154,7 +154,7 @@ def add_configuration(configurations, seen_dist_configs, distribution):
|
||||
return
|
||||
|
||||
with open(os.path.join("stubs", distribution, "METADATA.toml")) as f:
|
||||
data = dict(toml.loads(f.read()))
|
||||
data = dict(tomli.loads(f.read()))
|
||||
|
||||
mypy_tests_conf = data.get("mypy-tests")
|
||||
if not mypy_tests_conf:
|
||||
|
||||
@@ -6,7 +6,7 @@ import functools
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import toml
|
||||
import tomli
|
||||
import venv
|
||||
from glob import glob
|
||||
from pathlib import Path
|
||||
@@ -34,7 +34,7 @@ def get_mypy_req():
|
||||
|
||||
def run_stubtest(dist: Path) -> None:
|
||||
with open(dist / "METADATA.toml") as f:
|
||||
metadata = dict(toml.loads(f.read()))
|
||||
metadata = dict(tomli.loads(f.read()))
|
||||
|
||||
# Ignore stubs that don't support Python 3
|
||||
if not has_py3_stubs(dist):
|
||||
|
||||
Reference in New Issue
Block a user