From 1d8a183905d62f07d3c4738afa6f6fd3aa999a16 Mon Sep 17 00:00:00 2001 From: detachhead Date: Mon, 15 Jan 2024 20:51:18 +1000 Subject: [PATCH] fix pyright errors in python code --- basedpyright/run_node.py | 2 +- pdm_build.py | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/basedpyright/run_node.py b/basedpyright/run_node.py index 5ccefca5a6..42c0e86a49 100644 --- a/basedpyright/run_node.py +++ b/basedpyright/run_node.py @@ -7,4 +7,4 @@ def run(script_name: str): - node.run([Path(__file__).parent / f"{script_name}.js", *sys.argv[1:]]) + _ = node.run([Path(__file__).parent / f"{script_name}.js", *sys.argv[1:]]) diff --git a/pdm_build.py b/pdm_build.py index 67ef68ae2e..645e3f1fa3 100644 --- a/pdm_build.py +++ b/pdm_build.py @@ -3,12 +3,20 @@ from json import loads from pathlib import Path from shutil import copyfile, copytree +from typing import TYPE_CHECKING -from nodejs import npm +# https://github.com/samwillis/nodejs-pypi/pull/23 +if TYPE_CHECKING: + # https://github.com/astral-sh/ruff/issues/9528 + from subprocess import run as run_ # noqa: S404 + + run = run_ +else: + from nodejs.npm import run if not Path("node_modules").exists(): - _ = npm.run(["ci"], check=True) -_ = npm.run(["run", "build:cli:dev"], check=True) + _ = run(["ci"], check=True) +_ = run(["run", "build:cli:dev"], check=True) npm_package_dir = Path("packages/pyright") pypi_package_dir = Path("basedpyright")