Skip to content

Commit e602c83

Browse files
committed
unused imports removed
1 parent 4710760 commit e602c83

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

sheet_ql.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
import re
1212
import argparse
1313
import logging
14-
import warnings
1514
from collections import deque
1615
from typing import Any, Optional, List, Tuple, Dict
16+
from importlib.util import find_spec
1717

1818
import pandas as pd
1919
import duckdb
@@ -22,19 +22,12 @@
2222
from rich.table import Table
2323
from openpyxl.styles import Font, PatternFill
2424

25-
try:
26-
import python_calamine
27-
28-
CALAMINE_AVAILABLE = True
29-
except ImportError:
30-
CALAMINE_AVAILABLE = False
25+
# --- OPTIONAL DEPENDENCIES ---
26+
# We check for availability without importing the modules directly
27+
# to satisfy linters and avoid unused import warnings.
3128

32-
try:
33-
import xlsxwriter
34-
35-
XLSXWRITER_AVAILABLE = True
36-
except ImportError:
37-
XLSXWRITER_AVAILABLE = False
29+
CALAMINE_AVAILABLE = find_spec("python_calamine") is not None
30+
XLSXWRITER_AVAILABLE = find_spec("xlsxwriter") is not None
3831

3932
try:
4033
from prompt_toolkit import PromptSession

tests/test_sheet_ql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def test_07_exit_with_staging_prompt(self, mock_export):
165165
def test_08_rename_command(self):
166166
"""Verifies the .rename meta-command updates DB and Cache."""
167167
self.tool._load_data([self.csv_path])
168-
self.tool._handle_meta_command(f".rename sales_2023_csv old_sales")
168+
self.tool._handle_meta_command(".rename sales_2023_csv old_sales")
169169

170170
tables = (
171171
self.tool.db_connection.execute("SHOW TABLES").fetchdf()["name"].tolist()

0 commit comments

Comments
 (0)