mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-12 03:24:23 +02:00
Fix remaining type warnings in sqlite_utils package
- Add assert for sniff_buffer not being None - Handle cursor.fetchone() potentially returning None - Use db.table() for counts_table and index_foreign_keys - Add type: ignore for cursor union type in raw mode 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
2ba282db8a
commit
da739fbaba
2 changed files with 5 additions and 3 deletions
|
|
@ -1037,6 +1037,7 @@ def insert_upsert_implementation(
|
|||
if csv or tsv:
|
||||
if sniff:
|
||||
# Read first 2048 bytes and use that to detect
|
||||
assert sniff_buffer is not None
|
||||
first_bytes = sniff_buffer.peek(2048)
|
||||
dialect = csv_std.Sniffer().sniff(
|
||||
first_bytes.decode(encoding, "ignore")
|
||||
|
|
@ -2120,7 +2121,8 @@ def _execute_query(
|
|||
else:
|
||||
headers = [c[0] for c in cursor.description]
|
||||
if raw:
|
||||
data = cursor.fetchone()[0]
|
||||
row = cursor.fetchone() # type: ignore[union-attr]
|
||||
data = row[0] if row else None
|
||||
if isinstance(data, bytes):
|
||||
sys.stdout.buffer.write(data)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue