From 6f10160a45ae9dbc3e725b0f8703c1208e002d73 Mon Sep 17 00:00:00 2001 From: Mason Daugherty Date: Mon, 28 Jul 2025 15:03:25 -0400 Subject: [PATCH] fix: `scripts/` errors --- scripts/release_branch.py | 6 ++++-- scripts/update_mypy_ruff.py | 16 ++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/scripts/release_branch.py b/scripts/release_branch.py index 91d4f3b007b..a7d0c2e06c5 100644 --- a/scripts/release_branch.py +++ b/scripts/release_branch.py @@ -3,11 +3,13 @@ python scripts/release_branch.py anthropic bagatur """ import glob -import tomllib -import toml import subprocess import sys +# Ignoring errors since this script is run in a controlled environment +import toml # type: ignore # pyright: ignore[reportMissingModuleSource] +import tomllib # type: ignore # pyright: ignore[reportMissingImports] + def main(*args): pkg = args[1] diff --git a/scripts/update_mypy_ruff.py b/scripts/update_mypy_ruff.py index 3bfd1439691..d5e66856ff7 100644 --- a/scripts/update_mypy_ruff.py +++ b/scripts/update_mypy_ruff.py @@ -1,12 +1,13 @@ """python scripts/update_mypy_ruff.py""" import glob -import tomllib +import re +import subprocess from pathlib import Path -import toml -import subprocess -import re +# Ignoring errors since this script is run in a controlled environment +import toml # type: ignore # pyright: ignore[reportMissingModuleSource] +import tomllib # type: ignore # pyright: ignore[reportMissingImports] ROOT_DIR = Path(__file__).parents[1] @@ -50,10 +51,9 @@ def main(): to_ignore = {} for l in logs: - if re.match("^(.*)\:(\d+)\: error:.*\[(.*)\]", l): - path, line_no, error_type = re.match( - "^(.*)\:(\d+)\: error:.*\[(.*)\]", l - ).groups() + match = re.match(r"^(.*):(\d+): error:.*\[(.*)\]", l) + if match: + path, line_no, error_type = match.groups() if (path, line_no) in to_ignore: to_ignore[(path, line_no)].append(error_type) else: