From 5c15db90f4661c23638d94d920169da0eb10ba98 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Tue, 16 Dec 2025 16:26:57 -0800 Subject: [PATCH] Fix remaining type errors in cli.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add typing import and type annotations for dict kwargs - Use db.table() instead of db[] for extract command - Fix missing str() conversion for exception 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- sqlite_utils/cli.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sqlite_utils/cli.py b/sqlite_utils/cli.py index 7d59e53..d66966b 100644 --- a/sqlite_utils/cli.py +++ b/sqlite_utils/cli.py @@ -1,4 +1,5 @@ import base64 +from typing import Any import click from click_default_group import DefaultGroup # type: ignore from datetime import datetime, timezone @@ -705,7 +706,7 @@ def enable_fts( replace=replace, ) except OperationalError as ex: - raise click.ClickException(ex) + raise click.ClickException(str(ex)) @cli.command(name="populate-fts") @@ -1042,7 +1043,7 @@ def insert_upsert_implementation( ) else: dialect = "excel-tab" if tsv else "excel" - csv_reader_args = {"dialect": dialect} + csv_reader_args: dict[str, Any] = {"dialect": dialect} if delimiter: csv_reader_args["delimiter"] = delimiter if quotechar: @@ -2656,13 +2657,13 @@ def extract( db = sqlite_utils.Database(path) _register_db_for_cleanup(db) _load_extensions(db, load_extension) - kwargs = dict( + kwargs: dict[str, Any] = dict( columns=columns, table=other_table, fk_column=fk_column, rename=dict(rename), ) - db[table].extract(**kwargs) + db.table(table).extract(**kwargs) @cli.command(name="insert-files")