Skip to content

Commit

Permalink
Optional import fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kdkavanagh committed Jul 9, 2024
1 parent e68887e commit 9423fe3
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ repos:
- pytest
- pyarrow-stubs
- pandas-stubs
- polars
exclude: "tests/snapshot_tests/"
args:
- "--disallow-untyped-calls"
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pandas-stubs = { version="^2.1.1", python=">=3.9,<3.13" }
pytest = "^7.3.1"
pytest-asyncio = ">=0.21,<0.24"
pytest-textual-snapshot = ">=0.4.0"
polars = ">=0.20.0"


[tool.ruff]
Expand Down
2 changes: 0 additions & 2 deletions src/textual_fastdatatable/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from textual_fastdatatable.backend import (
ArrowBackend,
PolarsBackend,
DataTableBackend,
create_backend,
)
Expand All @@ -9,7 +8,6 @@
__all__ = [
"DataTable",
"ArrowBackend",
"PolarsBackend",
"DataTableBackend",
"create_backend",
]
2 changes: 1 addition & 1 deletion src/textual_fastdatatable/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def create_backend(
return ArrowBackend(data, max_rows=max_rows)
if isinstance(data, pa.RecordBatch):
return ArrowBackend.from_batches(data, max_rows=max_rows)
if isinstance(data, pl.DataFrame) and _HAS_POLARS:
if _HAS_POLARS and isinstance(data, pl.DataFrame):
return PolarsBackend.from_dataframe(data, max_rows=max_rows)

if isinstance(data, Path) or isinstance(data, str):
Expand Down

0 comments on commit 9423fe3

Please sign in to comment.