Prefix utility modules with underscore (#11999)

This commit is contained in:
Sebastian Rittau
2024-05-22 15:35:11 +02:00
committed by GitHub
parent f9664a4325
commit 425c69a6b9
15 changed files with 21 additions and 19 deletions

View File

@@ -147,7 +147,7 @@ extra-standard-library = [
"opcode",
"pyexpat",
]
known-first-party = ["parse_metadata", "utils"]
known-first-party = ["_metadata", "_utils"]
[tool.typeshed]
oldest_supported_python = "3.8"

View File

@@ -305,7 +305,7 @@ async def get_github_repo_info(session: aiohttp.ClientSession, stub_info: StubIn
Else, return None.
"""
if stub_info.upstream_repository:
# We have various sanity checks for the upstream_repository field in tests/parse_metadata.py,
# We have various sanity checks for the upstream_repository field in tests/_metadata.py,
# so no need to repeat all of them here
split_url = urllib.parse.urlsplit(stub_info.upstream_repository)
if split_url.netloc == "github.com":

View File

@@ -2,6 +2,7 @@
# pyright: reportUnknownVariableType=false, reportUnknownArgumentType=false
"""Tools to help parse and validate information stored in METADATA.toml files."""
from __future__ import annotations
import os
@@ -18,7 +19,7 @@ from packaging.requirements import Requirement
from packaging.specifiers import Specifier
from packaging.version import Version
from utils import cache
from _utils import cache
__all__ = [
"NoSuchStubError",

View File

@@ -12,8 +12,8 @@ import re
import sys
from pathlib import Path
from parse_metadata import read_metadata
from utils import (
from _metadata import read_metadata
from _utils import (
REQS_FILE,
STDLIB_PATH,
TEST_CASES_DIR,

View File

@@ -4,7 +4,7 @@ from __future__ import annotations
import os
import sys
from parse_metadata import read_dependencies
from _metadata import read_dependencies
distributions = sys.argv[1:]
if not distributions:

View File

@@ -2,7 +2,7 @@
import os
import sys
from parse_metadata import read_stubtest_settings
from _metadata import read_stubtest_settings
platform = sys.platform
distributions = sys.argv[1:]

View File

@@ -26,8 +26,8 @@ from typing_extensions import Annotated, TypeAlias
import tomli
from parse_metadata import PackageDependencies, get_recursive_requirements, read_metadata
from utils import (
from _metadata import PackageDependencies, get_recursive_requirements, read_metadata
from _utils import (
PYTHON_VERSION,
TESTS_DIR,
VERSIONS_RE as VERSION_LINE_RE,
@@ -202,7 +202,7 @@ def add_configuration(configurations: list[MypyDistConf], distribution: str) ->
with Path("stubs", distribution, "METADATA.toml").open("rb") as f:
data = tomli.load(f)
# TODO: This could be added to parse_metadata.py, but is currently unused
# TODO: This could be added to _metadata.py, but is currently unused
mypy_tests_conf: dict[str, dict[str, Any]] = data.get("mypy-tests", {})
if not mypy_tests_conf:
return

View File

@@ -6,7 +6,7 @@ import subprocess
import sys
from pathlib import Path
from utils import parse_requirements, print_command
from _utils import parse_requirements, print_command
_WELL_KNOWN_FILE = Path("tests", "pyright_test.py")

View File

@@ -24,7 +24,7 @@ from collections.abc import Iterable, Sequence
from packaging.requirements import Requirement
from parse_metadata import read_dependencies
from _metadata import read_dependencies
if sys.platform == "win32":
print("pytype does not support Windows.", file=sys.stderr)

View File

@@ -21,8 +21,8 @@ from functools import partial
from pathlib import Path
from typing_extensions import TypeAlias
from parse_metadata import get_recursive_requirements, read_metadata
from utils import (
from _metadata import get_recursive_requirements, read_metadata
from _utils import (
PYTHON_VERSION,
TEST_CASES_DIR,
DistributionTests,

View File

@@ -10,7 +10,7 @@ import sys
from pathlib import Path
from typing import Any
from utils import TEST_CASES_DIR, test_cases_path
from _utils import TEST_CASES_DIR, test_cases_path
try:
from termcolor import colored # pyright: ignore[reportAssignmentType]

View File

@@ -13,7 +13,7 @@ import subprocess
import sys
from pathlib import Path
from utils import allowlist_stubtest_arguments, allowlists_path
from _utils import allowlist_stubtest_arguments, allowlists_path
def run_stubtest(typeshed_dir: Path) -> int:

View File

@@ -12,8 +12,8 @@ from pathlib import Path
from textwrap import dedent
from typing import NoReturn
from parse_metadata import NoSuchStubError, get_recursive_requirements, read_metadata
from utils import (
from _metadata import NoSuchStubError, get_recursive_requirements, read_metadata
from _utils import (
PYTHON_VERSION,
allowlist_stubtest_arguments,
allowlists_path,

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env python3
"""Run mypy on the "tests" and "scripts" directories."""
from __future__ import annotations
import argparse
@@ -8,7 +9,7 @@ import sys
from itertools import product
from typing_extensions import TypeAlias
from utils import colored, print_error
from _utils import colored, print_error
ReturnCode: TypeAlias = int