mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
Add stubdefaulter to create_baseline_stubs.py (#10127)
This commit is contained in:
@@ -12,6 +12,7 @@ pre-commit-hooks==4.4.0 # must match .pre-commit-confi
|
||||
pycln==2.1.3 # must match .pre-commit-config.yaml
|
||||
pytype==2023.4.27; platform_system != "Windows" and python_version < "3.11"
|
||||
pyyaml==6.0
|
||||
stubdefaulter==0.1.0
|
||||
termcolor>=2.3
|
||||
tomli==2.0.1
|
||||
tomlkit==0.11.8
|
||||
|
||||
@@ -50,6 +50,11 @@ def run_stubgen(package: str, output: str) -> None:
|
||||
subprocess.run(["stubgen", "-o", output, "-p", package, "--export-less"], check=True)
|
||||
|
||||
|
||||
def run_stubdefaulter(stub_dir: str) -> None:
|
||||
print(f"Running stubdefaulter: stubdefaulter --packages {stub_dir}")
|
||||
subprocess.run(["stubdefaulter", "--packages", stub_dir])
|
||||
|
||||
|
||||
def run_black(stub_dir: str) -> None:
|
||||
print(f"Running black: black {stub_dir}")
|
||||
subprocess.run(["black", stub_dir])
|
||||
@@ -57,7 +62,7 @@ def run_black(stub_dir: str) -> None:
|
||||
|
||||
def run_isort(stub_dir: str) -> None:
|
||||
print(f"Running isort: isort {stub_dir}")
|
||||
subprocess.run(["python3", "-m", "isort", stub_dir])
|
||||
subprocess.run([sys.executable, "-m", "isort", stub_dir])
|
||||
|
||||
|
||||
def create_metadata(stub_dir: str, version: str) -> None:
|
||||
@@ -152,6 +157,7 @@ def main() -> None:
|
||||
sys.exit(f"Error: {package_dir} already exists (delete it first)")
|
||||
|
||||
run_stubgen(package, stub_dir)
|
||||
run_stubdefaulter(stub_dir)
|
||||
|
||||
run_isort(stub_dir)
|
||||
run_black(stub_dir)
|
||||
|
||||
Reference in New Issue
Block a user